Class: CapSshKeyMan::PublicKeyCombiner
- Inherits:
-
Object
- Object
- CapSshKeyMan::PublicKeyCombiner
- Defined in:
- lib/cap-ssh-key-man/public_key_combiner.rb
Constant Summary collapse
- PUBLIC_KEY_PATH =
AUTHORIZED_KEYS_PATH = File.join “.”, “tmp”, “authorized_keys”
File.join(".", "config", "developer_public_keys")
- OMNI_RSA_KEY_PATH =
File.(File.join "~", ".ssh", "id_rsa.pub")
- OMNI_DSA_KEY_PATH =
File.(File.join "~", ".ssh", "id_dsa.pub")
Class Method Summary collapse
- .combine_developer_public_keys_in(public_key_path) ⇒ Object
- .get_current_user_public_key_path ⇒ Object
Class Method Details
.combine_developer_public_keys_in(public_key_path) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/cap-ssh-key-man/public_key_combiner.rb', line 8 def self.combine_developer_public_keys_in public_key_path public_key_path ||= PUBLIC_KEY_PATH abort "Please put your public keys in #{public_key_path}." unless File.exist?(public_key_path) = "" << File.read(get_current_user_public_key_path) if get_current_user_public_key_path files = Dir[File.join(public_key_path, '*')] raise "Can't find any public keys in #{public_key_path} dir." if files.size == 0 files.each do |file| << File.read(file) end end |
.get_current_user_public_key_path ⇒ Object
24 25 26 27 28 29 |
# File 'lib/cap-ssh-key-man/public_key_combiner.rb', line 24 def self.get_current_user_public_key_path current_user_key_path = nil current_user_key_path = OMNI_RSA_KEY_PATH if File.exist?(OMNI_RSA_KEY_PATH) current_user_key_path = OMNI_DSA_KEY_PATH if File.exist?(OMNI_DSA_KEY_PATH) current_user_key_path end |