Permalink
Browse files

Add Bundler support.

  • Loading branch information...
igal committed Jul 9, 2012
1 parent 9677913 commit eaa32615e74e765b74393f03078e464ef5d28dfb
Showing with 83 additions and 17 deletions.
  1. +40 −0 Gemfile
  2. +5 −6 README.markdown
  3. +21 −0 config/boot.rb
  4. +0 −7 config/environment.rb
  5. +0 −4 config/initializers/libraries.rb
  6. +17 −0 config/preinitializer.rb
View
40 Gemfile
@@ -0,0 +1,40 @@
source :rubygems
gem "rdoc"
gem "rake"
gem "rails", "2.1.2"
gem "facets", "2.8.4", :require => false # Required piecemeal in 'config/preinitializer.rb'
gem "ruby-openid", "2.0.4"
gem "RedCloth", "4.2.9"
gem "hpricot", "0.8.6"
gem "sqlite3-ruby"
group :development do
gem "capistrano", :require => false
gem "capistrano-ext", :require => false
# Optional libraries add debugging and code coverage functionality, but are not
# needed otherwise. These are not activated by default because they may cause
# Ruby or RVM to hang, complicate installation, and upset travis-ci. To
# activate them, create a `.dev` file and rerun Bundler, e.g.:
#
# touch .dev && bundle
if File.exist?(File.join(File.dirname(File.expand_path(__FILE__)), ".dev"))
platform :mri_18 do
gem 'ruby-debug'
gem 'rcov'
end
platform :mri_19 do
gem 'debugger'
gem 'debugger-ruby_core_source'
gem 'simplecov'
end
end
end
group :test do
gem "rspec-rails", "1.3.4", :require => false
end
View
@@ -64,15 +64,14 @@ Dependencies
3. Install Ruby 1.8.6 or 1.8.7 from [ftp://ftp.ruby-lang.org/pub/ruby/1.8/](ftp://ftp.ruby-lang.org/pub/ruby/1.8/) or Ruby Enterprise Edition from [http://www.rubyenterpriseedition.com/download.html](http://www.rubyenterpriseedition.com/download.html)
4. Install RubyGems 1.3.x: <http://rubyforge.org/forum/forum.php?forum_id=28071>
5. Install Rails 2.1.x:
4. Install RubyGems: http://rubygems.org/pages/download
5. Install Bundler, e.g.:
sudo gem install rails --version=2.1.2
sudo gem install bundler
6. Install other Ruby libraries:
sudo gem install facets capistrano capistrano-ext sqlite3-ruby
6. Install Ruby libraries with Bundler:
sudo bundle update
Setup
-----
View
@@ -104,5 +104,26 @@ def read_environment_rb
end
end
# Bundler integration from http://gist.github.com/302406 with module/class hack for use within Passenger
module Rails
class 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
old_load.bind(self).call
end
end
end
end
end
# All that for this:
Rails.boot!
View
@@ -1,12 +1,5 @@
# 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
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
@@ -2,7 +2,3 @@
require 'lib/ext/object_logit'
require 'lib/ext/active_support_cache_filestore'
require 'lib/defer_proxy'
# Local gems
# FIXME why is this causing exception some times, but not at others?
require 'RedCloth' rescue nil # Make #textilize will work w/ RedCloth 4.1.x
View
@@ -1,3 +1,20 @@
# Bundler integration from http://gist.github.com/302406
begin
# Require the preresolved locked set of gems.
require File.expand_path('../../.bundle/environment', __FILE__)
rescue LoadError
# Fallback on doing the resolve at runtime.
require "rubygems"
require "bundler"
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.5")
raise RuntimeError, "Bundler incompatible.\n" +
"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."
else
Bundler.setup
end
end
# Standard librarires
require 'csv'
require 'ostruct'

0 comments on commit eaa3261

Please sign in to comment.