Sha256: f15f78516c22e96951271a904f6297d778663c44fea49b4d211787906460eac6

Contents?: true

Size: 815 Bytes

Versions: 1

Compression:

Stored size: 815 Bytes

Contents

abort "cap-ssh-key-man requires Capistrano 2" unless Capistrano::Configuration.respond_to?(:instance)
require "cap-ssh-key-man/public_key_combiner"

Capistrano::Configuration.instance(true).load do
  namespace :sshkey do
    desc "Sync keys to servers"
    task :deploy do
      if !exists?(:sshkeys_path) or !File.exist?(sshkeys_path)
        abort "Please add 'set :sshkeys_path, YOUR_PUBLIC_KEY_DIR' in your deploy.rb, and put public keys in YOUR_PUBLIC_KEY_DIR."
      end
      CapSshKeyMan::PublicKeyCombiner.combine_developer_public_keys_to sshkeys_path
      put File.read(CapSshKeyMan::PublicKeyCombiner::AUTHORIZED_KEYS_PATH), File.join("/home/#{user}", ".ssh", "authorized_keys")
      FileUtils.rm CapSshKeyMan::PublicKeyCombiner::AUTHORIZED_KEYS_PATH # delete temp file after use it.
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cap-ssh-key-man-1.2.3 lib/cap-ssh-key-man/tasks/sync.rb