Gemfile: the best way to conditionally declare local or remote stones for multiple developers

There are several people in our group, any number of whom can work on any combination of precious stones. Currently, our gemfile has these things:

gem 'awesome-gem', :git => ' git@github.com :somebody/awesome-gem.git' # gem 'awesome-gem', :path => '/Users/developer-A/workspace/awesome-gem' # gem 'rad-gem', :git => ' git@github.com :somebody/rad-gem.git', :branch => 'release' gem 'rad-gem', :path => '/some/path/specific-to/developer-B/rad-gem' 

So, developer-A worked on awesome-gem locally, and when they finished, they just replaced their path: the path to gem: git and fixed both versions of version control. developers B and C do the same for rad-gem, each of them has a different path in their locally modified Gemfile, and if the Gemfile each has real changes, they need to cancel their local path setting, commit, cancel to indicate back to their local version of rad-gem etc.

This is both pain and ugliness, so I tried to find a better solution, but the best I could come up with was something like this:

 if ENV['RADGEM_PATH'] gem 'rad-gem', :path => ENV['RADGEM_PATH'] else gem 'rad-gem', :git => ' git@github.com :somebody/rad-gem.git', :branch => 'release' end 

This allows developers-B and C to set their own rad-gem path, removing most of the pain mentioned above. however, this is still ugly, and I wonder if there is a better way to do this, perhaps using groups?

+6
source share
2 answers

Refresh (current)

A recent update for bunder now provides local git repos . This is a modern way to solve this problem. Thanks sekrett

Update (deprecated)

If you have a Bundler> = 1.2, now there is a better way to do this . For instance,

 bundle config local.blog ~/Work/gems/blog 

original answer (outdated)

One of my friends in the rspec core team showed me the approach they used in the rspec-core Gemfile , so I think Use this.

+8
source

Could you also have a dynamic gemfile which in development uses a hidden file (.my_local_gems) to place gems on this user machine? Or can you even use some environment variable for a variable of type GEMS_DEVEL_HOME?

In any case, this would force everyone to keep all of their local gems up to date, in production or in production; the normal Gemfile took effect.

Remember that Gemfile is just a ruby, so you can include all kinds of code in it, and not just accountant-specific idioms.

0
source

Source: https://habr.com/ru/post/908937/


All Articles