Skip to content

Commit

Permalink
separate Gemfiles for different versions of rails
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Jan 25, 2011
1 parent e01608a commit 25407a8
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 31 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -6,3 +6,4 @@ doc
vendor
.bundle
Gemfile.lock
Gemfile
6 changes: 6 additions & 0 deletions Gemfile-3-0-stable
@@ -0,0 +1,6 @@
instance_eval(File.read("./Gemfile-base"))

gem "rails", :git => "https://github.com/rails/rails.git", :branch => "3-0-stable"
gem "arel", :git => "https://github.com/rails/arel.git"
gem "rack", :git => "git://github.com/rack/rack.git"

3 changes: 3 additions & 0 deletions Gemfile-3.0.0
@@ -0,0 +1,3 @@
instance_eval(File.read("./Gemfile-base"))

gem "rails", "3.0.0"
3 changes: 3 additions & 0 deletions Gemfile-3.0.3
@@ -0,0 +1,3 @@
instance_eval(File.read("./Gemfile-base"))

gem "rails", "3.0.3"
12 changes: 3 additions & 9 deletions Gemfile → Gemfile-base
@@ -1,6 +1,6 @@
source "http://rubygems.org"

%w[rspec rspec-core rspec-expectations rspec-mocks].each do |lib|
%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
Expand All @@ -9,8 +9,7 @@ source "http://rubygems.org"
end
end

gem "arel", :path => "~/projects/ruby/arel"

gem 'sqlite3-ruby', :require => 'sqlite3'
gem "rake", "0.8.7"
gem "cucumber", "0.10.0"
gem "aruba", "0.2.2"
Expand All @@ -19,6 +18,7 @@ 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"
Expand All @@ -36,9 +36,3 @@ end
platforms :jruby do
gem "jruby-openssl"
end

#### rspec-rails only
gem "rails", :path => File.expand_path("../vendor/rails", __FILE__)
gem "rack", :git => "git://github.com/rack/rack.git"
gem 'webrat', "0.7.2"
gem 'sqlite3-ruby', :require => 'sqlite3'
5 changes: 5 additions & 0 deletions Gemfile-master
@@ -0,0 +1,5 @@
instance_eval(File.read("./Gemfile-base"))

gem "rails", :git => "https://github.com/rails/rails.git"
gem "arel", :git => "https://github.com/rails/arel.git"
gem "rack", :git => "https://github.com/rack/rack.git"
16 changes: 9 additions & 7 deletions Rakefile
@@ -1,10 +1,12 @@
unless File.directory?("vendor/rails")
unless File.exist?('./Gemfile')
raise <<-MESSAGE
You need to clone the rails git repository into ./vendor before you can use any
of the rake tasks.
git clone git://github.com/rails/rails.git vendor/rails
Could not find a Gemfile. Please run any of:
thor rails:use 3-0-stable
thor rails:use master
thor rails:use 3.0.0
thor rails:use 3.0.3
And then run 'bundle install'
MESSAGE
end
require "bundler"
Expand Down Expand Up @@ -54,8 +56,8 @@ 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 ./tmp/example_app/"
sh "cp ./specs.watchr ./tmp/example_app/"
sh "cp ./templates/Gemfile-base ./tmp/example_app/"
sh "cp ./Gemfile ./tmp/example_app/"
end
end

Expand Down
6 changes: 6 additions & 0 deletions Thorfile
Expand Up @@ -15,4 +15,10 @@ class Rails < Thor
`git fetch`
end
end

desc "use VERSION", "copies the appropriate Gemfile to Gemfile"
def use(version)
`cp ./Gemfile-#{version} ./Gemfile`
`rm ./Gemfile.lock`
end
end
15 changes: 0 additions & 15 deletions templates/Gemfile

This file was deleted.

17 changes: 17 additions & 0 deletions templates/Gemfile-base
@@ -0,0 +1,17 @@
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'

0 comments on commit 25407a8

Please sign in to comment.