buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject [2/3] git commit: Add ipr.add_ruby_script_configuration method for defining a ruby configuration within IDEA.
Date Sat, 31 May 2014 04:00:41 GMT
Add ipr.add_ruby_script_configuration method for defining a ruby configuration within IDEA.


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

Branch: refs/heads/master
Commit: c21e8e2eb6dd4e0ef826b440d5e524140256f33c
Parents: ccf6f65
Author: Peter Donald <peter@realityforge.org>
Authored: Sat May 31 13:50:18 2014 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Sat May 31 13:50:18 2014 +1000

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


http://git-wip-us.apache.org/repos/asf/buildr/blob/c21e8e2e/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index c2c8a9f..9de217f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.4.18 (Pending)
+* Added:  Add ipr.add_ruby_script_configuration method for defining a ruby
+          configuration within IDEA.
 * Added:  Add ipr.add_java_configuration method for defining a java
           configuration within IDEA.
 * Change: Include additional rules in default pmd rule set: 'logging-java',

http://git-wip-us.apache.org/repos/asf/buildr/blob/c21e8e2e/lib/buildr/ide/idea.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index fa2e2f3..900a728 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -857,6 +857,35 @@ module Buildr #:nodoc:
         end
       end
 
+      def add_ruby_script_configuration(project, script, options = {})
+        args = options[:args] || ''
+        path = ::Buildr::Util.relative_path(File.expand_path(script), project.base_dir)
+        name = options[:name] || File.basename(script)
+        dir = options[:dir] || "$MODULE_DIR$/#{path}"
+        sdk = options[:sdk] || 'rbenv: ' + (IO.read(File.dirname(__FILE__) + '/../.ruby-version').trim
rescue "jruby-#{RUBY_VERSION}")
+
+        add_to_composite_component(self.configurations) do |xml|
+          xml.configuration(:name => name, :type => 'RubyRunConfigurationType', :factoryName
=> 'Ruby', :default => !!options[:default]) do |xml|
+
+            xml.module(:name => project.iml.id)
+            xml.RUBY_RUN_CONFIG(:NAME => 'RUBY_ARGS', :VALUE => '-e STDOUT.sync=true;STDERR.sync=true;load($0=ARGV.shift)')
+            xml.RUBY_RUN_CONFIG(:NAME => 'WORK DIR', :VALUE => dir)
+            xml.RUBY_RUN_CONFIG(:NAME => 'SHOULD_USE_SDK', :VALUE => 'true')
+            xml.RUBY_RUN_CONFIG(:NAME => 'ALTERN_SDK_NAME', :VALUE => sdk)
+            xml.RUBY_RUN_CONFIG(:NAME => 'myPassParentEnvs', :VALUE => 'true')
+
+            xml.envs
+            xml.EXTENSION(:ID => 'BundlerRunConfigurationExtension', :bundleExecEnabled
=> 'false')
+            xml.EXTENSION(:ID => 'JRubyRunConfigurationExtension')
+
+            xml.RUBY_RUN_CONFIG(:NAME => 'SCRIPT_PATH', :VALUE => script)
+            xml.RUBY_RUN_CONFIG(:NAME => 'SCRIPT_ARGS', :VALUE => args)
+            xml.RunnerSettings(:RunnerId => 'RubyDebugRunner')
+            xml.ConfigurationWrapper(:RunnerId => 'RubyDebugRunner')
+          end
+        end
+      end
+
       def add_gwt_configuration(launch_page, project, options = {})
         name = options[:name] || "Run #{launch_page}"
         shell_parameters = options[:shell_parameters] || ""


Mime
View raw message