1

I have two systems that use the same command line interface written in ruby. One system is using an older version that's incompatible with the scripts we have written. We'd like to use bundler to download all the dependencies for the 2.0 on our own system, and then migrate that bundle over to the system with the older version so that we can use 2.0 there as well.

We do not have the option to run bundle install on the other system because it's not open to the internets.

So the idea is on my system:

bundle init

...write Gemfile...

bundle install

tar -czf cli2.0.tar.gz ./Gemfile ./Gemfile.lock ./.bundle ./bundle

... move cli2.0.tar.gz to the other system ...

On system B:

tar -zxf cli2.0.tar.gz

bundle exec cli2.0 version

But at this point we get an error stating that bundler couldn't find any of the gems even though they're right there under ./bundle/ruby/2.3.0/!!

It looks like they have different versions of ruby, and ruby-gems installed.

Breedly
  • 12,838
  • 13
  • 59
  • 83
  • This strategy is extremely brittle. Some gems have compiled extensions that only work with very particular versions of libraries and on specific architectures. If you want something binary and portable, consider using something like [Docker](https://www.docker.com/what-docker) where you can package up an image that's deployed. – tadman Jun 04 '16 at 03:41

2 Answers2

1

Received some help from a coworker, the gist is I was doing it all wrong.

If you want to transport gems and see consistent performance with bundler do this.

  1. bundle install <gem>
  2. bundle package
    • This creates a cache of the downloaded gems for transport.
  3. tar -czf ./transport.tar.gz ./Gemfile ./Gemfile.lock ./vendor

On the next machine:

  1. tar -xzf ./transport.tar.gz
  2. bundle exec <command>
Breedly
  • 12,838
  • 13
  • 59
  • 83
0

Might be worth a try to make your second Gemfile (the one without internet access) reference the gems using paths.

i.e.

gem some_gem, path: "/home/you/some_path/some_gem"

See this question for more info on that.

If you don't have internet access but can transfer over files, it might be worth transferring the source code for a new version of bundler/RubyGems as well.

Community
  • 1
  • 1
max pleaner
  • 26,189
  • 9
  • 66
  • 118