Author: donaldp
Date: Fri Jan 11 04:36:26 2013
New Revision: 1431875

URL: http://svn.apache.org/viewvc?rev=1431875&view=rev
Log:
Sort the components in IDEA project files in the same order the idea sorts them.

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=1431875&r1=1431874&r2=1431875&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Fri Jan 11 04:36:26 2013
@@ -1,4 +1,6 @@
 1.4.10 (Pending)
+* Change: Sort the components in IDEA project files in the same
+          order the idea sorts them.
 * Fixed:  Findbugs addon correctly handles String dependencies
           (vs task dependencies)
 * Fixed:  Checkstyle addon correctly handles String dependencies

Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: 
http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1431875&r1=1431874&r2=1431875&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Fri Jan 11 04:36:26 2013
@@ -136,6 +136,14 @@ module Buildr
           end
         end
         inject_components(doc, self.default_components.compact + 
self.components)
+
+        # Sort the components in the same order the idea sorts them
+        sorted = doc.root.get_elements('//component').sort { |s1, s2| 
s1.attribute('name').value <=> s2.attribute('name').value }
+        doc = base_document
+        sorted.each do |element|
+          doc.root.add_element element
+        end
+
         doc
       end
 


Reply via email to