I am currently working on developing a gem and I would like to be able to run that gem from command line and point it to my local source. Previously I've done this in rails by specifying the path in the gem file but now I would like to run the gem on a non rails app. So I would like to know how to call the gem from command line and specify that I want to use the source code in a certain directory.
For example can I cd into the directory that I want to run it on and do something like: ruby my_gem --path=~/code/mygem
Also do I have to build them gem or can I run it from source without building it?
From the root directory of your gem, try this to execute lib/MyGem.rb
:
ruby -Ilib lib/MyGem.rb
or test your gem interactive:
irb -Ilib
> require 'mygem'
true
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With