Created
February 22, 2010 20:54
-
-
Save mislav/311493 to your computer and use it in GitHub Desktop.
Bundler setup for Rails 2.3.x apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler' | |
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | |
module Rails | |
class << self | |
def booted? | |
defined? Rails::Initializer | |
end | |
def vendor_rails? | |
File.exist?("#{RAILS_ROOT}/vendor/rails") | |
end | |
def preinitialize | |
load(preinitializer_path) if File.exist?(preinitializer_path) | |
end | |
def preinitializer_path | |
"#{RAILS_ROOT}/config/preinitializer.rb" | |
end | |
end | |
end | |
Bundler.setup | |
Rails.preinitialize | |
require 'initializer' | |
Rails::Initializer.class_eval do | |
alias old_load_gems load_gems | |
# require gems that are Rails plugins | |
def load_gems | |
Bundler.require(:plugins) | |
end | |
end | |
Rails::Initializer.run(:set_load_path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path('../boot', __FILE__) | |
## add this line: | |
Bundler.require(:default, RAILS_ENV) | |
Rails::Initializer.run do |config| | |
... | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## example Gemfile | |
source :rubygems | |
group :rails do | |
gem 'rake', '< 0.9', :require => nil | |
gem 'rails', '~> 2.3.5', :require => nil | |
gem 'builder', '~> 2.1.2' | |
gem 'memcache-client', '>= 1.7.4', :require => nil | |
gem 'tzinfo', '~> 0.3.12' | |
gem 'i18n', '>= 0.1.3' | |
gem 'tmail', '~> 1.2.3' | |
gem 'text-format', '>= 0.6.3', :require => 'text/format' | |
end | |
# ... normal gems here ... | |
# put rails plugins in this group: | |
group :plugins do | |
gem 'will_paginate', '~> 2.3.16' | |
gem 'hoptoad_notifier', '~> 2.2.2', :require => 'hoptoad_notifier/rails' | |
gem 'thinking-sphinx', '~> 1.3.15', :require => 'thinking_sphinx' | |
gem 'paperclip', '~> 2.3.1.1' | |
gem 'newrelic_rpm', '~> 2.10.6' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment