Managing gems on a server that doesn't have internet access is definitely a challenge.
One relatively-straightforward way to do what you need is to make use of the vendor/cache
directory in your application and make bundle
know about it when using bundle install
by using the --local
flag.
First, download the gem archive (.gem
file extension) of the bundler
gem by going to its Rubygems page and clicking the "download" link in the bottom right. You'll need to upload that file to your test server and run $ gem install bundler-1.12.15.gem
from the command line.
Now you need to get the .gem
archives for serverspec, its dependencies, and all of its dependencies' dependencies, and put them inside your application in the vendor/cache
directory (create those with $ mkdir -p vendor/cache
) if they don't exist.
Now when you deploy the application to the server, with these .gem
files in vendor/cache
, run bundle install --local
. This will install the gems. You can see the official documentation of the --local
option at the bundler docs.