diff options
author | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-08-03 16:19:53 +0200 |
---|---|---|
committer | Joachim Filip Ignacy Bartosik <jbartosik@gmail.com> | 2010-08-09 22:53:28 +0200 |
commit | 31e6ebc916353199f18cedaebdaceb18a10492bd (patch) | |
tree | 9a1f14b621ff5f7985640277500988244a765166 /lib/tasks | |
parent | Bugfix - previous commit was tested unproperly and introduced some bugs (diff) | |
download | recruiting-webapp-31e6ebc916353199f18cedaebdaceb18a10492bd.tar.gz recruiting-webapp-31e6ebc916353199f18cedaebdaceb18a10492bd.tar.bz2 recruiting-webapp-31e6ebc916353199f18cedaebdaceb18a10492bd.zip |
When obtaining lead data from gentoo.org use XPath to find nodes in XML
Diffstat (limited to 'lib/tasks')
-rw-r--r-- | lib/tasks/prepare.rake | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/lib/tasks/prepare.rake b/lib/tasks/prepare.rake index bc46a43..d9a90fc 100644 --- a/lib/tasks/prepare.rake +++ b/lib/tasks/prepare.rake @@ -41,29 +41,7 @@ namespace :prepare do def get_all_tags_with_name(uri, name) raw_data = Net::HTTP.get_response(URI.parse(uri)).body project_data = REXML::Document.new(raw_data) - projects_el = project_data.children - - removed_sth = true # So it'll enter loop first time - while removed_sth # Repeat until there is nothing left to remove - removed_sth = false - projects_el = projects_el.collect do |x| # Check all elements - if x.respond_to?(:name) && x.name == name # If element has name and - # it's what we're looking - # for let it stay. - x - else - removed_sth = true # otherwise remove it - x.respond_to?(:children) ? x.children : nil - end - end - - # Remove nils & flatten array - if removed_sth - projects_el.flatten! - projects_el.compact! - end - end - projects_el + REXML::XPath.match(project_data, "//#{name}") end devs = [] |