aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-05-14 02:36:29 +0200
committerXavier Noria <fxn@hashref.com>2011-05-14 02:37:41 +0200
commit26cfd1f2834aef5a5418ea23b7d883566e9c3b7b (patch)
tree9375ee0c983e98f8a97af083af7bfc5d50eb8d57
parent345beb8485a335439354724b6a2eb0a797d9bb5a (diff)
downloadrails-26cfd1f2834aef5a5418ea23b7d883566e9c3b7b.tar.gz
rails-26cfd1f2834aef5a5418ea23b7d883566e9c3b7b.tar.bz2
rails-26cfd1f2834aef5a5418ea23b7d883566e9c3b7b.zip
application and plugin generation run bundle install unless --skip-gemfile or --skip-bundle
-rw-r--r--railties/CHANGELOG2
-rw-r--r--railties/lib/rails/generators/app_base.rb10
-rw-r--r--railties/test/generators/shared_generator_tests.rb13
3 files changed, 18 insertions, 7 deletions
diff --git a/railties/CHANGELOG b/railties/CHANGELOG
index f93a7d918b..c465b08594 100644
--- a/railties/CHANGELOG
+++ b/railties/CHANGELOG
@@ -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
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index a0a0f9ef66..8a09330ab2 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"
@@ -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?
diff --git a/railties/test/generators/shared_generator_tests.rb b/railties/test/generators/shared_generator_tests.rb
index 5ce30bd281..be9aef8a41 100644
--- a/railties/test/generators/shared_generator_tests.rb
+++ b/railties/test/generators/shared_generator_tests.rb
@@ -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