aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/app_base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'railties/lib/rails/generators/app_base.rb')
-rw-r--r--railties/lib/rails/generators/app_base.rb18
1 files changed, 13 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index e8709b2ddd..a5743762e5 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -28,6 +28,9 @@ module Rails
class_option :skip_gemfile, :type => :boolean, :default => false,
:desc => "Don't create a Gemfile"
+ class_option :skip_bundle, :type => :boolean, :default => false,
+ :desc => "Don't run bundle install"
+
class_option :skip_git, :type => :boolean, :aliases => "-G", :default => false,
:desc => "Skip Git ignores and keeps"
@@ -184,13 +187,18 @@ module Rails
"gem '#{options[:javascript]}-rails'" unless options[:skip_javascript]
end
- def bundle_if_dev_or_edge
- bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle')
- run "#{bundle_command} install" if dev_or_edge?
+ def bundle_command(command)
+ require 'bundler'
+ require 'bundler/cli'
+
+ say_status :run, "bundle #{command}"
+ Bundler::CLI.new.send(command)
+ rescue
+ say_status :failure, "bundler raised an exception, are you offline?", :red
end
- def dev_or_edge?
- options.dev? || options.edge?
+ def run_bundle
+ bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle]
end
def empty_directory_with_gitkeep(destination, config = {})