Created
June 12, 2010 18:17
-
-
Save professor/435959 to your computer and use it in GitHub Desktop.
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
# Don't change this file! | |
# Configure your app in config/environment.rb and config/environments/*.rb | |
RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT) | |
module Rails | |
class << self | |
def boot! | |
unless booted? | |
preinitialize | |
pick_boot.run | |
end | |
end | |
def booted? | |
defined? Rails::Initializer | |
end | |
def pick_boot | |
(vendor_rails? ? VendorBoot : GemBoot).new | |
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 | |
class Boot | |
def run | |
load_initializer | |
#added Bundler code for Rails 2.x | |
Rails::Initializer.class_eval do | |
def load_gems | |
@bundler_loaded ||= Bundler.require :default, Rails.env | |
end | |
end | |
Rails::Initializer.run(:set_load_path) | |
end | |
end | |
class VendorBoot < Boot | |
def load_initializer | |
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer" | |
Rails::Initializer.run(:install_gem_spec_stubs) | |
end | |
end | |
class GemBoot < Boot | |
def load_initializer | |
self.class.load_rubygems | |
load_rails_gem | |
require 'initializer' | |
end | |
def load_rails_gem | |
if version = self.class.gem_version | |
gem 'rails', version | |
else | |
gem 'rails' | |
end | |
rescue Gem::LoadError => load_error | |
$stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.) | |
exit 1 | |
end | |
class << self | |
def rubygems_version | |
Gem::RubyGemsVersion if defined? Gem::RubyGemsVersion | |
end | |
def gem_version | |
if defined? RAILS_GEM_VERSION | |
RAILS_GEM_VERSION | |
elsif ENV.include?('RAILS_GEM_VERSION') | |
ENV['RAILS_GEM_VERSION'] | |
else | |
parse_gem_version(read_environment_rb) | |
end | |
end | |
def load_rubygems | |
require 'rubygems' | |
unless rubygems_version >= '0.9.4' | |
$stderr.puts %(Rails requires RubyGems >= 0.9.4 (you have #{rubygems_version}). Please `gem update --system` and try again.) | |
exit 1 | |
end | |
rescue LoadError | |
$stderr.puts %(Rails requires RubyGems >= 0.9.4. Please install RubyGems and try again: http://rubygems.rubyforge.org) | |
exit 1 | |
end | |
def parse_gem_version(text) | |
$1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/ | |
end | |
private | |
def read_environment_rb | |
File.read("#{RAILS_ROOT}/config/environment.rb") | |
end | |
end | |
end | |
end | |
# All that for this: | |
Rails.boot! |
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
I'm sure this is user error on my part. I expected bundler to magically work and I've been "banging head here" for awhile and need some expert help. I'm in the process of upgrading from Rails 2.1 to 2.3.4 for some production and decided to switch to Bundler to make the transition easier. I'm really excited about Rails 3 and can't wait for the final release candidate. | |
$ bundle exec rake test | |
/usr/bin/rake:19:in `load': no such file to load -- rake (LoadError) | |
from /usr/bin/rake:19 | |
Whether you have locked or not - I don't see a lock file | |
What version of bundler you are using - 0.9.26 from sudo gem install bundler | |
What version of Ruby you are using - ruby 1.8.6 (2009-06-08 patchlevel 369) [universal-darwin9.0] | |
Whether you are using RVM, and if so what version - 0.1.27 | |
Your Gemfile - last attachment | |
The command you ran to generate exception(s) - bundle exec rake test | |
The exception backtrace(s) | |
If you are using Rails 2.3, please also include: | |
Your boot.rb file | |
Your preinitializer.rb file | |
Your environment.rb file | |
$ rm -rf ~/.bundle/ ~/.gem/ .bundle/ Gemfile.lock | |
$ bundle install | |
Fetching source index from http://rubygems.org/ | |
Using rake (0.8.7) from system gems | |
Installing activesupport (2.3.4) from rubygems repository at http://rubygems.org/ | |
Installing rack (1.0.1) from rubygems repository at http://rubygems.org/ | |
Installing actionpack (2.3.4) from rubygems repository at http://rubygems.org/ | |
Installing actionmailer (2.3.4) from rubygems repository at http://rubygems.org/ | |
Installing activerecord (2.3.4) from rubygems repository at http://rubygems.org/ | |
Installing activeresource (2.3.4) from rubygems repository at http://rubygems.org/ | |
Using authlogic (2.1.5) from system gems | |
Using builder (2.1.2) from system gems | |
Using mime-types (1.16) from system gems | |
Using xml-simple (1.0.12) from system gems | |
Using aws-s3 (0.6.2) from system gems | |
Using cgi_multipart_eof_fix (2.5.0) from system gems | |
Installing daemons (1.0.10) from rubygems repository at http://rubygems.org/ | |
Installing fastthread (1.0.7) from rubygems repository at http://rubygems.org/ with native extensions | |
Using gem_plugin (0.2.3) from system gems | |
Installing haml (2.2.24) from rubygems repository at http://rubygems.org/ | |
Using rdoc (2.3.0) from system gems | |
Using hanna (0.1.12) from system gems | |
Installing nokogiri (1.4.2) from rubygems repository at http://rubygems.org/ with native extensions | |
Using mechanize (1.0.0) from system gems | |
Installing mongrel (1.1.5) from rubygems repository at http://rubygems.org/ with native extensions | |
Using mysql (2.8.1) from system gems | |
Using ruby-openid (2.1.7) from system gems | |
Using rack-openid (1.0.3) from system gems | |
Installing rails (2.3.4) from rubygems repository at http://rubygems.org/ | |
Using rcov (0.9.8) from system gems |
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
# Be sure to restart your server when you modify this file | |
# Uncomment below to force Rails into production mode when | |
# you don't control web/app server and can't set it the proper way | |
# ENV['RAILS_ENV'] ||= 'production' | |
# Specifies gem version of Rails to use when vendor/rails is not present | |
#RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION | |
RAILS_GEM_VERSION = '2.3.4' unless defined? RAILS_GEM_VERSION | |
# Bootstrap the Rails environment, frameworks, and default configuration | |
require File.join(File.dirname(__FILE__), 'boot') | |
require 'gapps_openid' | |
Rails::Initializer.run do |config| | |
# Settings in config/environments/* take precedence over those specified here. | |
# Application configuration should go into files in config/initializers | |
# -- all .rb files in that directory are automatically loaded. | |
# See Rails::Configuration for more options. | |
OpenID.fetcher.ca_file = "#{Rails.root}/config/ca-bundle.crt" | |
# Skip frameworks you're not going to use. To use Rails without a database | |
# you must remove the Active Record framework. | |
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ] | |
# Specify gems that this application depends on. | |
# They can then be installed with "rake gems:install" on new installations. | |
# config.gem "bj" | |
# config.gem "hpricot", :version => '0.6', :source => "http://code.whytheluckystiff.net" | |
# config.gem "aws-s3", :lib => "aws/s3" | |
# Only load the plugins named here, in the order given. By default, all plugins | |
# in vendor/plugins are loaded in alphabetical order. | |
# :all can be used as a placeholder for all plugins not explicitly named | |
# config.plugins = [ :exception_notification, :ssl_requirement, :all ] | |
# Add additional load paths for your own custom dirs | |
# config.load_paths += %W( #{RAILS_ROOT}/extras ) | |
# Force all environments to use the same logger level | |
# (by default production uses :info, the others :debug) | |
# config.log_level = :debug | |
# Make Time.zone default to the specified zone, and make Active Record store time values | |
# in the database in UTC, and return them converted to the specified local zone. | |
# Run "rake -D time" for a list of tasks for finding time zone names. Uncomment to use default local time. | |
config.time_zone = 'UTC' | |
# Your secret key for verifying cookie session data integrity. | |
# If you change this key, all old sessions will become invalid! | |
# Make sure the secret is at least 30 characters and all random, | |
# no regular words or you'll be exposed to dictionary attacks. | |
config.action_controller.session = { | |
:session_key => '_CMUEducation_session', | |
:secret => 'SECRET' | |
} | |
# Use the database for sessions instead of the cookie-based default, | |
# which shouldn't be used to store highly confidential information | |
# (create the session table with "rake db:sessions:create") | |
# config.action_controller.session_store = :active_record_store | |
# Use SQL instead of Active Record's schema dumper when creating the test database. | |
# This is necessary if your schema can't be completely dumped by the schema dumper, | |
# like if you have constraints or database-specific column types | |
# config.active_record.schema_format = :sql | |
# Activate observers that should always be running | |
# config.active_record.observers = :cacher, :garbage_collector | |
end | |
ExceptionNotifier.exception_recipients = %w([email protected]) | |
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( | |
:chatty => "%A, %B %d, %Y at %I:%M %p" | |
) | |
ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( | |
:detailed => "%B %d, %Y at %I:%M %p" | |
) |
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
source 'http://rubygems.org' | |
gem 'rails', '2.3.4' | |
gem 'aws-s3' | |
gem 'mechanize', '1.0.0' | |
gem 'ruby-openid' | |
gem 'ruby-openid-apps-discovery' | |
gem 'rack-openid' | |
group :plugins do | |
gem 'authlogic' | |
end | |
group :production do | |
gem 'activerecord-postgresql-adapter' | |
end | |
group :development do | |
gem 'rake' | |
gem 'mysql', '2.8.1' | |
gem 'mongrel' | |
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
begin | |
# Set up load paths for the locked set of pre-resolved gems. | |
require File.expand_path('../../.bundle/environment', __FILE__) | |
rescue LoadError | |
# Fall back on trying to resolve out of already-installed gems at runtime. | |
require "rubygems" | |
require "bundler" | |
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.5") | |
raise RuntimeError, | |
"Your bundler version is incompatible with Rails 2.3 and an unlocked bundle.\n" + | |
"Run `gem install bundler` to upgrade or `bundle lock` to lock." | |
end | |
begin | |
# Set up load paths for all bundled gems | |
Bundler.setup | |
# Require all gems not in a group | |
Bundler.require :default | |
rescue Bundler::GemNotFound | |
raise Bundler::GemNotFound, "Bundler couldn't find some gems. Did you run `bundle install`?" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment