diff options
author | Rob Sanheim <rsanheim@gmail.com> | 2015-07-18 00:14:38 -0500 |
---|---|---|
committer | Rob Sanheim <rsanheim@gmail.com> | 2015-07-18 00:14:38 -0500 |
commit | d54d4356e3c458952d784c15ccd79e4e8ae39c9c (patch) | |
tree | 18cc78241ba324edf7d9c8a5aff9945b3116fd28 /railties | |
parent | e78746fefdd1c5528a10ca23a5f40804ef855086 (diff) | |
download | rails-d54d4356e3c458952d784c15ccd79e4e8ae39c9c.tar.gz rails-d54d4356e3c458952d784c15ccd79e4e8ae39c9c.tar.bz2 rails-d54d4356e3c458952d784c15ccd79e4e8ae39c9c.zip |
add system! to fail fast in bin/setup
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/bin/setup | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/bin/setup b/railties/lib/rails/generators/rails/app/templates/bin/setup index 0d41f2fe4c..a57b16444c 100644 --- a/railties/lib/rails/generators/rails/app/templates/bin/setup +++ b/railties/lib/rails/generators/rails/app/templates/bin/setup @@ -5,13 +5,17 @@ include FileUtils # path to your application root. APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + chdir APP_ROOT do # This script is a starting point to setup your application. # Add necessary setup steps to this file. puts '== Installing dependencies ==' - system 'gem install bundler --conservative' - system('bundle check') or system('bundle install') + system! 'gem install bundler --conservative' + system!('bundle check') or system!('bundle install') # puts "\n== Copying sample files ==" # unless File.exist?('config/database.yml') @@ -19,11 +23,11 @@ chdir APP_ROOT do # end puts "\n== Preparing database ==" - system 'ruby bin/rake db:setup' + system! 'ruby bin/rake db:setup' puts "\n== Removing old logs and tempfiles ==" - system 'ruby bin/rake log:clear tmp:clear' + system! 'ruby bin/rake log:clear tmp:clear' puts "\n== Restarting application server ==" - system 'ruby bin/rake restart' + system! 'ruby bin/rake restart' end |