Rubygems: Using a plugin as a path doesn't work

Created on 21 Dec 2018  Â·  3Comments  Â·  Source: rubygems/rubygems

Application Gemfile has

plugin 'bundler-inject', :path => File.expand_path("~/dev/bundler-inject")

bundle update gives me

Could not find gem 'bundler-inject' in any of the gem sources listed in your Gemfile.

Note that if I push a git repo somewhere and use the :git option, then it works fine. Also note that the following alternate path notation doesn't work either.

path File.expand_path("~/dev/bundler-inject") do
  plugin 'bundler-inject'
end

Using bundler 1.17.2, but also didn't work with bundler 1.17.1

Bundler triage bug report

Most helpful comment

@Fryguy hey, fun, I was going to open a Issue/PR for this.

This is actually an issue within Bundler::Plugin::DSL, since one of the methods that has undef_method called on it is :path, which causes it to no-op due to the method missing code:

https://github.com/bundler/bundler/blob/5dc368b07c407702a485ed53d8fd8a8ab40fa9ef/lib/bundler/plugin/dsl.rb#L10-L13
https://github.com/bundler/bundler/blob/5dc368b07c407702a485ed53d8fd8a8ab40fa9ef/lib/bundler/plugin/dsl.rb#L35-L37

It seems like this has been the case since bundler plugins have been introduced: https://github.com/bundler/bundler/pull/4608

Unsure why this was removed, though, I have noticed that while updating bundler locally to remove that method from the symbol array, the plugin isn't loaded at all (using v1.16.1), so it seems there might be more to this.

I will report back when find out more...

All 3 comments

@Fryguy hey, fun, I was going to open a Issue/PR for this.

This is actually an issue within Bundler::Plugin::DSL, since one of the methods that has undef_method called on it is :path, which causes it to no-op due to the method missing code:

https://github.com/bundler/bundler/blob/5dc368b07c407702a485ed53d8fd8a8ab40fa9ef/lib/bundler/plugin/dsl.rb#L10-L13
https://github.com/bundler/bundler/blob/5dc368b07c407702a485ed53d8fd8a8ab40fa9ef/lib/bundler/plugin/dsl.rb#L35-L37

It seems like this has been the case since bundler plugins have been introduced: https://github.com/bundler/bundler/pull/4608

Unsure why this was removed, though, I have noticed that while updating bundler locally to remove that method from the symbol array, the plugin isn't loaded at all (using v1.16.1), so it seems there might be more to this.

I will report back when find out more...

This works for me:

~/src/github.com/jules2689/website(master*) ➜ cat Gemfile
source 'https://rubygems.org'

plugin 'extended_bundler-errors', path: '/Users/juliannadeau/src/github.com/jules2689/extended_bundler-errors'


~/src/github.com/jules2689/website(master*) ➜ bundle install
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies...
Using bundler 1.17.2
Installing extended_bundler-errors 0.3.2
The Gemfile specifies no dependencies
Bundle complete! 0 Gemfile dependencies, 1 gem now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

Also experiencing Could not find gem 'SOME GEM' in any of the gem sources listed in your Gemfile. with Bundler 1.17.3 when using the path option.

As a workaround you can use git with a local file path (but bear in mind changes need to be committed):

plugin "my_plugin", git: "/Users/me/workspace/my_plugin"
Was this page helpful?
0 / 5 - 0 ratings