mirror of https://github.com/rails/rails
application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle
This commit is contained in:
parent
345beb8485
commit
26cfd1f283
|
@ -1,6 +1,6 @@
|
|||
*Rails 3.1.0 (unreleased)*
|
||||
|
||||
* Application and plugin generation run bundle check unless --skip-gemfile. [fxn]
|
||||
* Application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle. [fxn]
|
||||
|
||||
* Fixed database tasks for jdbc* adapters #jruby
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -190,13 +193,12 @@ module Rails
|
|||
|
||||
say_status :run, "bundle #{command}"
|
||||
Bundler::CLI.new.send(command)
|
||||
rescue
|
||||
say_status :failure, "bundler raised an exception, are you online?", :red
|
||||
end
|
||||
|
||||
def run_bundle
|
||||
unless options[:skip_gemfile]
|
||||
command = dev_or_edge? ? 'install' : 'check'
|
||||
bundle_command(command)
|
||||
end
|
||||
bundle_command('install') unless options[:skip_gemfile] || options[:skip_bundle]
|
||||
end
|
||||
|
||||
def dev_or_edge?
|
||||
|
|
|
@ -26,8 +26,8 @@ module SharedGeneratorTests
|
|||
default_files.each { |path| assert_file path }
|
||||
end
|
||||
|
||||
def test_generation_runs_bundle_check
|
||||
generator([destination_root]).expects(:bundle_command).with('check').once
|
||||
def test_generation_runs_bundle_install
|
||||
generator([destination_root]).expects(:bundle_command).with('install').once
|
||||
quietly { generator.invoke_all }
|
||||
end
|
||||
|
||||
|
@ -133,6 +133,15 @@ module SharedGeneratorTests
|
|||
quietly { generator.invoke_all }
|
||||
assert_no_file 'Gemfile'
|
||||
end
|
||||
|
||||
def test_skip_bundle
|
||||
generator([destination_root], :skip_bundle => true).expects(:bundle_command).never
|
||||
quietly { generator.invoke_all }
|
||||
|
||||
# skip_bundle is only about running bundle install, ensure the Gemfile is still
|
||||
# generated.
|
||||
assert_file 'Gemfile'
|
||||
end
|
||||
end
|
||||
|
||||
module SharedCustomGeneratorTests
|
||||
|
|
Loading…
Reference in New Issue