问题
I'm testing a gem in a Rails project.
The current Gemfile:
gem 'mygemname', path: '/path/to/my/gem'
When I edit a gem locally I can build the gem, remove the gem from Gemfile
, run bundle install
, add the gem back to the Gemfile and run bundle install
again. Is there an easier way to do this locally?
回答1:
If you use bundle config local.GEM_NAME /path/to/local/git/repository
from the command line then every time you reload your application it will load the latest source from your file system.
To remove the changes (when you have pushed your code to GitHub or RubyGems), you need to run bundle config --delete local.GEM_NAME
Source: http://bundler.io/v1.10/git.html
回答2:
You can bump your Gem's version. Next time you run bundle
your gem will be updated to the next iteration.
VERSION = "1.0.0"
Bump the patch version to
VERSION = "1.0.1"
Now just run bundle
. Bundler will notice it and log 1.0.1 (was 1.0.0)
in the output.
来源:https://stackoverflow.com/questions/31427400/update-local-gem-source-code