aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2018-12-07 07:01:32 +0100
committerYuji Yaginuma <yuuji.yaginuma@gmail.com>2018-12-07 15:01:32 +0900
commitf173ec77fc35ce57e94398310308e868689366bb (patch)
tree6e638c281c1f0a6e5b95b11c1c4628aa26b450bc /railties/lib
parentb86f65a816546ff8eea39d25b62c995c7efc21dc (diff)
downloadrails-f173ec77fc35ce57e94398310308e868689366bb.tar.gz
rails-f173ec77fc35ce57e94398310308e868689366bb.tar.bz2
rails-f173ec77fc35ce57e94398310308e868689366bb.zip
Abort early if generator command fails (#34420)
* No need to go through ruby * Abort early if a generator command fails * Reuse `rails_command` method * Bump thor minimum dependency to 0.20.3 * Add some minimal docs * Add a changelog entry * Restore original logging
Diffstat (limited to 'railties/lib')
-rw-r--r--railties/lib/rails/generators/actions.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb
index 78d2471890..4646a55316 100644
--- a/railties/lib/rails/generators/actions.rb
+++ b/railties/lib/rails/generators/actions.rb
@@ -221,9 +221,11 @@ module Rails
# generate(:authenticated, "user session")
def generate(what, *args)
log :generate, what
+
+ options = args.extract_options!
argument = args.flat_map(&:to_s).join(" ")
- in_root { run_ruby_script("bin/rails generate #{what} #{argument}", verbose: false) }
+ execute_command :rails, "generate #{what} #{argument}", options
end
# Runs the supplied rake task (invoked with 'rake ...')
@@ -307,6 +309,7 @@ module Rails
config = { verbose: false }
config[:capture] = options[:capture] if options[:capture]
+ config[:abort_on_failure] = options[:abort_on_failure] if options[:abort_on_failure]
in_root { run("#{sudo}#{extify(executor)} #{command} RAILS_ENV=#{env}", config) }
end