From 40b209db53796ae515387d0fee2a525872eb2ae4 Mon Sep 17 00:00:00 2001 From: Alberto Almagro Date: Tue, 26 Jun 2018 22:02:51 +0200 Subject: Recommend use of rails over bin/rails As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together. --- railties/lib/rails/application.rb | 2 +- railties/lib/rails/commands/credentials/USAGE | 2 +- railties/lib/rails/commands/credentials/credentials_command.rb | 4 ++-- railties/lib/rails/commands/encrypted/encrypted_command.rb | 4 ++-- railties/lib/rails/commands/secrets/USAGE | 6 +++--- railties/lib/rails/commands/secrets/secrets_command.rb | 4 ++-- railties/lib/rails/generators/rails/app/app_generator.rb | 2 +- railties/lib/rails/generators/rails/app/templates/bin/update.tt | 6 +++--- .../lib/rails/generators/rails/credentials/credentials_generator.rb | 2 +- railties/test/application/test_runner_test.rb | 2 +- railties/test/commands/credentials_test.rb | 2 +- railties/test/commands/encrypted_test.rb | 2 +- 12 files changed, 19 insertions(+), 19 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index e346d5cc3a..76a8ccb8f1 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -444,7 +444,7 @@ module Rails # Shorthand to decrypt any encrypted configurations or files. # - # For any file added with bin/rails encrypted:edit call +read+ to decrypt + # For any file added with rails encrypted:edit call +read+ to decrypt # the file with the master key. # The master key is either stored in +config/master.key+ or ENV["RAILS_MASTER_KEY"]. # diff --git a/railties/lib/rails/commands/credentials/USAGE b/railties/lib/rails/commands/credentials/USAGE index 85877c71b7..ea429f58d8 100644 --- a/railties/lib/rails/commands/credentials/USAGE +++ b/railties/lib/rails/commands/credentials/USAGE @@ -14,7 +14,7 @@ that just contains the secret_key_base used by MessageVerifiers/MessageEncryptor signing and encrypting cookies. For applications created prior to Rails 5.2, we'll automatically generate a new -credentials file in `config/credentials.yml.enc` the first time you run `bin/rails credentials:edit`. +credentials file in `config/credentials.yml.enc` the first time you run `rails credentials:edit`. If you didn't have a master key saved in `config/master.key`, that'll be created too. Don't lose this master key! Put it in a password manager your team can access. diff --git a/railties/lib/rails/commands/credentials/credentials_command.rb b/railties/lib/rails/commands/credentials/credentials_command.rb index fa54c0362a..65c5218fc8 100644 --- a/railties/lib/rails/commands/credentials/credentials_command.rb +++ b/railties/lib/rails/commands/credentials/credentials_command.rb @@ -69,9 +69,9 @@ module Rails def missing_credentials_message if Rails.application.credentials.key.nil? - "Missing master key to decrypt credentials. See bin/rails credentials:help" + "Missing master key to decrypt credentials. See `rails credentials:help`" else - "No credentials have been added yet. Use bin/rails credentials:edit to change that." + "No credentials have been added yet. Use `rails credentials:edit` to change that." end end end diff --git a/railties/lib/rails/commands/encrypted/encrypted_command.rb b/railties/lib/rails/commands/encrypted/encrypted_command.rb index 3bc8f76ce4..8d5947652a 100644 --- a/railties/lib/rails/commands/encrypted/encrypted_command.rb +++ b/railties/lib/rails/commands/encrypted/encrypted_command.rb @@ -76,9 +76,9 @@ module Rails def missing_encrypted_message(key:, key_path:, file_path:) if key.nil? - "Missing '#{key_path}' to decrypt data. See bin/rails encrypted:help" + "Missing '#{key_path}' to decrypt data. See `rails encrypted:help`" else - "File '#{file_path}' does not exist. Use bin/rails encrypted:edit #{file_path} to change that." + "File '#{file_path}' does not exist. Use `rails encrypted:edit #{file_path}` to change that." end end end diff --git a/railties/lib/rails/commands/secrets/USAGE b/railties/lib/rails/commands/secrets/USAGE index 96e322fe91..e205cdc001 100644 --- a/railties/lib/rails/commands/secrets/USAGE +++ b/railties/lib/rails/commands/secrets/USAGE @@ -7,7 +7,7 @@ with the code. === Setup -Run `bin/rails secrets:setup` to opt in and generate the `config/secrets.yml.key` +Run `rails secrets:setup` to opt in and generate the `config/secrets.yml.key` and `config/secrets.yml.enc` files. The latter contains all the keys to be encrypted while the former holds the @@ -45,12 +45,12 @@ the key. Add this: config.read_encrypted_secrets = true -to the environment you'd like to read encrypted secrets. `bin/rails secrets:setup` +to the environment you'd like to read encrypted secrets. `rails secrets:setup` inserts this into the production environment by default. === Editing Secrets -After `bin/rails secrets:setup`, run `bin/rails secrets:edit`. +After `rails secrets:setup`, run `rails secrets:edit`. That command opens a temporary file in `$EDITOR` with the decrypted contents of `config/secrets.yml.enc` to edit the encrypted secrets. diff --git a/railties/lib/rails/commands/secrets/secrets_command.rb b/railties/lib/rails/commands/secrets/secrets_command.rb index a36ccf314c..3d2c2cc7c6 100644 --- a/railties/lib/rails/commands/secrets/secrets_command.rb +++ b/railties/lib/rails/commands/secrets/secrets_command.rb @@ -22,7 +22,7 @@ module Rails if ENV["EDITOR"].to_s.empty? say "No $EDITOR to open decrypted secrets in. Assign one like this:" say "" - say %(EDITOR="mate --wait" bin/rails secrets:edit) + say %(EDITOR="mate --wait" rails secrets:edit) say "" say "For editors that fork and exit immediately, it's important to pass a wait flag," say "otherwise the secrets will be saved immediately with no chance to edit." @@ -56,7 +56,7 @@ module Rails private def deprecate_in_favor_of_credentials_and_exit say "Encrypted secrets is deprecated in favor of credentials. Run:" - say "bin/rails credentials:help" + say "rails credentials:help" exit 1 end diff --git a/railties/lib/rails/generators/rails/app/app_generator.rb b/railties/lib/rails/generators/rails/app/app_generator.rb index 76dbfadc0e..097ed26f9c 100644 --- a/railties/lib/rails/generators/rails/app/app_generator.rb +++ b/railties/lib/rails/generators/rails/app/app_generator.rb @@ -249,7 +249,7 @@ module Rails add_shared_options_for "application" - # Add bin/rails options + # Add rails command options class_option :version, type: :boolean, aliases: "-v", group: :rails, desc: "Show Rails version number and quit" diff --git a/railties/lib/rails/generators/rails/app/templates/bin/update.tt b/railties/lib/rails/generators/rails/app/templates/bin/update.tt index 70cc71d83b..99c2430bc6 100644 --- a/railties/lib/rails/generators/rails/app/templates/bin/update.tt +++ b/railties/lib/rails/generators/rails/app/templates/bin/update.tt @@ -23,12 +23,12 @@ chdir APP_ROOT do <% unless options.skip_active_record? -%> puts "\n== Updating database ==" - system! 'bin/rails db:migrate' + system! 'rails db:migrate' <% end -%> puts "\n== Removing old logs and tempfiles ==" - system! 'bin/rails log:clear tmp:clear' + system! 'rails log:clear tmp:clear' puts "\n== Restarting application server ==" - system! 'bin/rails restart' + system! 'rails restart' end diff --git a/railties/lib/rails/generators/rails/credentials/credentials_generator.rb b/railties/lib/rails/generators/rails/credentials/credentials_generator.rb index 719e0c1e4c..99b935aa6a 100644 --- a/railties/lib/rails/generators/rails/credentials/credentials_generator.rb +++ b/railties/lib/rails/generators/rails/credentials/credentials_generator.rb @@ -20,7 +20,7 @@ module Rails add_credentials_file_silently(template) - say "You can edit encrypted credentials with `bin/rails credentials:edit`." + say "You can edit encrypted credentials with `rails credentials:edit`." say "" end end diff --git a/railties/test/application/test_runner_test.rb b/railties/test/application/test_runner_test.rb index 8e5ccf94cc..4403421bff 100644 --- a/railties/test/application/test_runner_test.rb +++ b/railties/test/application/test_runner_test.rb @@ -553,7 +553,7 @@ module ApplicationTests create_test_file :models, "account" create_test_file :models, "post", pass: false # This specifically verifies TEST for backwards compatibility with rake test - # as bin/rails test already supports running tests from a single file more cleanly. + # as `rails test` already supports running tests from a single file more cleanly. output = Dir.chdir(app_path) { `bin/rake test TEST=test/models/post_test.rb` } assert_match "PostTest", output, "passing TEST= should run selected test" diff --git a/railties/test/commands/credentials_test.rb b/railties/test/commands/credentials_test.rb index fc16b8194f..5b8b9e4eda 100644 --- a/railties/test/commands/credentials_test.rb +++ b/railties/test/commands/credentials_test.rb @@ -15,7 +15,7 @@ class Rails::Command::CredentialsCommandTest < ActiveSupport::TestCase test "edit without editor gives hint" do run_edit_command(editor: "").tap do |output| assert_match "No $EDITOR to open file in", output - assert_match "bin/rails credentials:edit", output + assert_match "rails credentials:edit", output end end diff --git a/railties/test/commands/encrypted_test.rb b/railties/test/commands/encrypted_test.rb index 9fc73d5f18..8b608fe8c0 100644 --- a/railties/test/commands/encrypted_test.rb +++ b/railties/test/commands/encrypted_test.rb @@ -14,7 +14,7 @@ class Rails::Command::EncryptedCommandTest < ActiveSupport::TestCase test "edit without editor gives hint" do run_edit_command("config/tokens.yml.enc", editor: "").tap do |output| assert_match "No $EDITOR to open file in", output - assert_match "bin/rails encrypted:edit", output + assert_match "rails encrypted:edit", output end end -- cgit v1.2.3