You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by as...@apache.org on 2008/03/26 04:13:09 UTC

svn commit: r641129 - /incubator/buildr/trunk/lib/java/artifact_namespace.rb

Author: assaf
Date: Tue Mar 25 20:13:09 2008
New Revision: 641129

URL: http://svn.apache.org/viewvc?rev=641129&view=rev
Log:
Moved require to top of file

Modified:
    incubator/buildr/trunk/lib/java/artifact_namespace.rb

Modified: incubator/buildr/trunk/lib/java/artifact_namespace.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/java/artifact_namespace.rb?rev=641129&r1=641128&r2=641129&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/java/artifact_namespace.rb (original)
+++ incubator/buildr/trunk/lib/java/artifact_namespace.rb Tue Mar 25 20:13:09 2008
@@ -14,6 +14,7 @@
 # the License.
 
 require 'java/artifact'
+require 'hpricot'
 
 module Buildr
 
@@ -181,7 +182,7 @@
                  end
         end
         name = name.to_s.split(/:{2,}/).join(':')
-        name = ROOT if name.to_s.blank?
+        name = ROOT if name.empty?
         @instances ||= Hash.new { |h, k| h[k] = new(k) }
         instance = @instances[name.to_sym]
         instance.need(needs) if needs
@@ -772,7 +773,7 @@
         end
       end
       return [] unless xml
-      doc = hpricot(xml)
+      doc = Hpricot(xml)
       case from
       when :metadata then
         doc.search("versions/version").map(&:innerHTML).reverse
@@ -794,25 +795,10 @@
               puts e.class, e
               return []
             end
-      doc = hpricot(xml)
+      doc = Hpricot(xml)
       doc.search("table.grid/tr/td[1]/a").map(&:innerHTML)
     end
 
-    def hpricot(xml)
-      send :require, 'hpricot'
-    rescue LoadError
-      cmd = "gem install hpricot"
-      if PLATFORM[/java/]
-        cmd = "jruby -S " + cmd + " --source http://caldersphere.net"
-      end
-      raise <<-NOTICE
-      Your system is missing the hpricot gem, install it with:
-        #{cmd}
-      NOTICE
-    else
-      Hpricot(xml)
-    end
-  end # Search
-
+  end
 end