Module: GitHandler::AuthorizedKeys

Defined in:
lib/git_handler/authorized_keys.rb

Class Method Summary collapse

Class Method Details

.write_key(path, key, command) ⇒ Object

Write a single key formatted content to file

Parameters:

  • path (String)

    authorized keys file path

  • key (PublicKey)

    public key object

  • command (String)

    custom command for the key



16
17
18
# File 'lib/git_handler/authorized_keys.rb', line 16

def self.write_key(path, key, command)
  self.write_keys(path, [key], command)
end

.write_keys(path, keys, command) ⇒ Object

Write formatted keys content to file

Parameters:

  • path (String)

    path path to authorized_keys file

  • keys (Array<PublicKey>)

    public key objects

  • command (String)

    custom command for the key



7
8
9
10
# File 'lib/git_handler/authorized_keys.rb', line 7

def self.write_keys(path, keys, command)
  content = keys.map { |k| k.to_system_key(command) }.join("\n").strip
  self.write(path, content)
end