From e062c961e9867b938d4e7a33a25a3de8d0fa67df Mon Sep 17 00:00:00 2001 From: "yuuji.yaginuma" Date: Sun, 18 Jun 2017 16:14:00 +0900 Subject: [PATCH] Deprecate an `capify!` method in generators and templates The `capify` command has been removed by Capistrano 3 and became to `cap install`. Therefore, the `capify!` method has no meaning in Capistrano 3. I think that should deprecate. Ref: https://github.com/capistrano/capistrano/commit/492793916acf32ffe1604daec6fd4892c8935018 --- guides/source/generators.md | 8 -------- railties/CHANGELOG.md | 4 ++++ railties/lib/rails/generators/actions.rb | 1 + railties/test/generators/actions_test.rb | 7 +++++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/guides/source/generators.md b/guides/source/generators.md index d4ed2355d4..be1be75e7a 100644 --- a/guides/source/generators.md +++ b/guides/source/generators.md @@ -689,14 +689,6 @@ Available options are: * `:env` - Specifies the environment in which to run this rake task. * `:sudo` - Whether or not to run this task using `sudo`. Defaults to `false`. -### `capify!` - -Runs the `capify` command from Capistrano at the root of the application which generates Capistrano configuration. - -```ruby -capify! -``` - ### `route` Adds text to the `config/routes.rb` file: diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index d93c532c7e..6cb8cbcd73 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,7 @@ +* Deprecate `capify!` method in generators and templates. + + *Yuji Yaginuma* + * Allow irb options to be passed from `rails console` command. Fixes #28988. diff --git a/railties/lib/rails/generators/actions.rb b/railties/lib/rails/generators/actions.rb index 0bd0615b7e..5cf0985050 100644 --- a/railties/lib/rails/generators/actions.rb +++ b/railties/lib/rails/generators/actions.rb @@ -227,6 +227,7 @@ def rails_command(command, options = {}) # # capify! def capify! + ActiveSupport::Deprecation.warn("`capify!` is deprecated and will be removed in the next version of Rails.") log :capify, "" in_root { run("#{extify(:capify)} .", verbose: false) } end diff --git a/railties/test/generators/actions_test.rb b/railties/test/generators/actions_test.rb index 360e8e97d7..03b29be907 100644 --- a/railties/test/generators/actions_test.rb +++ b/railties/test/generators/actions_test.rb @@ -278,9 +278,12 @@ def test_env_option_should_win_over_rails_env_variable_when_running_rails end def test_capify_should_run_the_capify_command - assert_called_with(generator, :run, ["capify .", verbose: false]) do - action :capify! + content = capture(:stderr) do + assert_called_with(generator, :run, ["capify .", verbose: false]) do + action :capify! + end end + assert_match(/DEPRECATION WARNING: `capify!` is deprecated/, content) end def test_route_should_add_data_to_the_routes_block_in_config_routes -- GitLab