Topic: Bundle and "freezing" everything for an app

What I'm trying to do is pack/freeze all my gems/dependencies for an app into the app dir itself so I can just take the dir and give to someone and they have everything they need to run the app.  So I "bundle pack" in my dir and it runs the command and when I go to the vendor files I see that ally my gems are listed, including rails, railties, etc...everything's listed.

So to test this out, I have a machine that has nothing installed except Ruby 1.8.7 and rubygems.  It does not have any rails-related items installed.  You run "gem list" and you get nothing.

I thought that I could take the app dir, copy it to the new machine and run "bundle install".  However, it seems that the new machine doesn't even know that "bundle" or "rails" commands exist.

So are my assumptions wrong that you can imbed EVERYTHING your application needs except a Ruby interpreter into your app dir and then give it to someone else to run?  I thought that's what was meant but I guess I'm thinking wrongly.

Is there a way to imbed everything into an app dir so that you can walk up to a machine that has nothing but a Ruby interpreter and run your app?  Or are there some base gems/libraries that have to be installed to accomplish this.

Re: Bundle and "freezing" everything for an app

daneil_l - There are different opinions on this topic and there's been a lot of changes over the past year or two. What I like to do is use RVM gemsets to "sandbox" each app into its own little environment, and then use bundler to specify and install dependencies. I check my Gemfile.lock into version control which means anyone else using the app will get the exact same version of the gems that I use after a bundle install. It also means native gems that need to be compiled will be installed correctly for whatever platform the user is on

The person does need to have RVM/bundler installed first, but that's really just a couple lines of shell script, like:

rvm install 1.9.2
rvm use 1.9.2 --default
rvm use 1.9.2@global
gem install bundler

Then load up your app's gemset(add a .rvmrc and cd into the directory) and bundle install