aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-08-23 17:22:21 +0200
committerJoachim Filip Ignacy Bartosik <jbartosik@gmail.com>2010-11-09 19:06:47 +0100
commitf5fb590870214b7cf3b8aa6d8f2920c7dcdf5938 (patch)
tree1effc6d1134e0bc8ad10ab93258986290f88d472
parentPie chart on how recruits evaluated documentation on questions how pages (diff)
downloadrecruiting-webapp-f5fb590870214b7cf3b8aa6d8f2920c7dcdf5938.tar.gz
recruiting-webapp-f5fb590870214b7cf3b8aa6d8f2920c7dcdf5938.tar.bz2
recruiting-webapp-f5fb590870214b7cf3b8aa6d8f2920c7dcdf5938.zip
Use bundler to manage gems for application
- Created Gemfile with required gems - Added .gitignore entry (don't include bundled gems in repository) - Replaced Rails gem loader with bundler - Updated README
-rw-r--r--.gitignore2
-rw-r--r--Gemfile28
-rw-r--r--Gemfile.lock96
-rw-r--r--README8
-rw-r--r--config/boot.rb15
-rw-r--r--config/environment.rb4
-rw-r--r--config/environments/cucumber.rb6
-rw-r--r--config/environments/test.rb6
-rw-r--r--config/preinitializer.rb21
-rw-r--r--spec/spec_helper.rb2
10 files changed, 166 insertions, 22 deletions
diff --git a/.gitignore b/.gitignore
index 8587653..c8ff854 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,3 +9,5 @@ config/database.yml
config/config.yml
tmp
doc/app
+.bundle
+vendor
diff --git a/Gemfile b/Gemfile
new file mode 100644
index 0000000..d1ad142
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,28 @@
+source :gemcutter
+
+gem 'rails', '2.3.5'
+gem 'hobo'
+gem 'hobo_openid', '>=0.4.2'
+gem 'bluecloth'
+gem 'mysql'
+
+group :test do
+ gem 'database_cleaner'
+ gem 'rspec', '1.3.1'
+ gem 'rspec-rails', '1.3.3'
+ gem 'email_spec', '0.6.2'
+ gem 'shoulda'
+ gem 'factory_girl'
+end
+
+group :cucumber do
+ gem 'cucumber-rails'
+ gem 'database_cleaner'
+ gem 'webrat'
+ gem 'nokogiri'
+end
+
+group :development, :test, :cucumber do
+ gem 'sqlite3-ruby'
+ gem 'ruby-debug'
+end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644
index 0000000..aae58bb
--- /dev/null
+++ b/Gemfile.lock
@@ -0,0 +1,96 @@
+GEM
+ remote: http://rubygems.org/
+ specs:
+ actionmailer (2.3.5)
+ actionpack (= 2.3.5)
+ actionpack (2.3.5)
+ activesupport (= 2.3.5)
+ rack (~> 1.0.0)
+ activerecord (2.3.5)
+ activesupport (= 2.3.5)
+ activeresource (2.3.5)
+ activesupport (= 2.3.5)
+ activesupport (2.3.5)
+ bluecloth (2.0.9)
+ builder (2.1.2)
+ columnize (0.3.1)
+ cucumber (0.9.3)
+ builder (~> 2.1.2)
+ diff-lcs (~> 1.1.2)
+ gherkin (~> 2.2.9)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ cucumber-rails (0.3.2)
+ cucumber (>= 0.8.0)
+ database_cleaner (0.6.0)
+ diff-lcs (1.1.2)
+ email_spec (0.6.2)
+ factory_girl (1.3.2)
+ gherkin (2.2.9)
+ json (~> 1.4.6)
+ term-ansicolor (~> 1.0.5)
+ hobo (1.0.1)
+ hobofields (= 1.0.1)
+ hobosupport (= 1.0.1)
+ rails (>= 2.2.2)
+ will_paginate (>= 2.3.11)
+ hobo_openid (0.4.2)
+ hobo (>= 1.0.0)
+ rails (>= 2.3.5)
+ ruby-openid (>= 2.1.7)
+ hobofields (1.0.1)
+ hobosupport (= 1.0.1)
+ rails (>= 2.2.2)
+ hobosupport (1.0.1)
+ json (1.4.6)
+ linecache (0.43)
+ mysql (2.8.1)
+ nokogiri (1.4.3.1)
+ rack (1.0.1)
+ rack-test (0.5.6)
+ rack (>= 1.0)
+ rails (2.3.5)
+ actionmailer (= 2.3.5)
+ actionpack (= 2.3.5)
+ activerecord (= 2.3.5)
+ activeresource (= 2.3.5)
+ activesupport (= 2.3.5)
+ rake (>= 0.8.3)
+ rake (0.8.7)
+ rspec (1.3.1)
+ rspec-rails (1.3.3)
+ ruby-debug (0.10.3)
+ columnize (>= 0.1)
+ ruby-debug-base (~> 0.10.3.0)
+ ruby-debug-base (0.10.3)
+ linecache (>= 0.3)
+ ruby-openid (2.1.8)
+ shoulda (2.11.3)
+ sqlite3-ruby (1.3.2)
+ term-ansicolor (1.0.5)
+ webrat (0.7.2)
+ nokogiri (>= 1.2.0)
+ rack (>= 1.0)
+ rack-test (>= 0.5.3)
+ will_paginate (2.3.15)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bluecloth
+ cucumber-rails
+ database_cleaner
+ email_spec (= 0.6.2)
+ factory_girl
+ hobo
+ hobo_openid (>= 0.4.2)
+ mysql
+ nokogiri
+ rails (= 2.3.5)
+ rspec (= 1.3.1)
+ rspec-rails (= 1.3.3)
+ ruby-debug
+ shoulda
+ sqlite3-ruby
+ webrat
diff --git a/README b/README
index 4cbcb87..1aa5217 100644
--- a/README
+++ b/README
@@ -12,13 +12,13 @@ To start testing application you should:
git clone git://github.com/ahenobarbi/Gentoo-Recruiters-App.git
-3.Install gems. The best way to do it is to have rake install it for you:
+3.Install gems. Application uses bundler to manage gems so you should install bundler
- rake gems:install
+ gem install bundler
-or if you want to run tests
+ and then use bundler to install other gems
- RAILS_ENV=test rake gems:install
+ bundle install
4.Prepare configuration and databases.
diff --git a/config/boot.rb b/config/boot.rb
index dd5e3b6..971ca56 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -106,5 +106,20 @@ module Rails
end
end
+# Use bundler to load gems
+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!
diff --git a/config/environment.rb b/config/environment.rb
index 9291bdc..503860c 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -3,9 +3,5 @@ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
require File.join(File.dirname(__FILE__), 'boot')
Rails::Initializer.run do |config|
- config.gem 'bluecloth'
- config.gem 'hobo'
- config.gem 'hobo_openid'
-
config.time_zone = 'UTC'
end
diff --git a/config/environments/cucumber.rb b/config/environments/cucumber.rb
index 34da224..76e470a 100644
--- a/config/environments/cucumber.rb
+++ b/config/environments/cucumber.rb
@@ -21,10 +21,4 @@ config.action_controller.allow_forgery_protection = false
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
-config.gem 'cucumber-rails', :lib => false, :version => '>=0.3.1' unless File.directory?(File.join(Rails.root, 'vendor/plugins/cucumber-rails'))
-config.gem 'database_cleaner', :lib => false, :version => '>=0.5.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/database_cleaner'))
-config.gem 'webrat', :lib => false, :version => '>=0.7.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/webrat'))
-config.gem 'rspec', :lib => false, :version => '>=1.3.0' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec'))
-config.gem 'rspec-rails', :lib => false, :version => '>=1.3.2' unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
-
config.action_mailer.default_url_options = { :host => 'localhost', :port => '3000' }
diff --git a/config/environments/test.rb b/config/environments/test.rb
index fd5077c..20cc600 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -27,10 +27,4 @@ config.action_mailer.delivery_method = :test
# like if you have constraints or database-specific column types
# config.active_record.schema_format = :sql
-config.gem "rspec", :lib => false, :version => ">= 1.2.0"
-config.gem "rspec-rails", :lib => false, :version => ">= 1.2.0"
-config.gem 'shoulda', :lib => false
-config.gem 'email_spec', :lib => 'email_spec'
-config.gem 'factory_girl'
-
config.action_mailer.default_url_options = { :host => 'localhost', :port => '3000' }
diff --git a/config/preinitializer.rb b/config/preinitializer.rb
new file mode 100644
index 0000000..4491f3a
--- /dev/null
+++ b/config/preinitializer.rb
@@ -0,0 +1,21 @@
+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
+
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index a4d855f..d0f487c 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -4,8 +4,6 @@ ENV["RAILS_ENV"] ||= 'test'
require File.expand_path(File.join(File.dirname(__FILE__),'..','config','environment'))
require 'spec/autorun'
require 'spec/rails'
-require 'shoulda'
-require "email_spec"
Factory.find_definitions