Update local gem source code

余生颓废 提交于 2020-05-10 04:30:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!