Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Dev: reworked the gemfile config needed to run against multiple versions

of Rails
  • Loading branch information...
commit 3bef00c561700a286021b2a2a9257e68edeecb6b 1 parent bfa2381
@dchelimsky dchelimsky authored
View
8 .gitignore
@@ -1,10 +1,10 @@
tmp
-pkg
-.bundle
-rspec-rails-
doc
+pkg
vendor
.bundle
-Gemfile.lock
+*.gem
Gemfile
+Gemfile.lock
+gemfiles/*.lock
.rvmrc
View
37 Gemfile-base
@@ -1,37 +0,0 @@
-source "http://rubygems.org"
-
-%w[rspec rspec-core rspec-expectations rspec-mocks rspec-rails].each do |lib|
- library_path = File.expand_path("../../#{lib}", __FILE__)
- if File.exist?(library_path)
- gem lib, :path => library_path
- else
- gem lib
- end
-end
-
-gem 'sqlite3-ruby', :require => 'sqlite3'
-gem "cucumber", "~> 0.10.2"
-gem "aruba", "~> 0.3.5"
-gem "rcov", "0.9.9"
-gem "relish", "0.2.0"
-gem "guard-rspec", "0.1.9"
-gem "growl", "1.0.3"
-gem "ZenTest", "~> 4.4.2"
-gem "webrat", "0.7.2"
-
-if RUBY_PLATFORM =~ /darwin/
- gem "autotest-fsevent", "~> 0.2.4"
- gem "autotest-growl", "~> 0.2.9"
-end
-
-gem "ruby-debug", :platforms => :ruby_18
-gem "ruby-debug19", "~> 0.11.6", :platforms => :ruby_19
-
-platforms :ruby_18, :ruby_19 do
- gem "rb-fsevent", "~> 0.3.9"
- gem "ruby-prof", "~> 0.9.2"
-end
-
-platforms :jruby do
- gem "jruby-openssl"
-end
View
18 Rakefile
@@ -1,10 +1,13 @@
-unless File.exist?('./Gemfile')
- raise <<-MESSAGE
-Could not find a Gemfile. Please run any of:
- thor rails:use 3-0-stable
- thor rails:use master
- thor rails:use VERSION (where VERSION is any released version)
+unless ENV["BUNDLE_GEMFILE"]
+ warn <<-MESSAGE
+You must set the BUNDLE_GEMFILE environment variable to point to any of the
+files in the gemfiles directory (other than base) using the absolute path to
+the file e.g. (in bash):
+
+ export BUNDLE_GEMFILE=#{File.expand_path("../gemfiles/rails-3.0.5", __FILE__)}
+ bundle install
MESSAGE
+ exit 1
end
require "bundler"
Bundler.setup
@@ -53,9 +56,6 @@ namespace :generate do
task :app do |t|
unless File.directory?('./tmp/example_app')
sh "bundle exec rails new ./tmp/example_app"
- sh "cp ./templates/Gemfile-base ./tmp/example_app/"
- sh "cp ./Gemfile ./tmp/example_app/"
- in_example_app "bundle install"
end
end
View
15 Thorfile
@@ -1,15 +0,0 @@
-class Rails < Thor
- desc "use VERSION", "configures the Gemfile and runs 'bundle install'"
- def use(version)
- `rm Gemfile.lock` if File.exist?('./Gemfile.lock')
- `rm Gemfile` if File.exist?('./Gemfile')
- case version
- when /^\d\.\d/
- `echo 'instance_eval(File.read("Gemfile-base"))' >> Gemfile`
- `echo 'gem "rails", "#{version}"' >> Gemfile`
- else
- `cp Gemfile-#{version} Gemfile`
- end
- system "bundle install"
- end
-end
View
5 features/support/env.rb
@@ -11,7 +11,6 @@ def run(cmd)
Before do
@aruba_timeout_seconds = 10
- unset_bundler_env_vars
end
unless File.directory?('./tmp/example_app')
@@ -53,7 +52,3 @@ def copy(file_or_dir)
write_symlink("tmp/example_app/#{file_or_dir}")
end
end
-
-Around do |scenario, block|
- Bundler.with_clean_env &block
-end
View
43 gemfiles/base.rb
@@ -0,0 +1,43 @@
+module GemfileBase
+ def self.extended(host)
+ host.instance_eval do
+ source "http://rubygems.org"
+
+ %w[rspec rspec-core rspec-expectations rspec-mocks rspec-rails].each do |lib|
+ library_path = File.expand_path("../../../#{lib}", __FILE__)
+ if File.exist?(library_path)
+ gem lib, :path => library_path
+ else
+ gem lib
@myronmarston Owner

I think you'll want to use the :git option here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ end
+ end
+
+ gem 'sqlite3-ruby', :require => 'sqlite3'
+ gem "cucumber", "~> 0.10.2"
+ gem "aruba", "~> 0.3.5"
+ gem "rcov", "0.9.9"
+ gem "relish", "0.2.0"
+ gem "guard-rspec", "0.1.9"
+ gem "growl", "1.0.3"
+ gem "ZenTest", "~> 4.4.2"
+ gem "webrat", "0.7.2"
+
+ if RUBY_PLATFORM =~ /darwin/
+ gem "autotest-fsevent", "~> 0.2.4"
+ gem "autotest-growl", "~> 0.2.9"
+ end
+
+ gem "ruby-debug", :platforms => :ruby_18
+ gem "ruby-debug19", "~> 0.11.6", :platforms => :ruby_19
+
+ platforms :ruby_18, :ruby_19 do
+ gem "rb-fsevent", "~> 0.3.9"
+ gem "ruby-prof", "~> 0.9.2"
+ end
+
+ platforms :jruby do
+ gem "jruby-openssl"
+ end
+ end
+ end
+end
View
4 Gemfile-3-0-stable → gemfiles/rails-3-0-stable
@@ -1,4 +1,6 @@
-instance_eval(File.read("Gemfile-base"))
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
gem "rails", :git => "git://github.com/rails/rails.git", :branch => "3-0-stable"
gem "arel", :git => "git://github.com/rails/arel.git", :branch => "2-0-stable"
View
5 gemfiles/rails-3.0.0
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.0"
View
5 gemfiles/rails-3.0.1
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.1"
View
5 gemfiles/rails-3.0.2
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.2"
View
5 gemfiles/rails-3.0.3
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.3"
View
5 gemfiles/rails-3.0.4
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.4"
View
5 gemfiles/rails-3.0.5
@@ -0,0 +1,5 @@
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
+
+gem "rails", "3.0.5"
View
4 Gemfile-master → gemfiles/rails-master
@@ -1,4 +1,6 @@
-instance_eval(File.read("Gemfile-base"))
+require File.expand_path("../base.rb", __FILE__)
+
+extend GemfileBase
gem "rails", :git => "git://github.com/rails/rails.git"
gem "arel", :git => "git://github.com/rails/arel.git"
View
17 templates/Gemfile-base
@@ -1,17 +0,0 @@
-source 'http://rubygems.org'
-
-group :development, :test do
- %w[rspec rspec-core rspec-expectations rspec-mocks rspec-rails].each do |lib|
- library_path = File.expand_path("../../../../#{lib}", __FILE__)
- if File.exist?(library_path)
- gem lib, :path => library_path
- else
- gem lib
- end
- end
- gem "rcov"
- gem "webrat", "0.7.2"
- gem "ZenTest", "4.4.2"
-end
-
-gem 'sqlite3-ruby', :require => 'sqlite3'
@myronmarston

I think you'll want to use the :git option here

Please sign in to comment.
Something went wrong with that request. Please try again.