buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lac...@apache.org
Subject svn commit: r697563 - /incubator/buildr/trunk/spec/eclipse_spec.rb
Date Sun, 21 Sep 2008 17:53:06 GMT
Author: lacton
Date: Sun Sep 21 10:53:06 2008
New Revision: 697563

URL: http://svn.apache.org/viewvc?rev=697563&view=rev
Log:
Reduced duplication by refactoring common code

Modified:
    incubator/buildr/trunk/spec/eclipse_spec.rb

Modified: incubator/buildr/trunk/spec/eclipse_spec.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/spec/eclipse_spec.rb?rev=697563&r1=697562&r2=697563&view=diff
==============================================================================
--- incubator/buildr/trunk/spec/eclipse_spec.rb (original)
+++ incubator/buildr/trunk/spec/eclipse_spec.rb Sun Sep 21 10:53:06 2008
@@ -33,10 +33,16 @@
     default_output = classpath_xml_elements.collect("classpathentry[@kind='output']") { |n|
n.attributes['path'] }
     specific_output[0] || default_output[0]
   end
+  
+  def project_xml_elements
+    task('eclipse').invoke
+    REXML::Document.new(File.open('.project')).root.elements
+  end
 end
 
 
 describe Buildr::Eclipse do
+  include EclipseHelper
   
   describe "eclipse's .project file" do
     
@@ -49,15 +55,11 @@
       JAVA_BUILDER  = 'org.eclipse.jdt.core.javabuilder'
       
       def project_natures
-        task('eclipse').invoke
-        REXML::Document.new(File.open('.project')).
-          root.elements.collect("natures/nature") { |n| n.text }
+        project_xml_elements.collect("natures/nature") { |n| n.text }
       end
       
       def build_commands
-        task('eclipse').invoke
-        REXML::Document.new(File.open('.project')).
-          root.elements.collect("buildSpec/buildCommand/name") { |n| n.text }
+        project_xml_elements.collect("buildSpec/buildCommand/name") { |n| n.text }
       end
       
       before do
@@ -88,9 +90,7 @@
       JAVA_CONTAINER  = 'org.eclipse.jdt.launching.JRE_CONTAINER'
       
       def classpath_containers attribute='path'
-        task('eclipse').invoke
-        REXML::Document.new(File.open('.classpath')).
-          root.elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute]
}
+        classpath_xml_elements.collect("classpathentry[@kind='con']") { |n| n.attributes[attribute]
}
       end
       
       before do
@@ -107,7 +107,6 @@
     end
     
     describe 'source folders' do
-      include EclipseHelper
       
       before do
         write 'buildfile'



Mime
View raw message