Skip to content

Instantly share code, notes, and snippets.

@ursm
Forked from indirect/Gemfile
Created February 13, 2010 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ursm/303652 to your computer and use it in GitHub Desktop.
Save ursm/303652 to your computer and use it in GitHub Desktop.
# add this to the bottom of config/boot.rb, before Rails.boot!
class Rails::Boot
def run
load_initializer
extend_environment
Rails::Initializer.run(:set_load_path)
end
def extend_environment
Rails::Initializer.class_eval do
old_load = instance_method(:load_environment)
define_method(:load_environment) do
Bundler.require :default, Rails.env.to_sym
old_load.bind(self).call
end
end
end
end
# include at least one source and the rails gem
source :gemcutter
gem 'rails', '~> 2.3.5', :require => nil
group :development do
# bundler requires these gems in development
gem 'rails-footnotes'
end
group :test do
# bundler requires these gems while running tests
gem 'rspec'
end
# this code goes in config/preinitializer.rb, which you should create if it doesn't exist
begin
# Require the preresolved locked set of gems.
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
raise RuntimeError, "You have not locked your bundle. Run `bundle lock`."
# Fallback on doing the resolve at runtime.
# This does not work with rails 2.3.5 as of bundler 0.9.5.
require "rubygems"
require "bundler"
Bundler.setup
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment