Class: Rails::Command::ConflictedCredentialsCommand

Inherits:
CredentialsCommand
  • Object
show all
Defined in:
lib/rails/commands/conflicted_credentials/conflicted_credentials_command.rb,
lib/rails/commands/conflicted_credentials/conflicted_credentials_command/conflicted_credentials.rb

Defined Under Namespace

Classes: ConflictedCredentials

Instance Method Summary collapse

Instance Method Details

#editObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rails/commands/conflicted_credentials/conflicted_credentials_command.rb', line 12

def edit
  begin
    load_environment_config!
  rescue ActiveSupport::MessageEncryptor::InvalidMessage, ActiveSupport::EncryptedConfiguration::InvalidContentError
    # It's ok because they were conflicted
  end

  load_generators

  if environment_specified?
    @content_path = "config/credentials/#{environment}.yml.enc" unless config.overridden?(:content_path)
    @key_path = "config/credentials/#{environment}.key" unless config.overridden?(:key_path)
  end

  conflicted_credentials = ConflictedCredentials.new(content_path, key_path)
  conflicted_credentials.internalise_conflicts if conflicted_credentials.conflicts?

  ensure_encryption_key_has_been_added
  ensure_credentials_have_been_added
  ensure_diffing_driver_is_configured

  change_credentials_in_system_editor
end