buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject [3/3] git commit: Add ipr.add_glassfish_configuration method for defining a local glassfish configuration within IDEA.
Date Sat, 31 May 2014 04:00:42 GMT
Add ipr.add_glassfish_configuration method for defining a local glassfish 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/428c950d
Tree: http://git-wip-us.apache.org/repos/asf/buildr/tree/428c950d
Diff: http://git-wip-us.apache.org/repos/asf/buildr/diff/428c950d

Branch: refs/heads/master
Commit: 428c950d11c6e0cc1b8a7edb8fc51194ba349680
Parents: c21e8e2
Author: Peter Donald <peter@realityforge.org>
Authored: Sat May 31 14:00:32 2014 +1000
Committer: Peter Donald <peter@realityforge.org>
Committed: Sat May 31 14:00:32 2014 +1000

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


http://git-wip-us.apache.org/repos/asf/buildr/blob/428c950d/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 9de217f..2e14d0c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,6 @@
 1.4.18 (Pending)
+* Added:  Add ipr.add_glassfish_configuration method for defining a local
+          glassfish configuration within IDEA.
 * 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

http://git-wip-us.apache.org/repos/asf/buildr/blob/428c950d/lib/buildr/ide/idea.rb
----------------------------------------------------------------------
diff --git a/lib/buildr/ide/idea.rb b/lib/buildr/ide/idea.rb
index 900a728..1234857 100644
--- a/lib/buildr/ide/idea.rb
+++ b/lib/buildr/ide/idea.rb
@@ -903,6 +903,73 @@ module Buildr #:nodoc:
         end
       end
 
+      def add_glassfish_configuration(project, options = {})
+        artifact_name = options[:name] || project.iml.id
+        server_name = options[:server_name] || 'Glassfish 4.0.0'
+        domain_name = options[:domain] || project.iml.id
+        domain_port = options[:port] || '9009'
+        packaged = options[:packaged] || {}
+        exploded = options[:exploded] || {}
+
+        add_to_composite_component(self.configurations) do |xml|
+          xml.configuration(:name => server_name, :type => 'GlassfishConfiguration',
:factoryName => 'Local', :default => false, :APPLICATION_SERVER_NAME => server_name)
do |xml|
+            xml.option(:name => 'OPEN_IN_BROWSER', :value => 'false')
+            xml.option(:name => 'UPDATING_POLICY', :value => 'restart-server')
+
+            xml.deployment do |deployment|
+              packaged.each do |name, deployable|
+                artifact = Buildr.artifact(deployable)
+                artifact.invoke
+                deployment.file(:path => resolve_path(artifact.to_s)) do |file|
+                  file.settings do |settings|
+                    settings.option(:name => 'contextRoot', :value => "/#{name}")
+                    settings.option(:name => 'defaultContextRoot', :value => 'false')
+                  end
+                end
+              end
+              exploded.each do |deployable_name|
+                deployment.artifact(:name => deployable_name) do |artifact|
+                  artifact.settings
+                end
+              end
+            end
+
+            xml.tag! 'server-settings' do |server_settings|
+              server_settings.option(:name => 'VIRTUAL_SERVER')
+              server_settings.option(:name => 'DOMAIN', :value => domain_name.to_s)
+              server_settings.option(:name => 'PRESERVE', :value => 'false')
+              server_settings.option(:name => 'USERNAME', :value => 'admin')
+              server_settings.option(:name => 'PASSWORD', :value => '')
+            end
+
+            xml.predefined_log_file(:id => 'GlassFish', :enabled => 'true')
+
+            xml.extension(:name => 'coverage', :enabled => 'false', :merge => 'false',
:sample_coverage => 'true', :runner => 'idea')
+
+            xml.RunnerSettings(:RunnerId => 'Cover')
+
+            add_glassfish_runner_settings(xml, 'Cover')
+            add_glassfish_configuration_wrapper(xml, 'Cover')
+
+            add_glassfish_runner_settings(xml, 'Debug', {
+              :DEBUG_PORT => domain_port.to_s,
+              :TRANSPORT => '0',
+              :LOCAL => 'true',
+            })
+            add_glassfish_configuration_wrapper(xml, 'Debug')
+
+            add_glassfish_runner_settings(xml, 'Run')
+            add_glassfish_configuration_wrapper(xml, 'Run')
+
+            xml.method do |method|
+              method.option(:name => 'BuildArtifacts', :enabled => 'true') do |option|
+                option.artifact(:name => artifact_name)
+              end
+            end
+          end
+        end
+      end
+
       def add_default_testng_configuration(options = {})
         jvm_args = options[:jvm_args] || '-ea'
         dir = options[:dir] || '$PROJECT_DIR$'
@@ -939,6 +1006,32 @@ module Buildr #:nodoc:
 
       protected
 
+      def add_glassfish_runner_settings(xml, name, options = {})
+        xml.RunnerSettings(:RunnerId => name.to_s) do |runner_settings|
+          options.each do |key, value|
+            runner_settings.option(:name => key.to_s, :value => value.to_s)
+          end
+        end
+      end
+
+      def add_glassfish_configuration_wrapper(xml, name)
+        xml.ConfigurationWrapper(:VM_VAR => 'JAVA_OPTS', :RunnerId => name.to_s) do
|configuration_wrapper|
+          configuration_wrapper.option(:name => 'USE_ENV_VARIABLES', :value => 'true')
+          configuration_wrapper.STARTUP do |startup|
+            startup.option(:name => 'USE_DEFAULT', :value => 'true')
+            startup.option(:name => 'SCRIPT', :value => '')
+            startup.option(:name => 'VM_PARAMETERS', :value => '')
+            startup.option(:name => 'PROGRAM_PARAMETERS', :value => '')
+          end
+          configuration_wrapper.SHUTDOWN do |shutdown|
+            shutdown.option(:name => 'USE_DEFAULT', :value => 'true')
+            shutdown.option(:name => 'SCRIPT', :value => '')
+            shutdown.option(:name => 'VM_PARAMETERS', :value => '')
+            shutdown.option(:name => 'PROGRAM_PARAMETERS', :value => '')
+          end
+        end
+      end
+
       def artifact_content(xml, project, projects, options)
         emit_module_output(xml, projects)
         emit_jpa_descriptors(xml, project, options)


Mime
View raw message