Ruby gem dependencies on offline server
You can download bundler as a .gem
file from rubygems and install it on the server with
gem install /path/to/bundler.gem
Then you can pack all gems required for your application into ./vendor/cache
directory with
bundle package
If now you deploy your app (along with ./vendor/cache
directory) to the server and run
bundle install --local
bundler won't go to rubygems, but instead will install all gems from ./vendor/cache
directory.
See bundler-package
docs for more information.
How do you package a ruby application for offline installation?
You can tell bundler to vendor all the gems needed for your app, by running:
bundle install --deployment
That will create a vendor
directory in the root of your application. Make sure you include this directory when moving the app to the standalone server. You will still need to install Ruby, RubyGems, and the bundler gem.
For Ruby and RubyGems you can download their respective installers. You can download a copy of the bundler with gem fetch
gem fetch bundler
This will download a gem file like bundler-1.6.5.gem
, which you can install on the standalone server with:
gem install bundler-1.6.5.gem
gem install XYZ locally (without connection to the internet)
Try,
gem install --local path/to/file.gem
Ruby Bundle Install in deployment mode
bundle install
will grab the gems from rubygems when run.
bundle package
grabs the gems and packages them in vendor/cache.
The package
command will copy the .gem
files for your gems in the bundle into ./vendor/cache
. Afterward, when you run bundle install
, Bundler will use the gems in the cache in preference to the ones on rubygems.org.
http://bundler.io/bundle_package.html
How to execute Ruby program with locally installed gems?
You're missing bundle exec
in front of your ruby someprogram.rb
command.
Related Topics
Do I Have to Manually Uninstall All Dependent Gems
How to Check the Database Type in a Rails Migration
How to Read Whole File in Ruby
Zlib in Ruby to Uncompress .Gz
What Does ::Myclass Ruby Scope Operator Do
Cannot Login to Amazon with Ruby Mechanize
How Is a Local Variable Created Even When If Condition Evaluates to False in Ruby
Uninitialized Constant "Controller Name"
Ruby: Creating a Sandboxed Eval
How to Convert a Ruby Object to JSON
Regex, How to Match Multiple Lines
Assign/Replace Params Hash in Rails
How to Access Nested Elements of a Hash with a Single String Key