Merge pull request #47215 from p8/railties/infinitive-form-descriptions

Use infinitive form for all task descriptions verbs
This commit is contained in:
Jonathan Hefner 2023-02-01 16:30:56 -06:00 committed by GitHub
commit 41b5306ad6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 90 additions and 86 deletions

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
desc "Installs Action Mailbox and its dependencies"
desc "Install Action Mailbox and its dependencies"
task "action_mailbox:install" do
Rails::Command.invoke :generate, ["action_mailbox:install"]
end

View File

@ -41,7 +41,7 @@ db_namespace = namespace :db do
end
end
desc "Creates the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases, except when DATABASE_URL is present."
desc "Create the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:create:all to create all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to creating the development and test databases, except when DATABASE_URL is present."
task create: [:load_config] do
ActiveRecord::Tasks::DatabaseTasks.create_current
end
@ -60,7 +60,7 @@ db_namespace = namespace :db do
end
end
desc "Drops the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases, except when DATABASE_URL is present."
desc "Drop the database from DATABASE_URL or config/database.yml for the current RAILS_ENV (use db:drop:all to drop all databases in the config). Without RAILS_ENV or when RAILS_ENV is development, it defaults to dropping the development and test databases, except when DATABASE_URL is present."
task drop: [:load_config, :check_protected_environments] do
db_namespace["drop:_unsafe"].invoke
end
@ -143,7 +143,7 @@ db_namespace = namespace :db do
end
end
desc "Rolls back the database one migration and re-migrates up (options: STEP=x, VERSION=x)."
desc "Roll back the database one migration and re-migrate up (options: STEP=x, VERSION=x)."
task redo: :load_config do
ActiveRecord::Tasks::DatabaseTasks.raise_for_multi_db(command: "db:migrate:redo")
@ -160,7 +160,7 @@ db_namespace = namespace :db do
namespace :redo do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Rolls back #{name} database one migration and re-migrates up (options: STEP=x, VERSION=x)."
desc "Roll back #{name} database one migration and re-migrate up (options: STEP=x, VERSION=x)."
task name => :load_config do
raise "Empty VERSION provided" if ENV["VERSION"] && ENV["VERSION"].empty?
@ -178,7 +178,7 @@ db_namespace = namespace :db do
# desc 'Resets your database using your migrations for the current environment'
task reset: ["db:drop", "db:create", "db:migrate"]
desc 'Runs the "up" for a given migration VERSION.'
desc 'Run the "up" for a given migration VERSION.'
task up: :load_config do
ActiveRecord::Tasks::DatabaseTasks.raise_for_multi_db(command: "db:migrate:up")
@ -195,7 +195,7 @@ db_namespace = namespace :db do
namespace :up do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc 'Runs the "up" on #{name} database for a given migration VERSION.'
desc 'Run the "up" on #{name} database for a given migration VERSION.'
task name => :load_config do
raise "VERSION is required" if !ENV["VERSION"] || ENV["VERSION"].empty?
@ -209,7 +209,7 @@ db_namespace = namespace :db do
end
end
desc 'Runs the "down" for a given migration VERSION.'
desc 'Run the "down" for a given migration VERSION.'
task down: :load_config do
ActiveRecord::Tasks::DatabaseTasks.raise_for_multi_db(command: "db:migrate:down")
@ -226,7 +226,7 @@ db_namespace = namespace :db do
namespace :down do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc 'Runs the "down" on #{name} database for a given migration VERSION.'
desc 'Run the "down" on #{name} database for a given migration VERSION.'
task name => :load_config do
raise "VERSION is required" if !ENV["VERSION"] || ENV["VERSION"].empty?
@ -274,7 +274,7 @@ db_namespace = namespace :db do
end
end
desc "Rolls the schema back to the previous version (specify steps w/ STEP=n)."
desc "Roll the schema back to the previous version (specify steps w/ STEP=n)."
task rollback: :load_config do
ActiveRecord::Tasks::DatabaseTasks.raise_for_multi_db(command: "db:rollback")
raise "VERSION is not supported - To rollback a specific version, use db:migrate:down" if ENV["VERSION"]
@ -299,27 +299,27 @@ db_namespace = namespace :db do
task all: ["db:drop", "db:setup"]
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Drops and recreates the #{name} database from its schema for the current environment and loads the seeds."
desc "Drop and recreate the #{name} database from its schema for the current environment and load the seeds."
task name => ["db:drop:#{name}", "db:setup:#{name}"]
end
end
desc "Drops and recreates all databases from their schema for the current environment and loads the seeds."
desc "Drop and recreate all databases from their schema for the current environment and load the seeds."
task reset: [ "db:drop", "db:setup" ]
# desc "Retrieves the charset for the current environment's database"
# desc "Retrieve the charset for the current environment's database"
task charset: :load_config do
puts ActiveRecord::Tasks::DatabaseTasks.charset_current
end
# desc "Retrieves the collation for the current environment's database"
# desc "Retrieve the collation for the current environment's database"
task collation: :load_config do
puts ActiveRecord::Tasks::DatabaseTasks.collation_current
rescue NoMethodError
$stderr.puts "Sorry, your database adapter is not supported yet. Feel free to submit a patch."
end
desc "Retrieves the current schema version number"
desc "Retrieve the current schema version number"
task version: :load_config do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each(env: Rails.env) do |connection|
puts "\ndatabase: #{connection.pool.db_config.database}\n"
@ -330,7 +330,7 @@ db_namespace = namespace :db do
namespace :version do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Retrieves the current schema version number for #{name} database"
desc "Retrieve the current schema version number for #{name} database"
task name => :load_config do
db_config = ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: name)
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection(db_config) do |connection|
@ -363,7 +363,7 @@ db_namespace = namespace :db do
namespace :abort_if_pending_migrations do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
# desc "Raises an error if there are pending migrations for #{name} database"
# desc "Raise an error if there are pending migrations for #{name} database"
task name => :load_config do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each(env: Rails.env, name: name) do |conn|
pending_migrations = conn.migration_context.open.pending_migrations
@ -386,32 +386,32 @@ db_namespace = namespace :db do
task all: ["db:create", :environment, "db:schema:load", :seed]
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Creates the #{name} database, loads the schema, and initializes with the seed data (use db:reset:#{name} to also drop the database first)"
desc "Create the #{name} database, load the schema, and initialize with the seed data (use db:reset:#{name} to also drop the database first)"
task name => ["db:create:#{name}", :environment, "db:schema:load:#{name}", "db:seed"]
end
end
desc "Creates all databases, loads all schemas, and initializes with the seed data (use db:reset to also drop all databases first)"
desc "Create all databases, load all schemas, and initialize with the seed data (use db:reset to also drop all databases first)"
task setup: ["db:create", :environment, "db:schema:load", :seed]
desc "Runs setup if database does not exist, or runs migrations if it does"
desc "Run setup if database does not exist, or run migrations if it does"
task prepare: :load_config do
ActiveRecord::Tasks::DatabaseTasks.prepare_all
end
desc "Loads the seed data from db/seeds.rb"
desc "Load the seed data from db/seeds.rb"
task seed: :load_config do
db_namespace["abort_if_pending_migrations"].invoke
ActiveRecord::Tasks::DatabaseTasks.load_seed
end
namespace :seed do
desc "Truncates tables of each database for current environment and loads the seeds"
desc "Truncate tables of each database for current environment and load the seeds"
task replant: [:load_config, :truncate_all, :seed]
end
namespace :fixtures do
desc "Loads fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (e.g. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
desc "Load fixtures into the current environment's database. To load specific fixtures, use FIXTURES=x,y. To load from subdirectory in test/fixtures, use FIXTURES_DIR=z. To specify an alternative path (e.g. spec/fixtures), use FIXTURES_PATH=spec/fixtures."
task load: :load_config do
require "active_record/fixtures"
@ -460,7 +460,7 @@ db_namespace = namespace :db do
end
namespace :schema do
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`)"
desc "Create a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`)"
task dump: :load_config do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each do |conn|
db_config = conn.pool.db_config
@ -471,14 +471,14 @@ db_namespace = namespace :db do
db_namespace["schema:dump"].reenable
end
desc "Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) into the database"
desc "Load a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) into the database"
task load: [:load_config, :check_protected_environments] do
ActiveRecord::Tasks::DatabaseTasks.load_schema_current(ActiveRecord.schema_format, ENV["SCHEMA"])
end
namespace :dump do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) for #{name} database"
desc "Create a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) for #{name} database"
task name => :load_config do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each(name: name) do |conn|
db_config = conn.pool.db_config
@ -493,7 +493,7 @@ db_namespace = namespace :db do
namespace :load do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
desc "Loads a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) into the #{name} database"
desc "Load a database schema file (either db/schema.rb or db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or `config.active_record.schema_format`) into the #{name} database"
task name => "db:test:purge:#{name}" do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each(name: name) do |conn|
db_config = conn.pool.db_config
@ -505,7 +505,7 @@ db_namespace = namespace :db do
end
namespace :cache do
desc "Creates a db/schema_cache.yml file."
desc "Create a db/schema_cache.yml file."
task dump: :load_config do
ActiveRecord::Tasks::DatabaseTasks.with_temporary_connection_for_each do |conn|
db_config = conn.pool.db_config
@ -515,7 +515,7 @@ db_namespace = namespace :db do
end
end
desc "Clears a db/schema_cache.yml file."
desc "Clear a db/schema_cache.yml file."
task clear: :load_config do
ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
filename = ActiveRecord::Tasks::DatabaseTasks.cache_dump_filename(
@ -604,7 +604,7 @@ end
namespace :railties do
namespace :install do
# desc "Copies missing migrations from Railties (e.g. engines). You can specify Railties to use with FROM=railtie1,railtie2"
# desc "Copy missing migrations from Railties (e.g. engines). You can specify Railties to use with FROM=railtie1,railtie2"
task migrations: :'db:load_config' do
to_load = ENV["FROM"].blank? ? :all : ENV["FROM"].split(",").map(&:strip)
railties = {}

View File

@ -165,10 +165,10 @@ You can run `bin/rails -T` to see all the commands you're able to run. You shoul
```bash
$ bin/rails -T
rails db:create # Creates the database from DATABASE_URL or config/database.yml for the ...
rails db:create # Create the database from DATABASE_URL or config/database.yml for the ...
rails db:create:animals # Create animals database for current environment
rails db:create:primary # Create primary database for current environment
rails db:drop # Drops the database from DATABASE_URL or config/database.yml for the cu...
rails db:drop # Drop the database from DATABASE_URL or config/database.yml for the cu...
rails db:drop:animals # Drop animals database for current environment
rails db:drop:primary # Drop primary database for current environment
rails db:migrate # Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)
@ -177,21 +177,21 @@ rails db:migrate:primary # Migrate primary database for current
rails db:migrate:status # Display status of migrations
rails db:migrate:status:animals # Display status of migrations for animals database
rails db:migrate:status:primary # Display status of migrations for primary database
rails db:reset # Drops and recreates all databases from their schema for the current environment and loads the seeds
rails db:reset:animals # Drops and recreates the animals database from its schema for the current environment and loads the seeds
rails db:reset:primary # Drops and recreates the primary database from its schema for the current environment and loads the seeds
rails db:rollback # Rolls the schema back to the previous version (specify steps w/ STEP=n)
rails db:reset # Drop and recreates all databases from their schema for the current environment and loads the seeds
rails db:reset:animals # Drop and recreates the animals database from its schema for the current environment and loads the seeds
rails db:reset:primary # Drop and recreates the primary database from its schema for the current environment and loads the seeds
rails db:rollback # Roll the schema back to the previous version (specify steps w/ STEP=n)
rails db:rollback:animals # Rollback animals database for current environment (specify steps w/ STEP=n)
rails db:rollback:primary # Rollback primary database for current environment (specify steps w/ STEP=n)
rails db:schema:dump # Creates a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:dump:animals # Creates a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:dump:primary # Creates a db/schema.rb file that is portable against any DB supported ...
rails db:schema:load # Loads a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:load:animals # Loads a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:load:primary # Loads a database schema file (either db/schema.rb or db/structure.sql ...
rails db:setup # Creates all databases, loads all schemas, and initializes with the seed data (use db:reset to also drop all databases first)
rails db:setup:animals # Creates the animals database, loads the schema, and initializes with the seed data (use db:reset:animals to also drop the database first)
rails db:setup:primary # Creates the primary database, loads the schema, and initializes with the seed data (use db:reset:primary to also drop the database first)
rails db:schema:dump # Create a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:dump:animals # Create a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:dump:primary # Create a db/schema.rb file that is portable against any DB supported ...
rails db:schema:load # Load a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:load:animals # Load a database schema file (either db/schema.rb or db/structure.sql ...
rails db:schema:load:primary # Load a database schema file (either db/schema.rb or db/structure.sql ...
rails db:setup # Create all databases, loads all schemas, and initializes with the seed data (use db:reset to also drop all databases first)
rails db:setup:animals # Create the animals database, loads the schema, and initializes with the seed data (use db:reset:animals to also drop the database first)
rails db:setup:primary # Create the primary database, loads the schema, and initializes with the seed data (use db:reset:primary to also drop the database first)
```
Running a command like `bin/rails db:create` will create both the primary and animals databases.

View File

@ -156,19 +156,19 @@ assets:clobber Remove compiled assets
assets:environment Load asset compile environment
assets:precompile Compile all the assets ...
...
db:fixtures:load Loads fixtures into the ...
db:fixtures:load Load fixtures into the ...
db:migrate Migrate the database ...
db:migrate:status Display status of migrations
db:rollback Rolls the schema back to ...
db:rollback Roll the schema back to ...
db:schema:cache:clear Clears a db/schema_cache.yml file
db:schema:cache:dump Creates a db/schema_cache.yml file
db:schema:dump Creates a database schema file (either db/schema.rb or db/structure.sql ...
db:schema:load Loads a database schema file (either db/schema.rb or db/structure.sql ...
db:seed Loads the seed data ...
db:version Retrieves the current schema ...
db:schema:cache:dump Create a db/schema_cache.yml file
db:schema:dump Create a database schema file (either db/schema.rb or db/structure.sql ...
db:schema:load Load a database schema file (either db/schema.rb or db/structure.sql ...
db:seed Load the seed data ...
db:version Retrieve the current schema ...
...
restart Restart app by touching ...
tmp:create Creates tmp directories ...
tmp:create Create tmp directories ...
```
### `bin/rails server`

View File

@ -1,3 +1,7 @@
* Use infinitive form for all rails command descriptions verbs.
*Petrik de Heus*
* Credentials commands (e.g. `bin/rails credentials:edit`) now respect
`config.credentials.content_path` and `config.credentials.key_path` when set
in `config/application.rb`.

View File

@ -22,7 +22,7 @@ module Rails
end
end
desc "edit", "Opens the decrypted credentials in `$EDITOR` for editing"
desc "edit", "Open the decrypted credentials in `$EDITOR` for editing"
def edit
require_application!
load_generators
@ -39,7 +39,7 @@ module Rails
change_credentials_in_system_editor
end
desc "show", "Shows the decrypted credentials"
desc "show", "Show the decrypted credentials"
def show
require_application!
@ -52,7 +52,7 @@ module Rails
option :disenroll, type: :boolean, default: false,
desc: "Disenrolls project from credentials file diffing"
desc "diff", "Enrolls/disenrolls in decrypted diffs of credentials using git"
desc "diff", "Enroll/disenroll in decrypted diffs of credentials using git"
def diff(content_path = nil)
if @content_path = content_path
self.environment = extract_environment_from_path(content_path)

View File

@ -15,7 +15,7 @@ module Rails
super
end
desc "change", "Changes `config/database.yml` and your database gem to the target database"
desc "change", "Change `config/database.yml` and your database gem to the target database"
def perform(*)
Rails::Generators::Db::System::ChangeGenerator.start(@argv)
end

View File

@ -14,7 +14,7 @@ module Rails
end
end
desc "destroy", "Removes code generated by `bin/rails generate`"
desc "destroy", "Remove code generated by `bin/rails generate`"
def perform(*)
generator = args.shift
return help unless generator

View File

@ -11,7 +11,7 @@ module Rails
end
end
desc "cache", "Toggles development mode caching on/off"
desc "cache", "Toggle development mode caching on/off"
def cache
Rails::DevCaching.enable_by_file
end

View File

@ -20,7 +20,7 @@ module Rails
end
end
desc "edit", "Opens the decrypted file in `$EDITOR` for editing"
desc "edit", "Open the decrypted file in `$EDITOR` for editing"
def edit(*)
require_application!
@ -30,7 +30,7 @@ module Rails
change_encrypted_configuration_in_system_editor
end
desc "show", "Shows the decrypted contents of the file"
desc "show", "Show the decrypted contents of the file"
def show(*)
require_application!

View File

@ -7,7 +7,7 @@ module Rails
class NotesCommand < Base # :nodoc:
class_option :annotations, aliases: "-a", desc: "Filter by specific annotations, e.g. Foobar TODO", type: :array
desc "notes", "Shows comments in your code annotated with FIXME, OPTIMIZE, and TODO"
desc "notes", "Show comments in your code annotated with FIXME, OPTIMIZE, and TODO"
def perform(*)
require_application_and_environment!

View File

@ -20,7 +20,7 @@ module Rails
end
end
desc "routes", "Lists all the defined routes"
desc "routes", "List all the defined routes"
def perform(*)
require_application_and_environment!
require "action_dispatch/routing/inspector"

View File

@ -18,7 +18,7 @@ module Rails
"#{super} [<'Some.ruby(code)'> | <filename.rb> | -]"
end
desc "runner", "Runs Ruby code in the context of your application"
desc "runner", "Run Ruby code in the context of your application"
def perform(code_or_file = nil, *command_argv)
unless code_or_file
help

View File

@ -22,7 +22,7 @@ module Rails
deprecate_in_favor_of_credentials_and_exit
end
desc "edit", "Opens the secrets in `$EDITOR` for editing"
desc "edit", "Open the secrets in `$EDITOR` for editing"
def edit
require_application_and_environment!
@ -40,7 +40,7 @@ module Rails
end
end
desc "edit", "Shows the decrypted secrets"
desc "edit", "Show the decrypted secrets"
def show
say Rails::Secrets.read
end

View File

@ -3,7 +3,7 @@
module Rails
module Command
class VersionCommand < Base # :nodoc:
desc "version", "Shows the Rails version"
desc "version", "Show the Rails version"
def perform
Rails::Command.invoke :application, [ "--version" ]
end

View File

@ -43,17 +43,17 @@ namespace :db do
app_task "create"
app_task "create:all"
desc "Drops the database for the current Rails.env (use db:drop:all to drop all databases)"
desc "Drop the database for the current Rails.env (use db:drop:all to drop all databases)"
app_task "drop"
app_task "drop:all"
desc "Load fixtures into the current environment's database."
app_task "fixtures:load"
desc "Rolls the schema back to the previous version (specify steps w/ STEP=n)."
desc "Roll the schema back to the previous version (specify steps w/ STEP=n)."
app_task "rollback"
desc "Creates a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)"
desc "Create a database schema file (either db/schema.rb or db/structure.sql, depending on `config.active_record.schema_format`)"
app_task "schema:dump"
desc "Load a schema.rb file into the database"
@ -65,7 +65,7 @@ namespace :db do
desc "Create the database, load the schema, and initialize with the seed data (use db:reset to also drop the database first)"
app_task "setup"
desc "Retrieves the current schema version number"
desc "Retrieve the current schema version number"
app_task "version"
# desc 'Load the test schema'

View File

@ -4,7 +4,7 @@ namespace :app do
desc "Update configs and some other initially generated files (or use just update:configs or update:bin)"
task update: [ "update:configs", "update:bin", "update:active_storage", "update:upgrade_guide_info" ]
desc "Applies the template supplied by LOCATION=(/path/to/template) or URL"
desc "Apply the template supplied by LOCATION=(/path/to/template) or URL"
task template: :environment do
template = ENV["LOCATION"]
raise "No LOCATION value given. Please set LOCATION either as path to a file or a URL" if template.blank?
@ -46,7 +46,7 @@ namespace :app do
Rails::AppUpdater.invoke_from_app_generator :update_config_files
end
# desc "Adds new executables to the application bin/ directory"
# desc "Add new executables to the application bin/ directory"
task :bin do
Rails::AppUpdater.invoke_from_app_generator :update_bin_files
end

View File

@ -7,7 +7,7 @@ namespace :log do
# - defaults to all environments log files i.e. 'development,test,production'
# - ENV['LOGS']=all truncates all files i.e. log/*.log
# - ENV['LOGS']='test,development' truncates only specified files
desc "Truncates all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)"
desc "Truncate all/specified *.log files in log/ to zero bytes (specify which logs with LOGS=test,development)"
task :clear do
log_files.each do |file|
clear_log_file(file)

View File

@ -1,6 +1,6 @@
# frozen_string_literal: true
desc "Prints out your Rack middleware stack"
desc "Print out your Rack middleware stack"
task middleware: :environment do
Rails.configuration.middleware.each do |middleware|
puts "use #{middleware.inspect}"

View File

@ -28,17 +28,17 @@ namespace :time do
end
namespace :zones do
# desc 'Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6'
# desc 'Display all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6'
task :all do
build_time_zone_list ActiveSupport::TimeZone.all
end
# desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
# desc 'Display names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
task :us do
build_time_zone_list ActiveSupport::TimeZone.us_zones
end
# desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
# desc 'Display names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
task :local do
require "active_support"
require "active_support/time"

View File

@ -11,32 +11,32 @@ namespace :tmp do
tmp_dirs.each { |d| directory d }
desc "Creates tmp directories for cache, sockets, and pids"
desc "Create tmp directories for cache, sockets, and pids"
task create: tmp_dirs
namespace :cache do
# desc "Clears all files and directories in tmp/cache"
# desc "Clear all files and directories in tmp/cache"
task :clear do
rm_rf Dir["tmp/cache/[^.]*"], verbose: false
end
end
namespace :sockets do
# desc "Clears all files in tmp/sockets"
# desc "Clear all files in tmp/sockets"
task :clear do
rm Dir["tmp/sockets/[^.]*"], verbose: false
end
end
namespace :pids do
# desc "Clears all files in tmp/pids"
# desc "Clear all files in tmp/pids"
task :clear do
rm Dir["tmp/pids/[^.]*"], verbose: false
end
end
namespace :screenshots do
# desc "Clears all files in tmp/screenshots"
# desc "Clear all files in tmp/screenshots"
task :clear do
rm Dir["tmp/screenshots/[^.]*"], verbose: false
end

View File

@ -33,7 +33,7 @@ report = ->(not_checked) do
end
namespace :zeitwerk do
desc "Checks project structure for Zeitwerk compatibility"
desc "Check project structure for Zeitwerk compatibility"
task check: :environment do
begin
eager_load[]

View File

@ -20,7 +20,7 @@ class HelpTest < ActiveSupport::TestCase
assert_match "In addition to those commands", output
assert_match(/^about(\s+)List versions of all Rails frameworks/, output)
assert_match(/^test:models(\s+)Run tests in test\/models/, output)
assert_match(/^routes(\s+)Lists all the defined routes/, output)
assert_match(/^routes(\s+)List all the defined routes/, output)
assert_no_match(/^generate/, output)
assert_no_match(/^console/, output)
assert_no_match(/^server/, output)

View File

@ -10,7 +10,7 @@ require "rails/commands/db/system/change/change_command"
class Rails::Command::BaseTest < ActiveSupport::TestCase
test "printing commands returns command and description if present" do
assert_equal ["generate", ""], Rails::Command::GenerateCommand.printing_commands.first
assert_equal ["notes", "Shows comments in your code annotated with FIXME, OPTIMIZE, and TODO"], Rails::Command::NotesCommand.printing_commands.first
assert_equal ["notes", "Show comments in your code annotated with FIXME, OPTIMIZE, and TODO"], Rails::Command::NotesCommand.printing_commands.first
end
test "printing commands returns namespaced commands" do