Repository: buildr
Updated Branches:
  refs/heads/master 6bdaf33c6 -> 5563e85ab


Enhance the IdeaFile class to easily support mixing in of custom components 
from either the filesystem or from an artifact.


Project: http://git-wip-us.apache.org/repos/asf/buildr/repo
Commit: http://git-wip-us.apache.org/repos/asf/buildr/commit/5563e85a
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/5563e85a
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/5563e85a

Branch: refs/heads/master
Commit: 5563e85ab229c172ea122684436c1abec79cfb6e
Parents: 6bdaf33
Author: Peter Donald <[email protected]>
Authored: Mon Oct 20 16:36:12 2014 +1100
Committer: Peter Donald <[email protected]>
Committed: Mon Oct 20 16:36:12 2014 +1100

----------------------------------------------------------------------
 CHANGELOG              |  2 ++
 lib/buildr/ide/idea.rb | 15 +++++++++++++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/buildr/blob/5563e85a/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 48549bd..94543c0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.4.21 (Pending)
+* Added:  Enhance the IdeaFile class to easily support mixing in of custom
+          components from either the filesystem or from an artifact.
 * Change: Update rjb to version 1.5.1.
 * Added:  Update checkstyle addon to support downloading checkstyle checks
           as an artifact.

http://git-wip-us.apache.org/repos/asf/buildr/blob/5563e85a/lib/buildr/ide/idea.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index 2aefb74..ea80039 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -50,6 +50,21 @@ module Buildr #:nodoc:
         self.components << create_component(name, attrs, &xml)
       end
 
+      def add_component_from_file(filename)
+        self.components << lambda do
+          raise "Unable to locate file #{filename} adding component to idea 
file" unless File.exist?(filename)
+          Buildr::IntellijIdea.new_document(IO.read(filename)).root
+        end
+      end
+
+      def add_component_from_artifact(artifact)
+        self.components << lambda do
+          a = Buildr.artifact(artifact)
+          a.invoke
+          Buildr::IntellijIdea.new_document(IO.read(a.to_s)).root
+        end
+      end
+
       # IDEA can not handle text content with indents so need to removing 
indenting
       # Can not pass true as third argument as the ruby library seems broken
       def write(f)

Reply via email to