Skip to content

Commit

Permalink
Merge pull request #20926 from rsanheim/fail-fast-bin-setup
Browse files Browse the repository at this point in the history
add system! to fail fast in bin/setup
  • Loading branch information
rafaelfranca committed Jul 21, 2015
2 parents 9582b3f + d54d435 commit b260a27
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions railties/lib/rails/generators/rails/app/templates/bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ 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')
# cp 'config/database.yml.sample', 'config/database.yml'
# 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

0 comments on commit b260a27

Please sign in to comment.