Ruby gems in lib - spare tire principle
I am working on a console ruby app (not rails!). I will be installing this application on multiple machines. I was wondering if there is a way that I can build it, so I don't have to install the gems that I use for the app on every machine. I would like to be able to just copy the directory to each machine and start it. Ideally, I would like to put the gems in a lib folder or something and link to them from there, so I don't even need to install them on my dev machine. Is there a way to do this?
In .net we call this the "spare tire" principle.
thanks Craig
a source to share
How about using a bundler ?
Then you can include a Gemfile, which sets all the gems needed and simply runs a "package install" on each machine to pull them out.
If you really want to bundle them with the application, do a "package bundle" and the gems will be stored in the vendor / cache.
a source to share
You can use the same approach as rails and "sell" your gems. This involves creating a new directory (rails uses vendor / gems) and unpacks the gem into that directory using gem unpacking.
Then you configure your download path to include all the subfolders below.
Edit
You can customize your boot path by doing something like this
Dir.glob(File.join("vendor", "gems", "*", "lib")).each do |lib|
$LOAD_PATH.unshift(File.expand_path(lib))
end
a source to share