Invoke 'rails' instead of 'rake' in AppGenerator

Follows the convention from Rails 5 of invoking tasks on the command-line
with `rails …` rather than `rake …`.
This commit is contained in:
claudiob 2016-02-20 10:06:19 -08:00
parent 1a5941e3cf
commit 191866f75b
2 changed files with 11 additions and 11 deletions

@ -216,7 +216,7 @@ def rake(command, options={})
log :rake, command log :rake, command
env = options[:env] || ENV["RAILS_ENV"] || 'development' env = options[:env] || ENV["RAILS_ENV"] || 'development'
sudo = options[:sudo] && RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : '' sudo = options[:sudo] && RbConfig::CONFIG['host_os'] !~ /mswin|mingw/ ? 'sudo ' : ''
in_root { run("#{sudo}#{extify(:rake)} #{command} RAILS_ENV=#{env}", verbose: false) } in_root { run("#{sudo}#{extify(:rails)} #{command} RAILS_ENV=#{env}", verbose: false) }
end end
alias :rails_command :rake alias :rails_command :rake

@ -202,7 +202,7 @@ def test_generate_should_run_script_generate_with_argument_and_options
end end
def test_rake_should_run_rake_command_with_default_env def test_rake_should_run_rake_command_with_default_env
assert_called_with(generator, :run, ["rake log:clear RAILS_ENV=development", verbose: false]) do assert_called_with(generator, :run, ["rails log:clear RAILS_ENV=development", verbose: false]) do
with_rails_env nil do with_rails_env nil do
action :rake, 'log:clear' action :rake, 'log:clear'
end end
@ -210,13 +210,13 @@ def test_rake_should_run_rake_command_with_default_env
end end
def test_rake_with_env_option_should_run_rake_command_in_env def test_rake_with_env_option_should_run_rake_command_in_env
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
action :rake, 'log:clear', env: 'production' action :rake, 'log:clear', env: 'production'
end end
end end
def test_rake_with_rails_env_variable_should_run_rake_command_in_env def test_rake_with_rails_env_variable_should_run_rake_command_in_env
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
with_rails_env "production" do with_rails_env "production" do
action :rake, 'log:clear' action :rake, 'log:clear'
end end
@ -224,7 +224,7 @@ def test_rake_with_rails_env_variable_should_run_rake_command_in_env
end end
def test_env_option_should_win_over_rails_env_variable_when_running_rake def test_env_option_should_win_over_rails_env_variable_when_running_rake
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
with_rails_env "staging" do with_rails_env "staging" do
action :rake, 'log:clear', env: 'production' action :rake, 'log:clear', env: 'production'
end end
@ -232,7 +232,7 @@ def test_env_option_should_win_over_rails_env_variable_when_running_rake
end end
def test_rake_with_sudo_option_should_run_rake_command_with_sudo def test_rake_with_sudo_option_should_run_rake_command_with_sudo
assert_called_with(generator, :run, ["sudo rake log:clear RAILS_ENV=development", verbose: false]) do assert_called_with(generator, :run, ["sudo rails log:clear RAILS_ENV=development", verbose: false]) do
with_rails_env nil do with_rails_env nil do
action :rake, 'log:clear', sudo: true action :rake, 'log:clear', sudo: true
end end
@ -240,7 +240,7 @@ def test_rake_with_sudo_option_should_run_rake_command_with_sudo
end end
def test_rails_command_should_run_rails_command_with_default_env def test_rails_command_should_run_rails_command_with_default_env
assert_called_with(generator, :run, ["rake log:clear RAILS_ENV=development", verbose: false]) do assert_called_with(generator, :run, ["rails log:clear RAILS_ENV=development", verbose: false]) do
with_rails_env nil do with_rails_env nil do
action :rails_command, 'log:clear' action :rails_command, 'log:clear'
end end
@ -248,13 +248,13 @@ def test_rails_command_should_run_rails_command_with_default_env
end end
def test_rails_command_with_env_option_should_run_rails_command_in_env def test_rails_command_with_env_option_should_run_rails_command_in_env
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
action :rails_command, 'log:clear', env: 'production' action :rails_command, 'log:clear', env: 'production'
end end
end end
def test_rails_command_with_rails_env_variable_should_run_rails_command_in_env def test_rails_command_with_rails_env_variable_should_run_rails_command_in_env
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
with_rails_env "production" do with_rails_env "production" do
action :rails_command, 'log:clear' action :rails_command, 'log:clear'
end end
@ -262,7 +262,7 @@ def test_rails_command_with_rails_env_variable_should_run_rails_command_in_env
end end
def test_env_option_should_win_over_rails_env_variable_when_running_rails def test_env_option_should_win_over_rails_env_variable_when_running_rails
assert_called_with(generator, :run, ['rake log:clear RAILS_ENV=production', verbose: false]) do assert_called_with(generator, :run, ['rails log:clear RAILS_ENV=production', verbose: false]) do
with_rails_env "staging" do with_rails_env "staging" do
action :rails_command, 'log:clear', env: 'production' action :rails_command, 'log:clear', env: 'production'
end end
@ -270,7 +270,7 @@ def test_env_option_should_win_over_rails_env_variable_when_running_rails
end end
def test_rails_command_with_sudo_option_should_run_rails_command_with_sudo def test_rails_command_with_sudo_option_should_run_rails_command_with_sudo
assert_called_with(generator, :run, ["sudo rake log:clear RAILS_ENV=development", verbose: false]) do assert_called_with(generator, :run, ["sudo rails log:clear RAILS_ENV=development", verbose: false]) do
with_rails_env nil do with_rails_env nil do
action :rails_command, 'log:clear', sudo: true action :rails_command, 'log:clear', sudo: true
end end