You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by to...@apache.org on 2010/04/03 08:20:17 UTC

svn commit: r930483 - in /buildr/trunk: CHANGELOG lib/buildr/ide/idea7x.rb spec/ide/idea7x_spec.rb

Author: toulmean
Date: Sat Apr  3 06:20:16 2010
New Revision: 930483

URL: http://svn.apache.org/viewvc?rev=930483&view=rev
Log:
fix for BUILDR-405 Enhance the idea7x extension to supply a task to delete generated files

Modified:
    buildr/trunk/CHANGELOG
    buildr/trunk/lib/buildr/ide/idea7x.rb
    buildr/trunk/spec/ide/idea7x_spec.rb

Modified: buildr/trunk/CHANGELOG
URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=930483&r1=930482&r2=930483&view=diff
==============================================================================
--- buildr/trunk/CHANGELOG (original)
+++ buildr/trunk/CHANGELOG Sat Apr  3 06:20:16 2010
@@ -1,4 +1,6 @@
 1.4.0 (Pending)
+* Added:  BUILDR-405 Enhance the idea7x extension to supply a task to delete generated files
+          (Peter Donald)
 * Added:  Support for regexps in include and exclude patterns (BUILDR-406)
 * Added:  Support for Scala 2.8 compiler-level change detection and dependency
           tracking

Modified: buildr/trunk/lib/buildr/ide/idea7x.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea7x.rb?rev=930483&r1=930482&r2=930483&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea7x.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea7x.rb Sat Apr  3 06:20:16 2010
@@ -37,10 +37,14 @@ module Buildr
       # Global task "idea" generates artifacts for all projects.
       desc "Generate Idea 7.x artifacts for all projects"
       Project.local_task "idea7x"=>"artifacts"
+
+      desc "Delete the generated  Idea 7.x artifacts for all projects"
+      Project.local_task "idea7x:clean"
     end
 
     before_define(:idea7x) do |project|
       project.recursive_task("idea7x")
+      project.recursive_task("idea7x:clean")
     end
 
     after_define(:idea7x => :package) do |project|
@@ -99,11 +103,18 @@ module Buildr
         end
       end
 
+      # Add task to remove generated module
+      project.task("idea7x:clean") do
+        if File.exist?(task_name)
+          info "Removing #{task_name}"
+          rm_rf task_name 
+        end
+      end
+
       # Root project aggregates all the subprojects.
       if project.parent == nil
         Buildr::Idea7x.generate_ipr(project, idea7x, Buildr.application.buildfile)
       end
-
     end # after_define
 
     class << self
@@ -200,6 +211,14 @@ module Buildr
             template_xml.write file
           end
         end
+
+        # Add task to remove generated project file
+        project.task("idea7x:clean") do
+          if File.exist?(task_name)
+            info "Removing #{task_name}" 
+            rm_rf task_name 
+          end
+        end
       end
 
     end

Modified: buildr/trunk/spec/ide/idea7x_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea7x_spec.rb?rev=930483&r1=930482&r2=930483&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea7x_spec.rb (original)
+++ buildr/trunk/spec/ide/idea7x_spec.rb Sat Apr  3 06:20:16 2010
@@ -81,4 +81,16 @@ describe Idea7x do
       ipr_module_fileurls.should include("file://$PROJECT_DIR$/aitch/alphabet-h-7x.iml")
     end
   end
+  
+  describe "idea7x:clean" do
+    
+    it "should remove the idea7x project" do
+      write "src/main/java/com/example/Hello.java", ""
+      write "foo-7x.iml", ""
+      foo = define("foo")
+      foo.task("idea7x:clean").invoke
+      File.exists?("foo-7x.iml").should be_false
+    end
+    
+  end
 end