Skip to content

Commit

Permalink
dev: make the rails version setup more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
dchelimsky committed Feb 18, 2011
1 parent 66fb819 commit 15edeb4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 30 deletions.
3 changes: 0 additions & 3 deletions Gemfile-3.0.0

This file was deleted.

3 changes: 0 additions & 3 deletions Gemfile-3.0.3

This file was deleted.

5 changes: 1 addition & 4 deletions Rakefile
Expand Up @@ -3,10 +3,7 @@ unless File.exist?('./Gemfile')
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'
thor rails:use VERSION (where VERSION is any released version)
MESSAGE
end
require "bundler"
Expand Down
30 changes: 10 additions & 20 deletions Thorfile
@@ -1,25 +1,15 @@
class Rails < Thor
desc "checkout VERSION", "checks it out"
def checkout(version)
puts "***** checking out rails at #{version} ..."
Dir.chdir("vendor/rails") do
`git checkout #{version}`
`rm Gemfile.lock` if File.exist?('Gemfile.lock')
puts `bundle show`
end
end

desc "fetch", "update vendor/rails"
def fetch
Dir.chdir("vendor/rails") do
`git fetch`
end
end

desc "use VERSION", "copies the appropriate Gemfile to Gemfile"
desc "use VERSION", "configures the Gemfile and runs 'bundle install'"
def use(version)
`cp ./Gemfile-#{version} ./Gemfile`
`rm ./Gemfile.lock`
`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

0 comments on commit 15edeb4

Please sign in to comment.