简体   繁体   中英

How to clone a gem, fix it, add it to repo, bundle, and deploy with Rails

I have a Rails 5 app, it uses a gem, it no longer works in production. I fixed it, tried to add it to my local Gemfile by following this recipe:

https://gist.github.com/zulhfreelancer/1d30bf77e9b26773a6b45c99fc0a4b0b

(but this recipe doesn't offer how to add it to your repo). So, I tried git add -all'ing it to the repo in my vendor/gems directory. All works great, but when I try to deploy, I get:

You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.

I followed the recipes for clearing and rebundling, same error. To complicate things, we use rvm, not sure that's an issue but just adding additional info.

So in general, how do you fix a defect on someone else's gem (the repo is closed so I can't submit a pull request, although I did leave an issue), and use your locally modified gem in your app by adding it to your repo and making sure capistrano and bundler will use your local source in production?

Thanks, Kevin

Steps

  1. Fork the project under your account on Github

  2. Make the changes you want

  3. Use gem 'gem_name', git: 'your_forked_project', branch: 'the_branch_you_working_on'

  4. Run bundle install

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM