Class: Rails::Command::CredentialsCommand
- Includes:
- Diffing, EnvironmentArgument, Helpers::Editor
- Defined in:
- lib/rails/commands/credentials/credentials_command.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Diffing
Constant Summary
Constants included from Diffing
Instance Method Summary collapse
Methods included from Diffing
#disenroll_project_from_credentials_diffing, #enroll_project_in_credentials_diffing, #ensure_diffing_driver_is_configured
Methods inherited from Base
banner, base_name, command_name, default_command_root, desc, engine?, executable, exit_on_failure?, #help, hide_command!, inherited, namespace, perform, printing_commands, usage_path
Methods included from Actions
#load_generators, #load_tasks, #require_application!, #require_application_and_environment!, #require_environment!, #set_application_directory!
Instance Method Details
#diff(content_path = nil) ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/rails/commands/credentials/credentials_command.rb', line 60 def diff(content_path = nil) if @content_path = content_path extract_environment_option_from_argument(default_environment: extract_environment_from_path(content_path)) require_application! say credentials.read.presence || credentials.content_path.read else require_application! disenroll_project_from_credentials_diffing if [:disenroll] enroll_project_in_credentials_diffing if [:enroll] end rescue ActiveSupport::MessageEncryptor::InvalidMessage say credentials.content_path.read end |
#edit ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rails/commands/credentials/credentials_command.rb', line 28 def edit extract_environment_option_from_argument(default_environment: nil) require_application! ensure_editor_available(command: "bin/rails credentials:edit") || (return) ensure_encryption_key_has_been_added if credentials.key.nil? ensure_credentials_have_been_added ensure_diffing_driver_is_configured catch_editing_exceptions do change_credentials_in_system_editor end say "File encrypted and saved." rescue ActiveSupport::MessageEncryptor::InvalidMessage say "Couldn't decrypt #{content_path}. Perhaps you passed the wrong key?" end |
#show ⇒ Object
47 48 49 50 51 52 |
# File 'lib/rails/commands/credentials/credentials_command.rb', line 47 def show extract_environment_option_from_argument(default_environment: nil) require_application! say credentials.read.presence || end |