Skip to content

Instantly share code, notes, and snippets.

@ledermann
Created April 8, 2011 05:45
Show Gist options
  • Save ledermann/909355 to your computer and use it in GitHub Desktop.
Save ledermann/909355 to your computer and use it in GitHub Desktop.
# 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
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)
Rails::GemDependency.add_frozen_gem_path
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
if load_error.message =~ /Could not find RubyGem rails/
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
else
raise
end
end
class << self
def rubygems_version
Gem::RubyGemsVersion rescue nil
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
min_version = '1.3.2'
require 'rubygems'
unless rubygems_version >= min_version
$stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
exit 1
end
rescue LoadError
$stderr.puts %Q(Rails requires RubyGems >= #{min_version}. 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
class Rails::Boot
def run
load_initializer
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
# All that for this:
Rails.boot!
quattro:csintern ledermann$ script/server
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:320:in `refresh!': source index not created from disk (RuntimeError)
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:34:in `refresh!'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/vendor_gem_source_index.rb:29:in `initialize'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21:in `new'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/rails/gem_dependency.rb:21:in `add_frozen_gem_path'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:298:in `add_gem_load_paths'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:132:in `process'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `send'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/initializer.rb:113:in `run'
from /Users/ledermann/Projects/csintern/config/environment.rb:9
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in'
from /opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/rails-2.3.11/lib/commands/server.rb:84
from script/server:3:in `require'
from script/server:3
quattro:csintern ledermann$ bundle --version
Bundler version 1.0.11
quattro:csintern ledermann$ ruby --version
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10]
quattro:csintern ledermann$ gem --version
1.7.2
Not using RVM
quattro:csintern ledermann$ bundle config
Settings are listed in order of priority. The top value will be used.
# Be sure to restart your server when you modify this file
ENV['RAILS_ENV'] ||= 'production'
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
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.
# Add additional load paths for your own custom dirs
# config.load_paths += %W( #{Rails.root}/extras )
config.autoload_paths += %W( #{Rails.root}/app/mixins #{Rails.root}/app/sweepers)
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
config.plugins = [ :acts_as_audited, :accountable, :unread, :all ]
# 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 ]
# Activate observers that should always be running
config.active_record.observers = :comment_observer
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names.
config.time_zone = 'Berlin'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
config.i18n.default_locale = :de
end
source :gemcutter
gem 'rails', '~> 2.3.11'
gem 'i18n'
gem 'mysql'
gem 'authlogic'
gem 'declarative_authorization'
gem 'configatron'
gem 'mime-types', :require => 'mime/types'
gem 'ya2yaml'
gem 'hoptoad_notifier'
gem 'haml'
gem 'ice_cube'
gem 'daemons'
gem 'rufus-scheduler', :require => 'rufus/scheduler'
gem 'later_dude'
gem 'gchartrb', :require => 'google_chart'
gem 'aws-s3', :require => 'aws/s3' # for gem 'paperclip'
gem 'paperclip'
gem 'right_aws' # for plugin 'backup_fu'
gem 'RedCloth'
gem 'rdiscount'
gem 'geokit'
gem 'will_paginate'
gem 'coderay'
gem 'liquid'
gem 'email_veracity'
gem 'tlsmail'
gem 'mail'
gem 'fastercsv'
gem 'htmlentities'
gem 'ri_cal'
gem 'tinnef'
gem 'pdfkit'
gem 'holidays'
gem 'yamler'
gem 'king_dtaus'
gem 'dialy'
gem 'acts-as-taggable-on', :git => 'git://github.com/bradphelan/acts-as-taggable-on.git'
gem 'subdomain-fu'
gem 'smurf'
gem 'delayed_job', :branch => 'v2.0'
gem 'thinking-sphinx', :require => 'thinking_sphinx'
gem 'ts-delayed-delta', :require => 'thinking_sphinx/deltas/delayed_delta'
gem 'searchlogic'
gem 'acts_as_audited', :branch => '1.1-stable', :git => 'git://github.com/collectiveidea/acts_as_audited.git'
gem 'carmen'
gem 'ancestry'
group :development do
gem 'query_diet'
gem 'awesome_print', :require => 'ap'
end
group :test do
gem 'parallel_tests'
gem 'rspec'
gem 'rspec-rails'
gem 'faker', '0.3.1'
gem 'machinist'
gem 'ruby-debug'
gem 'sqlite3'
end
GIT
remote: git://github.com/bradphelan/acts-as-taggable-on.git
revision: 42d918fd9f1bb4ad6d497e796fa591c663886a69
specs:
acts-as-taggable-on (2.0.6)
GIT
remote: git://github.com/collectiveidea/acts_as_audited.git
revision: de6031feaf1e5d999f70265944d76758fc85b477
branch: 1.1-stable
specs:
acts_as_audited (1.1.1)
activerecord (>= 2.1)
GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.7)
actionmailer (2.3.11)
actionpack (= 2.3.11)
actionpack (2.3.11)
activesupport (= 2.3.11)
rack (~> 1.1.0)
activerecord (2.3.11)
activesupport (= 2.3.11)
activeresource (2.3.11)
activesupport (= 2.3.11)
activesupport (2.3.11)
after_commit (1.0.8)
activerecord (< 3.0.0)
ancestry (1.2.3)
activerecord (>= 2.2.2)
authlogic (2.1.6)
activesupport
awesome_print (0.3.2)
aws-s3 (0.6.2)
builder
mime-types
xml-simple
builder (3.0.0)
carmen (0.2.7)
coderay (0.9.7)
columnize (0.3.2)
configatron (2.7.2)
yamler (>= 0.1.0)
daemons (1.0.10)
declarative_authorization (0.5.2)
delayed_job (2.0.7)
activesupport (~> 2.0)
daemons (= 1.0.10)
dialy (0.4.0)
email_veracity (0.6.0)
faker (0.3.1)
fastercsv (1.5.4)
gchartrb (0.8)
geokit (1.5.0)
haml (3.0.25)
holidays (1.0.0)
hoptoad_notifier (2.4.9)
activesupport
builder
htmlentities (4.3.0)
i18n (0.5.0)
ice_cube (0.6.6)
king_dtaus (1.0.2)
later_dude (0.3.2)
linecache (0.43)
liquid (2.2.2)
machinist (1.0.6)
mail (2.2.15)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mysql (2.8.1)
paperclip (2.3.10)
activerecord (>= 2.3.0)
activesupport (>= 2.3.2)
parallel (0.5.3)
parallel_tests (0.4.12)
parallel
pdfkit (0.5.0)
polyglot (0.3.1)
query_diet (0.2.2)
rails (~> 2.3)
rspec (~> 1.3)
rspec-rails (~> 1.3)
rack (1.1.2)
rails (2.3.11)
actionmailer (= 2.3.11)
actionpack (= 2.3.11)
activerecord (= 2.3.11)
activeresource (= 2.3.11)
activesupport (= 2.3.11)
rake (>= 0.8.3)
rake (0.8.7)
rdiscount (1.6.8)
ri_cal (0.8.8)
riddle (1.2.2)
right_aws (2.1.0)
right_http_connection (>= 1.2.5)
right_http_connection (1.3.0)
rspec (1.3.1)
rspec-rails (1.3.3)
rack (>= 1.0.0)
rspec (= 1.3.1)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
rufus-scheduler (2.0.8)
tzinfo (>= 0.3.23)
searchlogic (2.5.5)
activerecord (~> 2.3.11)
activerecord (~> 2.3.11)
smurf (1.0.6)
sqlite3 (1.3.3)
subdomain-fu (0.5.4)
thinking-sphinx (1.4.4)
activerecord (< 3.0.0, >= 1.15.6)
after_commit (>= 1.0.7)
riddle (>= 1.2.2)
tinnef (0.1.0)
tlsmail (0.0.1)
treetop (1.4.9)
polyglot (>= 0.3.1)
ts-delayed-delta (1.1.1)
delayed_job (>= 1.8.4)
thinking-sphinx (>= 1.3.6)
tzinfo (0.3.26)
will_paginate (2.3.15)
xml-simple (1.0.15)
ya2yaml (0.30)
yamler (0.1.0)
PLATFORMS
ruby
DEPENDENCIES
RedCloth
acts-as-taggable-on!
acts_as_audited!
ancestry
authlogic
awesome_print
aws-s3
carmen
coderay
configatron
daemons
declarative_authorization
delayed_job
dialy
email_veracity
faker (= 0.3.1)
fastercsv
gchartrb
geokit
haml
holidays
hoptoad_notifier
htmlentities
i18n
ice_cube
king_dtaus
later_dude
liquid
machinist
mail
mime-types
mysql
paperclip
parallel_tests
pdfkit
query_diet
rails (~> 2.3.11)
rdiscount
ri_cal
right_aws
rspec
rspec-rails
ruby-debug
rufus-scheduler
searchlogic
smurf
sqlite3
subdomain-fu
thinking-sphinx
tinnef
tlsmail
ts-delayed-delta
will_paginate
ya2yaml
yamler
begin
require "rubygems"
require "bundler"
rescue LoadError
raise "Could not load the bundler gem. Install it with `gem install bundler`."
end
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
"Run `gem install bundler` to upgrade."
end
begin
# Set up load paths for all bundled gems
ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
Bundler.setup
rescue Bundler::GemNotFound
raise RuntimeError, "Bundler couldn't find some gems." +
"Did you run `bundle install`?"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment