Class: Rails::Command::CredentialsCommand

Inherits:
Base
  • Object
show all
Includes:
Helpers::Editor
Defined in:
lib/rails/commands/credentials/credentials_command.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from Base

banner, base_name, command_name, default_command_root, desc, engine?, executable, #help, hide_command!, inherited, namespace, perform, printing_commands, usage_path

Methods included from Actions

#load_generators, #load_tasks, #require_application_and_environment!, #set_application_directory!

Instance Method Details

#editObject



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rails/commands/credentials/credentials_command.rb', line 19

def edit
  require_application_and_environment!

  ensure_editor_available(command: "bin/rails credentials:edit") || (return)
  ensure_master_key_has_been_added if Rails.application.credentials.key.nil?
  ensure_credentials_have_been_added

  catch_editing_exceptions do
    change_credentials_in_system_editor
  end

  say "New credentials encrypted and saved."
end

#showObject



33
34
35
36
37
# File 'lib/rails/commands/credentials/credentials_command.rb', line 33

def show
  require_application_and_environment!

  say Rails.application.credentials.read.presence || missing_credentials_message
end