Getting Started with Ruby Gem Development

I recently started using a gem called blackbook. The gem has several issues that I would like to fix. I cloned the git repository and installed the pearl locally, hoping I could ruin the source code. When I edit the source code, nothing happens, so now I think I have to rebuild the stone every time I make changes.

My question is: Should I be able to edit the source code of the gem and see the results immediately, or use the source code as a plugin for my rails application, and then rebuild the stone only when I have made significant progress?

Thanks,

Tony

+3
source share
2 answers

You can use the source code of the installed gem to change the behavior of the one you installed. But if you do not play games with tracks, it will not affect the stone itself, even if you rebuild it.

What I usually do is:

  • Set up a development area where I can make changes and test them (for example, run unit tests, specifications, etc.).
  • Do most of my work there
  • When I have something that I like, rebuild the stone and try installing the test.
  • If this works for my satisfaction, click it.

In addition, if you use a git hub, they should automatically restore the gem for you every time you click commit with an updated gemspec (for example, you changed the version number).

+1

, . , "VERSION"

desc "Build and install homer gem"
task :update do
  version = File.open('VERSION') { |f| f.read }.to_s
    `gem build homer.gemspec`
    `gem install ./homer-#{version}.gem`
end

:

s.version = File.open('VERSION') { |f| f.read }.to_s
+2

Source: https://habr.com/ru/post/1705533/


All Articles