Implemented bundler. No more confusiong with gem versions!

This commit is contained in:
benni 2011-01-30 22:59:32 +01:00
parent 80691c441b
commit 20b7db306b
5 changed files with 95 additions and 5 deletions

10
Gemfile Normal file
View file

@ -0,0 +1,10 @@
# A sample Gemfile
source "http://rubygems.org"
gem "rails", '2.3.2'
gem 'mysql'
gem "fastercsv"
gem "prawn", '<=0.6.3'
gem 'haml', '>=2.0.6'
gem 'routing-filter', '0.0.1', :require => 'routing_filter'

45
Gemfile.lock Normal file
View file

@ -0,0 +1,45 @@
GEM
remote: http://rubygems.org/
specs:
actionmailer (2.3.2)
actionpack (= 2.3.2)
actionpack (2.3.2)
activesupport (= 2.3.2)
activerecord (2.3.2)
activesupport (= 2.3.2)
activeresource (2.3.2)
activesupport (= 2.3.2)
activesupport (2.3.2)
fastercsv (1.5.4)
haml (3.0.25)
mysql (2.8.1)
prawn (0.6.3)
prawn-core (>= 0.6.3, < 0.7)
prawn-format (>= 0.2.3, < 0.3)
prawn-layout (>= 0.3.2, < 0.4)
prawn-security (>= 0.1.1, < 0.2)
prawn-core (0.6.3)
prawn-format (0.2.3)
prawn-core
prawn-layout (0.3.2)
prawn-security (0.1.1)
rails (2.3.2)
actionmailer (= 2.3.2)
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
activesupport (= 2.3.2)
rake (>= 0.8.3)
rake (0.8.7)
routing-filter (0.0.1)
PLATFORMS
ruby
DEPENDENCIES
fastercsv
haml (>= 2.0.6)
mysql
prawn (<= 0.6.3)
rails (= 2.3.2)
routing-filter (= 0.0.1)

View file

@ -106,5 +106,20 @@ module Rails
end end
end end
# Bundler requirements
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: # All that for this:
Rails.boot! Rails.boot!

View file

@ -55,13 +55,13 @@ Rails::Initializer.run do |config|
# config.gem "sqlite3-ruby", :lib => "sqlite3" # config.gem "sqlite3-ruby", :lib => "sqlite3"
# config.gem "aws-s3", :lib => "aws/s3" # config.gem "aws-s3", :lib => "aws/s3"
# #
# library for parsing/writing files from/to csv-file # config.gem "fastercsv"
config.gem "fastercsv" # config.gem "prawn", :version => '<=0.6.3'
config.gem "prawn", :version => '<=0.6.3' # config.gem "haml", :version => '>=2.0.6'
config.gem "haml", :version => '>=2.0.6' # config.gem "routing-filter", :lib => "routing_filter"
config.gem "routing-filter", :lib => "routing_filter"
# The internationalization framework can be changed to have another default locale (standard is :en) or more load paths. # The internationalization framework can be changed to have another default locale (standard is :en) or more load paths.
# library for parsing/writing files from/to csv-file
# All files from config/locales/*.rb,yml are added automatically. # All files from config/locales/*.rb,yml are added automatically.
# config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')] # config.i18n.load_path << Dir[File.join(RAILS_ROOT, 'my', 'locales', '*.{rb,yml}')]
config.i18n.default_locale = :de config.i18n.default_locale = :de

20
config/preinitializer.rb Normal file
View file

@ -0,0 +1,20 @@
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