I am using Warbler to create my Rails app war from within Netbeans.
I currently have a static web.xml in my config that gets included in the
war.
I’d like to be able to have different web.xml files for different
environments. Is it possible to provide some parameter to the war task
that tells it which web.xml file to use?
On Fri, Oct 2, 2009 at 9:14 AM, Homer S. [email protected]
wrote:
I am using Warbler to create my Rails app war from within Netbeans.
I currently have a static web.xml in my config that gets included in the
war.
I’d like to be able to have different web.xml files for different
environments. Is it possible to provide some parameter to the war task
that tells it which web.xml file to use?
Sure. It’s not quite as easy as it could be, but you can do it by
making use of Warbler’s erb expansion. You’ll want to use a
config/web.xml.erb file and do something like this:
<% if ENV["environment"] == "staging1" %><%=
File.read(“config/web.xml-staging1”) %>
<% elsif ENV[“environment”] == “staging2” %><%=
File.read(“config/web.xml-staging2”) %>
…
<% end %>
Then, pass environment={env} on the warble or rake command line.
Cheers,
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Thanks for the reply. I will try that out.
Also - is there any way to override the name of the jar file when
executing the WAR task? I’d like the name of the war to be based on the
name of the environment that I am generating it for.
Nick S. wrote:
Sure. It’s not quite as easy as it could be, but you can do it by
making use of Warbler’s erb expansion. You’ll want to use a
config/web.xml.erb file and do something like this:
<% if ENV["environment"] == "staging1" %><%=
File.read(“config/web.xml-staging1”) %>
<% elsif ENV[“environment”] == “staging2” %><%=
File.read(“config/web.xml-staging2”) %>
…
<% end %>
Then, pass environment={env} on the warble or rake command line.
Cheers,
/Nick
Sure, for that use
config.war_name = “myapp-#{ENV[‘environment’]}”
inside config/warble.rb. (.war is appended for you.)
/Nick
On Fri, Oct 2, 2009 at 11:21 AM, Homer S. [email protected]
wrote:
/Nick
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
Nevermind - just a simple setting of the name based on the ENV in
warble.rb does the trick
Homer S. wrote:
Thanks for the reply. I will try that out.
Also - is there any way to override the name of the jar file when
executing the WAR task? I’d like the name of the war to be based on the
name of the environment that I am generating it for.