Skip to content
Browse files

Dev: improved thor task

  • Loading branch information...
1 parent bcaf04c commit a6cd192ce6fee39ec02c32db03d1c0f663e888d5 @dchelimsky dchelimsky committed
Showing with 14 additions and 3 deletions.
  1. +14 −3 Thorfile
View
17 Thorfile
@@ -1,9 +1,20 @@
class Gemfile < Thor
desc "use VERSION", "installs the bundle using gemfiles/rails-VERSION"
def use(version)
- gemfile = "--gemfile gemfiles/rails-#{version}"
- say `bundle install #{gemfile} --binstubs`
- say `bundle #{gemfile} update rails` unless version =~ /^\d\.\d\.\d/
+ "gemfiles/rails-#{version}".tap do |gemfile|
+ ENV["BUNDLE_GEMFILE"] = File.expand_path(gemfile)
+ say "Using #{gemfile}"
+ end
+ "bundle install --binstubs".tap do |m|
+ say m
+ system m
+ end
+ unless version =~ /^\d\.\d\.\d/
+ "bundle update rails".tap do |m|
+ say m
+ system m
+ end
+ end
say `ln -s gemfiles/bin` unless File.exist?('bin')
`echo rails-#{version} > ./.gemfile`
end

0 comments on commit a6cd192

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