buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject svn commit: r1096660 - in /buildr/trunk: CHANGELOG lib/buildr/ide/idea.rb
Date Tue, 26 Apr 2011 04:55:41 GMT
Author: donaldp
Date: Tue Apr 26 04:55:41 2011
New Revision: 1096660

URL: http://svn.apache.org/viewvc?rev=1096660&view=rev
Log:
BUILDR-579 - Format generated IDEA project files to look more like what IntelliJ generates
(Peter Royal)

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/ide/idea.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1096660&r1=1096659&r2=1096660&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Tue Apr 26 04:55:41 2011
@@ -1,4 +1,6 @@
 1.4.6 (Pending)
+* Change: BUILDR-579 Format generated IDEA project files to look more like what
+          IntelliJ generates (Peter Royal)
 * Change: BUILDR-574 Enhance idea task to generate test resources with test scope
           (Jean-Philippe Caruana)
 * Change: BUILDR-576 Upgrade to JUnit 4.8.2

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1096660&r1=1096659&r2=1096660&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Tue Apr 26 04:55:41 2011
@@ -21,6 +21,10 @@ require 'stringio'
 
 module Buildr
   module IntellijIdea
+    def self.new_document(value)
+      REXML::Document.new(value, :attribute_quote => :quote)
+    end
+
     # Abstract base class for IdeaModule and IdeaProject
     class IdeaFile
       DEFAULT_SUFFIX = ""
@@ -47,7 +51,7 @@ module Buildr
       end
 
       def write(f)
-        document.write f
+        document.write(f, 2, false, true)
       end
 
       protected
@@ -61,7 +65,7 @@ module Buildr
         Builder::XmlMarkup.new(:target => target, :indent => 2).component(attrs.merge({:name
=> name})) do |xml|
           yield xml if block_given?
         end
-        REXML::Document.new(target.string).root
+        Buildr::IntellijIdea.new_document(target.string).root
       end
 
       def components
@@ -69,7 +73,7 @@ module Buildr
       end
 
       def load_document(filename)
-        REXML::Document.new(File.read(filename))
+        Buildr::IntellijIdea.new_document(File.read(filename))
       end
 
       def document
@@ -179,7 +183,7 @@ module Buildr
         Builder::XmlMarkup.new(:target => target, :indent => 2).facet(:name => name,
:type => type) do |xml|
           yield xml if block_given?
         end
-        self.facets << REXML::Document.new(target.string).root
+        self.facets << Buildr::IntellijIdea.new_document(target.string).root
       end
 
       def skip_content?
@@ -216,7 +220,7 @@ module Buildr
       def base_document
         target = StringIO.new
         Builder::XmlMarkup.new(:target => target).module(:version => "4", :relativePaths
=> "true", :type => self.type)
-        REXML::Document.new(target.string)
+        Buildr::IntellijIdea.new_document(target.string)
       end
 
       def initial_components
@@ -409,7 +413,7 @@ module Buildr
       def base_document
         target = StringIO.new
         Builder::XmlMarkup.new(:target => target).project(:version => "4", :relativePaths
=> "false")
-        REXML::Document.new(target.string)
+        Buildr::IntellijIdea.new_document(target.string)
       end
 
       def default_components



Mime
View raw message