diff options
-rw-r--r-- | lib/bundler/inline.rb | 32 | ||||
-rw-r--r-- | spec/runtime/inline_spec.rb | 14 |
2 files changed, 31 insertions, 15 deletions
diff --git a/lib/bundler/inline.rb b/lib/bundler/inline.rb index 034838b4b4..fed31ba4e3 100644 --- a/lib/bundler/inline.rb +++ b/lib/bundler/inline.rb @@ -49,26 +49,28 @@ def gemfile(install = false, options = {}, &gemfile) builder = Bundler::Dsl.new builder.instance_eval(&gemfile) - definition = builder.to_definition(nil, true) - def definition.lock(*); end - definition.validate_runtime! + Bundler.settings.temporary(:frozen => false) do + definition = builder.to_definition(nil, true) + def definition.lock(*); end + definition.validate_runtime! - missing_specs = proc do - definition.missing_specs? - end + missing_specs = proc do + definition.missing_specs? + end - Bundler.ui = ui if install - if install || missing_specs.call - Bundler.settings.temporary(:inline => true) do - installer = Bundler::Installer.install(Bundler.root, definition, :system => true) - installer.post_install_messages.each do |name, message| - Bundler.ui.info "Post-install message from #{name}:\n#{message}" + Bundler.ui = ui if install + if install || missing_specs.call + Bundler.settings.temporary(:inline => true) do + installer = Bundler::Installer.install(Bundler.root, definition, :system => true) + installer.post_install_messages.each do |name, message| + Bundler.ui.info "Post-install message from #{name}:\n#{message}" + end end end - end - runtime = Bundler::Runtime.new(nil, definition) - runtime.setup.require + runtime = Bundler::Runtime.new(nil, definition) + runtime.setup.require + end ensure bundler_module = class << Bundler; self; end bundler_module.send(:define_method, :root, old_root) if old_root diff --git a/spec/runtime/inline_spec.rb b/spec/runtime/inline_spec.rb index 5738c042bf..d837425414 100644 --- a/spec/runtime/inline_spec.rb +++ b/spec/runtime/inline_spec.rb @@ -244,6 +244,20 @@ RSpec.describe "bundler/inline#gemfile" do expect(exitstatus).to be_zero if exitstatus end + it "installs inline gems when frozen is set" do + script <<-RUBY, :env => { "BUNDLE_FROZEN" => "true" } + gemfile do + source "file://#{gem_repo1}" + gem "rack" + end + + puts RACK + RUBY + + expect(last_command.stderr).to be_empty + expect(exitstatus).to be_zero if exitstatus + end + it "installs inline gems when BUNDLE_GEMFILE is set to an empty string" do ENV["BUNDLE_GEMFILE"] = "" |