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?
Download its source code into a separate folder (perhaps from github). Then modify your Gemfile to point to the source directly so that you can edit it and test your changes directly. Then, just modify the source files inside the source tree and you should be able to see your changes applied directly.
gem update will update all installed gems to their latest versions, so it will update Rails to 3.0. 0. in your application folder. Thus your application will be associated and run in rails 2.3.
Common Attempts To Resolve Ruby Gem Dependencies Bundler can help to resolve dependencies when working with Ruby gems by allowing you to specify a set of gems in a Gemfile, then issue a single command to install them. Bundler then automatically resolves the dependencies for you.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With