Class: Vinz::Clortho::SSHKeyPathManager
- Inherits:
-
Object
- Object
- Vinz::Clortho::SSHKeyPathManager
- Defined in:
- lib/vinz/clortho/ssh_key_path_manager.rb
Constant Summary collapse
- DEFAULT_KEY_PATH =
'/Volumes/*/.ssh/id_rsa'
Instance Attribute Summary collapse
-
#key_paths ⇒ Object
readonly
Returns the value of attribute key_paths.
Instance Method Summary collapse
-
#initialize ⇒ SSHKeyPathManager
constructor
A new instance of SSHKeyPathManager.
- #key_path_for(initials) ⇒ Object
Constructor Details
#initialize ⇒ SSHKeyPathManager
Returns a new instance of SSHKeyPathManager.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vinz/clortho/ssh_key_path_manager.rb', line 21 def initialize @key_paths = if .nil? Dir[DEFAULT_KEY_PATH].map { |path| KeyPathEntry.new(path) } else = YAML::load_file() ['sshkey_paths'].map do |initials, path| KeyPathEntry.new(path, initials) end end end |
Instance Attribute Details
#key_paths ⇒ Object (readonly)
Returns the value of attribute key_paths.
17 18 19 |
# File 'lib/vinz/clortho/ssh_key_path_manager.rb', line 17 def key_paths @key_paths end |
Instance Method Details
#key_path_for(initials) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/vinz/clortho/ssh_key_path_manager.rb', line 32 def key_path_for(initials) raise ArgumentError.new('Committer initials are required') unless initials key_path = @key_paths.detect { |kp| kp.initials == initials } if key_path.nil? raise UserNotFoundError.new(user_not_found_msg) else key_path.path end end |