Class: Rails::Worktrees::CredentialKeyLinker
- Inherits:
-
Object
- Object
- Rails::Worktrees::CredentialKeyLinker
- Defined in:
- lib/rails/worktrees/credential_key_linker.rb
Overview
Links credential key files from a sibling worktree into the new worktree.
Defined Under Namespace
Classes: Result
Constant Summary collapse
- CREDENTIALS_DIR =
'config/credentials'.freeze
- KEY_TYPES =
[ { name: 'development', config_attr: :link_credential_keys }, { name: 'test', config_attr: :link_test_credential_key }, { name: 'production', config_attr: :link_production_credential_key } ].freeze
Instance Method Summary collapse
- #call(dry_run: false) ⇒ Object
-
#initialize(target_dir:, peer_roots:, configuration:) ⇒ CredentialKeyLinker
constructor
A new instance of CredentialKeyLinker.
Constructor Details
#initialize(target_dir:, peer_roots:, configuration:) ⇒ CredentialKeyLinker
Returns a new instance of CredentialKeyLinker.
17 18 19 20 21 |
# File 'lib/rails/worktrees/credential_key_linker.rb', line 17 def initialize(target_dir:, peer_roots:, configuration:) @target_dir = target_dir @peer_roots = peer_roots @configuration = configuration end |
Instance Method Details
#call(dry_run: false) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rails/worktrees/credential_key_linker.rb', line 23 def call(dry_run: false) = [] KEY_TYPES.each do |key_type| next unless @configuration.public_send(key_type[:config_attr]) = process_key(key_type[:name], dry_run: dry_run) << if end Result.new() end |