gembundler.com Archives - 09 May 2013, Thursday

After developing your application for a while, check in the application together with the Gemfile and Gemfile.lock snapshot. Now, your repository has a record of the exact versions of all of the gems that you used the last time you know for sure that the application worked. Keep in mi...

Now instead of checking out the remote git repository, the local override will be used. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler. This means a commit in the local git repo will update the revision in the G...

# setup adds gems to Ruby's load path Bundler.setup # defaults to all groups require "bundler/setup" # same as Bundler.setup Bundler.setup(:default) # only set up the _default_ group Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler.setup(:default, :tes...

If you're creating a gem from scratch, you can use bundler's built in gem skeleton to create a base gem for you to edit. $ bundle gem my_gem This will create a new directory named my_gem with your new gem skeleton. If you already have a gem with a gemspec, you can generate a Gemfile f...

Like gems, developers can setup a dependency on Ruby. This makes your app fail faster in case you depend on specific features in a Ruby VM. This way, the Ruby VM on your deployment server will match your local one. You can do this by using the ruby directive in the Gemfile : ruby ' RU...

Rails 3 comes with baked in support with bundler. Using Bundler with Rails 3 Install Rails as you normally would. Use sudo if you would normally use sudo to install gems. $ gem install rails We recommend using rvm for dependable Ruby installations, especially if you are switching betw...

By default, if you simply run bundle install after running bundle package , Bundler will still connect to rubygems.org to check whether a platform-specific gem exists for any of the gems in vendor/cache . This behavior can be avoided by instead running bundle install --local . Note th...

If the git repository does not contain a .gemspec file, bundler will create a simple one, without any dependencies, executables or C extensions. This may work for simple gems, but not work for others. If there is no .gemspec, you probably shouldn't use the gem from git.

In this section, you'll find the major features introduced in the release. All the changes are documented in the Bundler 1.3 CHANGELOG. CHANGELOG Compatible with Ruby 2 and Rubygems 2 Bundler 1.3 is compatible with Ruby 2.0.0 and Rubygems 2.0.0. The way of the future! Compatible with ...

Configure the load path so all dependencies in your Gemfile can be required require " rubygems" require " bundler/setup" require " nokogiri" Only add gems from specified groups to the load path. If you want the gems in the default group, make sure to include it require " rubygems" req...

Grouping your dependencies allows you to perform operations on the entire group. # These gems are in the :default group gem " nokogiri" gem " sinatra" gem " wirble" , : group => : development group : test do gem " rspec" gem " faker" end Install all dependencies, except those in speci...

If you don't have a RubyMotion app yet, generate one. $ motion create myapp $ cd myapp You'll need to create a Gemfile. Here we're using bubblewrap. gem ' bubble-wrap' Then, set up your Rakefile to require your bundled gems at compile time. Add this to the top of the file, right benea...

Bundler adds the ability to use gems directly from git repositories. Setting them up is as easy as adding a gem to your Gemfile. Using the very latest version of a gem (or even a fork) is just as easy as using an official release. Because Rubygems lacks the ability to handle gems from...

Run an executable that comes with a gem in your bundle $ bundle exec rspec spec/models In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle. However, this ...

Now instead of checking out the remote git repository, the local override will be used. Similar to a path source, every time the local git repository change, changes will be automatically picked up by Bundler. This means a commit in the local git repo will update the revision in the G...

That line declares that this application has a dependency on the Ruby VM that is ABI-compatible with 1.9.3. If the version check does not match, Bundler will raise an exception. This will ensure the running code matches. You can be more specific with the

As a result, bundler comes with a --deployment flag that encapsulates the best practices for using bundler in a deployment environment. These practices are based on significant feedback we have received during the development of bundler, as well as a number of bug reports that mostly ...

Related:

Make sure all dependencies in your Gemfile are available to your application. $ bundle install [--system] Gems will be installed to your default system location for gems. If your system gems are stored in a root-owned location (such as in Mac OSX), bundle will ask for your root passwo...

# setup adds gems to Ruby's load path Bundler.setup # defaults to all groups require "bundler/setup" # same as Bundler.setup Bundler.setup(:default) # only set up the _default_ group Bundler.setup(:test) # only set up the _test_ group (but `not` _default_) Bundler.setup(:default, :tes...

A Gemfile.lock is required. To ensure that the same versions of the gems you developed with and tested with are also used in deployments, a Gemfile.lock is required. This is mainly to ensure that you remember to check your Gemfile.lock into version control. The Gemfile.lock must be up...

Run an executable that comes with a gem in your bundle $ bundle exec rspec spec/models In some cases, running executables without bundle exec may work, if the executable happens to be installed in your system and does not pull in any gems that conflict with your bundle. However, this ...