lib/rails/generators/actions.rb in railties-7.0.8.6 vs lib/rails/generators/actions.rb in railties-7.1.0.beta1

- old
+ new

@@ -160,11 +160,11 @@ prepend_file "Gemfile", "source #{quote(source)}\n", verbose: false end end end - # Adds configuration code to a Rails runtime environment. + # Adds configuration code to a \Rails runtime environment. # # By default, adds code inside the +Application+ class in # +config/application.rb+ so that it applies to all environments. # # environment %(config.asset_host = "cdn.provider.com") @@ -347,11 +347,11 @@ # rake "gems:install", sudo: true # # ==== Options # # [+:env+] - # The Rails environment in which to run the task. Defaults to + # The \Rails environment in which to run the task. Defaults to # <tt>ENV["RAILS_ENV"] || "development"</tt>. # # [+:abort_on_failure+] # Whether to halt the generator if the task exits with a non-success # exit status. @@ -363,22 +363,22 @@ # Whether to run the task using +sudo+. def rake(command, options = {}) execute_command :rake, command, options end - # Runs the specified Rails command. + # Runs the specified \Rails command. # # rails_command "db:migrate" # rails_command "db:migrate", env: "production" # rails_command "db:migrate", abort_on_failure: true # rails_command "stats", capture: true # rails_command "gems:install", sudo: true # # ==== Options # # [+:env+] - # The Rails environment in which to run the command. Defaults to + # The \Rails environment in which to run the command. Defaults to # <tt>ENV["RAILS_ENV"] || "development"</tt>. # # [+:abort_on_failure+] # Whether to halt the generator if the command exits with a non-success # exit status. @@ -400,11 +400,11 @@ else execute_command :rails, command, options end end - # Make an entry in Rails routing file <tt>config/routes.rb</tt> + # Make an entry in \Rails routing file <tt>config/routes.rb</tt> # # route "root 'welcome#index'" # route "root 'admin#index'", namespace: :admin def route(routing_code, namespace: nil) namespace = Array(namespace) @@ -466,19 +466,10 @@ verbose: false, capture: options[:capture], abort_on_failure: options[:abort_on_failure], } - in_root { run("#{sudo}#{extify(executor)} #{command}", config) } - end - - # Add an extension to the given name based on the platform. - def extify(name) # :doc: - if Gem.win_platform? - "#{name}.bat" - else - name - end + in_root { run("#{sudo}#{Shellwords.escape Gem.ruby} bin/#{executor} #{command}", config) } end # Always returns value in double quotes. def quote(value) # :doc: if value.respond_to? :each_pair