forked from rspec/rspec-rails
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev: make the rails version setup more generic
- Loading branch information
1 parent
66fb819
commit 15edeb4
Showing
4 changed files
with
11 additions
and
30 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |