Author: lacton
Date: Sun Sep 21 11:03:57 2008
New Revision: 697566

URL: http://svn.apache.org/viewvc?rev=697566&view=rev
Log:
Encapsulated Builder::XmlMarkup inside the ClasspathEntryWriter class since its 
an implementation detail

Modified:
    incubator/buildr/trunk/lib/buildr/ide/eclipse.rb

Modified: incubator/buildr/trunk/lib/buildr/ide/eclipse.rb
URL: 
http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/ide/eclipse.rb?rev=697566&r1=697565&r2=697566&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/ide/eclipse.rb (original)
+++ incubator/buildr/trunk/lib/buildr/ide/eclipse.rb Sun Sep 21 11:03:57 2008
@@ -53,10 +53,8 @@
           m2repo = Buildr::Repositories.instance.local
 
           File.open(task.name, "w") do |file|
-            xml = Builder::XmlMarkup.new(:target=>file, :indent=>2)
-            xml.classpath do
-              classpathentry = ClasspathEntryWriter.new project, xml
-
+            classpathentry = ClasspathEntryWriter.new project, file
+            classpathentry.write do
               # Note: Use the test classpath since Eclipse compiles both 
"main" and "test" classes using the same classpath
               cp = project.test.compile.dependencies.map(&:to_s) - [ 
project.compile.target.to_s, project.resources.target.to_s ]
               cp = cp.uniq
@@ -129,13 +127,17 @@
     # It converts absolute paths to relative paths.
     # It ignores duplicate directories.
     class ClasspathEntryWriter
-      def initialize project, xml_builder
+      def initialize project, target
         @project = project
-        @xml = xml_builder
+        @xml = Builder::XmlMarkup.new(:target=>target, :indent=>2)
         @excludes = [ '**/.svn/', '**/CVS/' ].join('|')
         @paths_written = []
       end
       
+      def write &block
+        @xml.classpath &block
+      end
+      
       def con path
         @xml.classpathentry :kind=>'con', :path=>path
       end


Reply via email to