summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2018-11-24 18:25:51 +0000
committerSamuel Giddins <segiddins@segiddins.me>2018-11-24 18:25:51 +0000
commitc6142c76301ce2cb47c7751700586a56cfdda8b4 (patch)
tree5e36f3cfcc6eadc4f4eee2ad44be3d461bd64402
parent6426fe56aedb7517f6db72f071d507f86fe2b644 (diff)
downloadbundler-segiddins/plugins-ignore-deployment.tar.gz
[Plugin] Ignore the deployment settingsegiddins/plugins-ignore-deployment
This allows installing plugins when the bundler is frozen, since plugins are not locked anyways
-rw-r--r--lib/bundler/plugin.rb24
-rw-r--r--spec/plugins/install_spec.rb22
2 files changed, 35 insertions, 11 deletions
diff --git a/lib/bundler/plugin.rb b/lib/bundler/plugin.rb
index 422d4acfbc..996d29aafb 100644
--- a/lib/bundler/plugin.rb
+++ b/lib/bundler/plugin.rb
@@ -73,20 +73,22 @@ module Bundler
# @param [Pathname] gemfile path
# @param [Proc] block that can be evaluated for (inline) Gemfile
def gemfile_install(gemfile = nil, &inline)
- builder = DSL.new
- if block_given?
- builder.instance_eval(&inline)
- else
- builder.eval_gemfile(gemfile)
- end
- definition = builder.to_definition(nil, true)
+ Bundler.settings.temporary(:frozen => false, :deployment => false) do
+ builder = DSL.new
+ if block_given?
+ builder.instance_eval(&inline)
+ else
+ builder.eval_gemfile(gemfile)
+ end
+ definition = builder.to_definition(nil, true)
- return if definition.dependencies.empty?
+ return if definition.dependencies.empty?
- plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
- installed_specs = Installer.new.install_definition(definition)
+ plugins = definition.dependencies.map(&:name).reject {|p| index.installed? p }
+ installed_specs = Installer.new.install_definition(definition)
- save_plugins plugins, installed_specs, builder.inferred_plugins
+ save_plugins plugins, installed_specs, builder.inferred_plugins
+ end
rescue RuntimeError => e
unless e.is_a?(GemfileError)
Bundler.ui.error "Failed to install plugin: #{e.message}\n #{e.backtrace[0]}"
diff --git a/spec/plugins/install_spec.rb b/spec/plugins/install_spec.rb
index 3f8a5940fe..29017c2afa 100644
--- a/spec/plugins/install_spec.rb
+++ b/spec/plugins/install_spec.rb
@@ -191,6 +191,28 @@ RSpec.describe "bundler plugin install" do
expect(out).to include("Installed plugin ga-plugin")
plugin_should_be_installed("ga-plugin")
end
+
+ context "in deployment mode" do
+ it "installs plugins" do
+ install_gemfile! <<-G
+ source 'file://#{gem_repo2}'
+ gem 'rack', "1.0.0"
+ G
+
+ install_gemfile! <<-G, forgotten_command_line_options(:deployment => true)
+ source 'file://#{gem_repo2}'
+ plugin 'foo'
+ gem 'rack', "1.0.0"
+ G
+
+ expect(out).to include("Installed plugin foo")
+
+ expect(out).to include("Bundle complete!")
+
+ expect(the_bundle).to include_gems("rack 1.0.0")
+ plugin_should_be_installed("foo")
+ end
+ end
end
context "inline gemfiles" do