You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by do...@apache.org on 2013/10/31 21:16:29 UTC
svn commit: r1537619 - in /buildr/trunk: lib/buildr/ide/idea.rb
spec/ide/idea_spec.rb
Author: donaldp
Date: Thu Oct 31 20:16:28 2013
New Revision: 1537619
URL: http://svn.apache.org/r1537619
Log:
Add add_default_configuration utility method to ipr project
Modified:
buildr/trunk/lib/buildr/ide/idea.rb
buildr/trunk/spec/ide/idea_spec.rb
Modified: buildr/trunk/lib/buildr/ide/idea.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/lib/buildr/ide/idea.rb?rev=1537619&r1=1537618&r2=1537619&view=diff
==============================================================================
--- buildr/trunk/lib/buildr/ide/idea.rb (original)
+++ buildr/trunk/lib/buildr/ide/idea.rb Thu Oct 31 20:16:28 2013
@@ -647,12 +647,19 @@ module Buildr #:nodoc:
def add_configuration(name, type, factory_name, default = false)
add_to_composite_component(self.configurations) do |xml|
- xml.configuration(:name => name, :type => type, :factoryName => factory_name, :default => default) do |xml|
+ options = {:type => type, :factoryName => factory_name}
+ options[:name] = name unless default
+ options[:default] = true if default
+ xml.configuration(options) do |xml|
yield xml if block_given?
end
end
end
+ def add_default_configuration(type, factory_name)
+ add_configuration(nil, type, factory_name)
+ end
+
def add_postgres_data_source(name, options = {})
if options[:url].nil? && options[:database]
default_url = "jdbc:postgresql://#{(options[:host] || "127.0.0.1")}:#{(options[:port] || "5432")}/#{options[:database]}"
Modified: buildr/trunk/spec/ide/idea_spec.rb
URL: http://svn.apache.org/viewvc/buildr/trunk/spec/ide/idea_spec.rb?rev=1537619&r1=1537618&r2=1537619&view=diff
==============================================================================
--- buildr/trunk/spec/ide/idea_spec.rb (original)
+++ buildr/trunk/spec/ide/idea_spec.rb Thu Oct 31 20:16:28 2013
@@ -1076,6 +1076,31 @@ describe Buildr::IntellijIdea do
end
end
+ describe "with default configuration added to root project" do
+ before do
+ @foo = define "foo" do
+ ipr.add_default_configuration("GWT.ConfigurationType", "GWT Configuration") do |xml|
+ xml.module(:name => project.iml.id)
+ xml.option(:name => "RUN_PAGE", :value => "Planner.html")
+ xml.option(:name => "compilerParameters", :value => "-draftCompile -localWorkers 2")
+ xml.option(:name => "compilerMaxHeapSize", :value => "512")
+
+ xml.RunnerSettings(:RunnerId => "Run")
+ xml.ConfigurationWrapper(:RunnerId => "Run")
+ xml.tag! :method
+ end
+ end
+ invoke_generate_task
+ end
+
+ it "generates an IPR with default configuration" do
+ doc = xml_document(@foo._("foo.ipr"))
+ facet_xpath = "/project/component[@name='ProjectRunConfigurationManager']/configuration"
+ doc.should have_nodes(facet_xpath, 1)
+ doc.should have_xpath("#{facet_xpath}[@type='GWT.ConfigurationType' AND @factoryName='GWT Configuration' AND @default='true']")
+ end
+ end
+
describe "with iml.group specified" do
before do
@foo = define "foo" do