Skip to content

Commit

Permalink
don't install plugins in excluded groups
Browse files Browse the repository at this point in the history
  • Loading branch information
ccutrer committed Oct 11, 2023
1 parent 7639d09 commit c3ae069
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bundler/lib/bundler/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def gemfile_install(gemfile = nil, unlock: false, &inline)
Installer.new.install_definition(definition)
end

plugins = definition.dependencies.map(&:name)
plugins = definition.requested_dependencies.select(&:should_include?).map(&:name)
installed_specs = plugins.to_h {|p| [p, definition.specs[p].first] }

save_plugins plugins, installed_specs, builder.inferred_plugins
Expand Down
38 changes: 38 additions & 0 deletions bundler/spec/plugins/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,44 @@ def exec(command, args)
expect(out).to include("Bundle complete!")
end

it "installs plugins in included groups" do
gemfile <<-G
source '#{file_uri_for(gem_repo2)}'
group :development do
plugin 'foo'
end
gem 'rack', "1.0.0"
G

bundle "install"

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

it "does not install plugins in excluded groups" do
gemfile <<-G
source '#{file_uri_for(gem_repo2)}'
group :development do
plugin 'foo'
end
gem 'rack', "1.0.0"
G

bundle "install --without development"

expect(out).not_to include("Installed plugin foo")

expect(out).to include("Bundle complete!")

expect(the_bundle).to include_gems("rack 1.0.0")
plugin_should_not_be_installed("foo")
end

it "upgrade plugins version listed in gemfile" do
update_repo2 do
build_plugin "foo", "1.4.0"
Expand Down

0 comments on commit c3ae069

Please sign in to comment.