rubygems / bundler-features

Bundler feature requests and discussion
28 stars 8 forks source link

Custom globbing per dependency #75

Closed rjnienaber closed 9 years ago

rjnienaber commented 9 years ago

I host private gems on an internal gem server (Gem in a box). For a variety of reasons, this has become sub-optimal for my project, so what I would like to do instead host them in a github repo and pull them from there. All my code lives in a single repo like the following

/gems
  /common
    common.gemspec
/internal
  /app_1
    Gemfile --> reference 'common' gem
/external
  /app_2
    Gemfile --> reference 'common' gem

With this setup, I would like to reference a gem in the 'gems' folder. However, looking at the documentation, there is no easy way to do this. I didn't find any documentation that said this was possible so I looked over the code and found this:

@glob = options["glob"] || DEFAULT_GLOB

I thought I could just pass a :glob option in my Gemfile but it failed with the following:

$ bundle
You passed :glob as an option for gem 'common', but it is invalid. Valid options are: group, groups, git, path, name, branch, ref, tag, require, submodules, platform, platforms, type, source

Looking further I found that :glob is not a currently permitted parameter in dsl.rb.

@valid_keys ||= %w(group groups git svn path name branch ref tag require submodules platform platforms type source)

I edited the source code of bundler to allow the :glob parameter and then it worked as I thought it should. Also, I found another issue (#3286) that could have benefitted from this feature so I wonder if it would be worth making this change?

indirect commented 9 years ago

Can't you just do this using :path?

On Sun, Jan 4, 2015 at 2:42 PM, Richard Nienaber notifications@github.com wrote:

I host private gems on an internal gem server (Gem in a box). For a variety of reasons, this has become sub-optimal for my project, so what I would like to do instead host them in a github repo and pull them from there. All my code lives in a single repo like the following

/gems
  /common
    common.gemspec
/internal
  /app_1
    Gemfile --> reference 'common' gem
/external
  /app_2
    Gemfile --> reference 'common' gem

With this setup, I would like to reference a gem in the 'gems' folder. However, looking at the documentation, there is no easy way to do this. I didn't find any documentation that said this was possible so I looked over the code and found this:

@glob = options["glob"] || DEFAULT_GLOB

I thought I could just pass a :glob option in my Gemfile but it failed with the following:

$ bundle
You passed :glob as an option for gem 'common', but it is invalid. Valid options are: group, groups, git, path, name, branch, ref, tag, require, submodules, platform, platforms, type, source

Looking further I found that :glob is not a currently permitted parameter in dsl.rb.

@valid_keys ||= %w(group groups git svn path name branch ref tag require submodules platform platforms type source)

I edited the source code of bundler to allow the :glob parameter and then it worked as I thought it should. Also, I found another issue (#3286) that could have benefitted from this feature so I wonder if it would be worth making this change?

Reply to this email directly or view it on GitHub: https://github.com/bundler/bundler-features/issues/75

rjnienaber commented 9 years ago

I'd still like to be able to specify other options like :branch, :tag or :ref. Sometimes, I run different versions of the same gem with different apps.

indirect commented 9 years ago

You can't use :ref or any of the related options on a gem that's in the same repository as the Gemfile. Can you give actual example Gemfiles?