Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Developing a gem in parallel with another project

Tags:

ruby

rubygems

Let's say your working on a product, and you realise that some of the code is general enough to be extracted out to a gem.

So you create a new project, build the gem, publish it to Rubygems, and then reference it in your main project's Gemfile.

Then you discover a small bug with how the gem interacts with your product. Each time your make a fix, building and installing the gem locally can take about 15 seconds. How do you minimise this to have a quick develop/test cycle?

(Also it seems that the locally built gem's version number could contradict with what you've pushed to Rubygems, leading to confusion.)

Any best practice guides on this subject?

like image 663
Andy Waite Avatar asked Mar 17 '26 02:03

Andy Waite


1 Answers

bundler doesn't just know how to get gems from rubygems. You could point it at a git repository

gem  'mygem', :git => 'git => 'git://github.com/...'

or, much more conveniently in this case

gem 'mygem', :path => '~/work/mygem'

where the path option points to the folder with the gem's source

like image 158
Frederick Cheung Avatar answered Mar 18 '26 16:03

Frederick Cheung



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!