Module: Rails::Command::CredentialsCommand::Diffing

Included in:
Rails::Command::CredentialsCommand
Defined in:
railties/lib/rails/commands/credentials/credentials_command/diffing.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#enroll_project_in_credentials_diffingObject


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'railties/lib/rails/commands/credentials/credentials_command/diffing.rb', line 4

def enroll_project_in_credentials_diffing
  if enrolled?
    true
  else
    gitattributes.write(<<~end_of_template, mode: "a")
      config/credentials/*.yml.enc diff=rails_credentials
      config/credentials.yml.enc diff=rails_credentials
    end_of_template

    say "Project successfully enrolled!"
    say "Rails ensures the rails_credentials diff driver is set when running `credentials:edit`. See `credentials:help` for more."
  end
end

#ensure_rails_credentials_driver_is_setObject


18
19
20
# File 'railties/lib/rails/commands/credentials/credentials_command/diffing.rb', line 18

def ensure_rails_credentials_driver_is_set
  set_driver if enrolled? && !driver_configured?
end