Mr.D
Mr.D

Reputation: 7893

Rails: Extract and Edit Source Code of Specific Gem

How to extract source code of specific gem so that it is possible to edit it locally? Shall I add it to my Rails application folder?

I need that to be able to make changes to the gem's code.

Upvotes: 0

Views: 1304

Answers (1)

EugZol
EugZol

Reputation: 6555

If you find an error in gem, you'd better make pull request on GitHub. But let's suppose you need your private fork of gem. Best workflow for that:

  1. Download the gem source code from GitHub: git clone https://github.com/author/awesome_gem.git.
  2. In your project's Gemfile add gem awesome_gem, path: "/local/path/to/awesome_gem"
  3. Run bundle install

Now you can make changes to the gem locally, and have your project use local copy of it. When you are done making initial changes, push your Gem to your github repository, and change Gemfile line to something like:

gem awesome_gem, github: 'QQQ/awesome_gem' ('QQQ' being your Github's account name)

Upvotes: 6

Related Questions