ruby - How do I get Bundler to consider local gems as "already installed"? -
ruby - How do I get Bundler to consider local gems as "already installed"? -
i'm developing 2 ruby gems simultaneously, 1 of depends on other. gem names "foo" , "bar". "bar" depends on "foo", gemspec includes this:
s.add_runtime_dependency "foo", "~> 0" # more dependencies... and gemfile:
source "https://rubygems.org" gemspec of course, running bundle install give me error since "foo" placed in local folder.
i don't want comment out dependency line, nor want point local folder, because local alter never commit git repo. taking space under git status , in way when need create modifications file.
i'm hoping there tricks can environment variables allow bundler know "foo" is, , count "already installed". possible?
this trick done using bundler.
let's gem foo depends upon gem bar. in foo's gemfile, utilize bundler's path alternative point gem bar:
gem "bar", path: "/home/wayne/lab/bar" then bundle install
after that, commands such bundle exec rspec, bundle exec rake features, etc., utilize gem "bar" out of local folder.
when done, revert gem "bar" line in gemfile normal form.
if want maintain gemfile modification permanently, have several options. 1 check in modification. according gemfile source priority, bundler first seek load gem local path, fall installing global source.
if gem public, local modification might confusing clones gem. in case, since gemfile ruby code, can use, example, environment variable turn on location modification:
# when making concurrent modifications gem "bar", # utilize gem local directory. if env['bar_gem_path'] gem "bar", path: env['bar_gem_path'] end ruby bundler
Comments
Post a Comment