Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

dev: add generic 'thor gemfile:with' command to run bundle commands

  • Loading branch information...
commit 02394e636d3c3c40a3b8018aa20442dba7e80e2f 1 parent d2a25bd
@dchelimsky dchelimsky authored
Showing with 13 additions and 8 deletions.
  1. +13 −8 Thorfile
View
21 Thorfile
@@ -1,14 +1,7 @@
class Gemfile < Thor
desc "use VERSION", "installs the bundle using gemfiles/rails-VERSION"
def use(version)
- "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
+ with(version, %w[bundle install --binstubs])
unless version =~ /^\d\.\d\.\d/
"bundle update rails".tap do |m|
say m
@@ -19,6 +12,18 @@ class Gemfile < Thor
`echo rails-#{version} > ./.gemfile`
end
+ desc "with VERSION COMMAND", "executes COMMAND with the gemfile for VERSION"
+ def with(version, *command)
+ "gemfiles/rails-#{version}".tap do |gemfile|
+ ENV["BUNDLE_GEMFILE"] = File.expand_path(gemfile)
+ say "BUNDLE_GEMFILE=#{gemfile}"
+ end
+ command.join(' ').tap do |m|
+ say m
+ system m
+ end
+ end
+
desc "which", "print out the configured gemfile"
def which
say `cat ./.gemfile`
Please sign in to comment.
Something went wrong with that request. Please try again.