Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

WAR project also should respect `override_gem_home`

  • Loading branch information...
commit 44246564a8a4aa5358f8a869f9b4b75b0c002046 1 parent cb4910f
Junegunn Choi junegunn authored
Showing with 11 additions and 4 deletions.
  1. +1 −1  lib/warbler/templates/war.erb
  2. +10 −3 spec/warbler/jar_spec.rb
2  lib/warbler/templates/war.erb
View
@@ -1,4 +1,4 @@
-ENV['GEM_HOME'] ||= $servlet_context.getRealPath('<%= config.gem_path %>')
+ENV['GEM_HOME'] <%= config.override_gem_home ? '=' : '||=' %> $servlet_context.getRealPath('<%= config.gem_path %>')
<% if config.bundler && config.bundler[:gemfile_path] %>
ENV['BUNDLE_GEMFILE'] ||= $servlet_context.getRealPath('/<%= config.bundler[:gemfile_path] %>')
<% end %>
13 spec/warbler/jar_spec.rb
View
@@ -58,14 +58,14 @@ def apply_extra_config(config)
it "does not override ENV['GEM_HOME'] by default" do
jar.add_init_file(config)
contents = jar.contents('META-INF/init.rb')
- contents.should =~ %r{ENV['GEM_HOME'] ||=}
+ contents.should include("ENV['GEM_HOME'] ||=")
end
it "overrides ENV['GEM_HOME'] when override_gem_home is set" do
config.override_gem_home = true
jar.add_init_file(config)
contents = jar.contents('META-INF/init.rb')
- contents.should =~ /ENV\['GEM_HOME'\] =/
+ contents.should include("ENV['GEM_HOME'] =")
end
it "adds a main.rb" do
@@ -262,10 +262,17 @@ def apply_extra_config(config)
it "adds ENV['GEM_HOME'] to init.rb" do
jar.add_init_file(config)
contents = jar.contents('META-INF/init.rb')
- contents.should =~ /ENV\['GEM_HOME'\]/
+ contents.should include("ENV['GEM_HOME'] ||=")
contents.should =~ /WEB-INF\/gems/
end
+ it "overrides ENV['GEM_HOME'] when override_gem_home is set" do
+ config.override_gem_home = true
+ jar.add_init_file(config)
+ contents = jar.contents('META-INF/init.rb')
+ contents.should include("ENV['GEM_HOME'] =")
+ end
+
it "does not include log files by default" do
jar.apply(config)
file_list(%r{WEB-INF/log}).should_not be_empty
Please sign in to comment.
Something went wrong with that request. Please try again.