How to Vendor Gem a Gem
source link: https://fuzzyblog.io/blog/ruby/2014/08/22/how-to-vendor-gem-a-gem.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
How to Vendor Gem a Gem
Aug 22, 2014
Gems offer prebuilt software components for the Ruby / Rails space. What they don't offer, when used as a gem, is the ability to modify their source code. Unlike a traditional Rails plugin which was installed into your application tree, gems tend to exist in a magical, hidden bundle location. When you can do, however, is "vendor gem" them so that you can easily modify / update them. Ideally we'd all make our changes as pull requests against the canonical git repo but sometimes there isn't time. So here are the steps:
- Install a gem into your Gemfile.
- run bundler: bundle install
- Unpack it. Here's an example: gem unpack anemone
- This will put it into the root dir of your Rails application so now move it to vendor/gems: mv anemone-0.7.2 vendor/gems
- Go into your gem file and modify the line:
gem 'anemone'
to look something like this:
gem 'anemone', '0.7.2', :path => "vendor/gems/anemone-0.7.2" - run bundler again:
bundle install - Git add / commit / push
Thanks to Jared for helping me (once again) with this. Hopefully now that I took the time to document it, it won't be as hard next timeā¦
Posted In: #ruby #gem #vendor gem
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK