Use Thor for built-in secret task
Currently we use both Thor and Rake for `bin/rails` commands. We eventually want to get all the built-ins task promoted to Thor Commands. This migrates the secret task to Thor.
This commit is contained in:
parent
779c14bf16
commit
55addc74dc
13
railties/lib/rails/commands/secret/secret_command.rb
Normal file
13
railties/lib/rails/commands/secret/secret_command.rb
Normal file
@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module Rails
|
||||
module Command
|
||||
class SecretCommand < Base # :nodoc:
|
||||
desc "secret", "Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)."
|
||||
def perform
|
||||
require "securerandom"
|
||||
puts SecureRandom.hex(64)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -1,11 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
desc "Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions)."
|
||||
task :secret do
|
||||
require "securerandom"
|
||||
puts SecureRandom.hex(64)
|
||||
end
|
||||
|
||||
desc "List versions of all Rails frameworks and the environment"
|
||||
task about: :environment do
|
||||
puts Rails::Info
|
||||
|
Loading…
Reference in New Issue
Block a user