Module: Rails::Command::CredentialsCommand::Diffing
- Included in:
- Rails::Command::CredentialsCommand
- Defined in:
- railties/lib/rails/commands/credentials/credentials_command/diffing.rb
Overview
:nodoc:
Constant Summary collapse
- GITATTRIBUTES_ENTRY =
<<~END config/credentials/*.yml.enc diff=rails_credentials config/credentials.yml.enc diff=rails_credentials END
Instance Method Summary collapse
- #disenroll_project_from_credentials_diffing ⇒ Object
- #enroll_project_in_credentials_diffing ⇒ Object
- #ensure_diffing_driver_is_configured ⇒ Object
Instance Method Details
#disenroll_project_from_credentials_diffing ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'railties/lib/rails/commands/credentials/credentials_command/diffing.rb', line 21 def disenroll_project_from_credentials_diffing if enrolled_in_credentials_diffing? gitattributes.write(gitattributes.read.gsub(GITATTRIBUTES_ENTRY, "")) gitattributes.delete if gitattributes.empty? say "Disenrolled project from credentials file diffing!" else say "Project is not enrolled in credentials file diffing." end end |
#enroll_project_in_credentials_diffing ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'railties/lib/rails/commands/credentials/credentials_command/diffing.rb', line 9 def enroll_project_in_credentials_diffing if enrolled_in_credentials_diffing? say "Project is already enrolled in credentials file diffing." else gitattributes.write(GITATTRIBUTES_ENTRY, mode: "a") say "Enrolled project in credentials file diffing!" say "" say "Rails will configure the Git diff driver for credentials when running `#{executable(:edit)}`. See `#{executable(:help)}` for more information." end end |
#ensure_diffing_driver_is_configured ⇒ Object
32 33 34 |
# File 'railties/lib/rails/commands/credentials/credentials_command/diffing.rb', line 32 def ensure_diffing_driver_is_configured configure_diffing_driver if enrolled_in_credentials_diffing? && !diffing_driver_configured? end |