Skip to content

Commit

Permalink
Absolute paths bundler
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Jul 24, 2020
1 parent 2baeffc commit ea4d677
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
21 changes: 11 additions & 10 deletions lib/language_pack/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def compile
setup_language_pack_environment(
ruby_layer_path: File.expand_path("."),
gem_layer_path: File.expand_path("."),
bundle_path: "vendor/bundle",
bundle_path: File.expand_path("./vendor/bundle"),
bundle_default_without: "development:test"
)
allow_git do
Expand Down Expand Up @@ -427,11 +427,12 @@ def setup_export(layer = nil)
set_export_path "PATH", paths, layer

if layer
gem_path = "#{layer.path}/#{slug_vendor_base}"
core_path = layer.path
else
gem_path = "#{build_path}/#{slug_vendor_base}"
core_path = build_path
end
set_export_path "GEM_PATH", gem_path, layer

set_export_path "GEM_PATH", "#{core_path}/#{slug_vendor_base}", layer
set_export_default "LANG", "en_US.UTF-8", layer

# TODO handle jruby
Expand All @@ -442,10 +443,10 @@ def setup_export(layer = nil)
set_export_default "JRUBY_OPTS", default_jruby_opts
end

set_export_default "BUNDLE_PATH", ENV["BUNDLE_PATH"]
set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"]
set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"]
set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"]
set_export_default "BUNDLE_PATH", "#{core_path}/vendor/bundle", layer
set_export_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"], layer
set_export_default "BUNDLE_BIN", ENV["BUNDLE_BIN"], layer
set_export_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"], layer if ENV["BUNDLE_DEPLOYMENT"]
end
end

Expand Down Expand Up @@ -482,7 +483,7 @@ def setup_profiled(ruby_layer_path: , gem_layer_path: )
set_env_default "JRUBY_OPTS", default_jruby_opts
end

set_env_default "BUNDLE_PATH", ENV["BUNDLE_PATH"]
set_env_default "BUNDLE_PATH", "#{gem_layer_path}/vendor/bundle"
set_env_default "BUNDLE_WITHOUT", ENV["BUNDLE_WITHOUT"]
set_env_default "BUNDLE_BIN", ENV["BUNDLE_BIN"]
set_env_default "BUNDLE_DEPLOYMENT", ENV["BUNDLE_DEPLOYMENT"] if ENV["BUNDLE_DEPLOYMENT"]
Expand Down Expand Up @@ -897,7 +898,7 @@ def build_bundler

bundle_command = String.new("")
bundle_command << "BUNDLE_WITHOUT=#{ENV["BUNDLE_WITHOUT"]} "
bundle_command << "BUNDLE_PATH=#{ENV["BUNDLE_PATH"]} "
bundle_command << "BUNDLE_PATH=vendor/bundle "
bundle_command << "BUNDLE_BIN=#{ENV["BUNDLE_BIN"]} "
bundle_command << "BUNDLE_DEPLOYMENT=#{ENV["BUNDLE_DEPLOYMENT"]} " if ENV["BUNDLE_DEPLOYMENT"]
bundle_command << "bundle install -j4"
Expand Down
2 changes: 1 addition & 1 deletion lib/language_pack/test/ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def compile
setup_language_pack_environment(
ruby_layer_path: File.expand_path("."),
gem_layer_path: File.expand_path("."),
bundle_path: "vendor/bundle",
bundle_path: File.expand_path("./vendor/bundle"),
bundle_default_without: "development"
)
setup_export
Expand Down

0 comments on commit ea4d677

Please sign in to comment.