Sha256: ba07cdc0d0c41b6831d4a5192e0ea4ff1c3280f2983b257b2ad2575ba17f4196

Contents?: true

Size: 1009 Bytes

Versions: 2

Compression:

Stored size: 1009 Bytes

Contents

#!/usr/bin/env ruby

require File.join File.dirname(__FILE__), '..', 'lib', 'uploader'
require File.join File.dirname(__FILE__), '..', 'lib', 'file_combiner'
require File.join File.dirname(__FILE__), '..', 'lib', 'alias_gen'
require 'optparse'

options = {}

OptionParser.new do |opts|
  opts.banner = "Usage: deploy_sshkey [options]"

  opts.on("-a", "--alias user", "Generate shell alias for specific user") do |user|
    options[:alias_for_user] = user
  end

  opts.on("-g group", "--group group", "Server Group Name") do |group|
    options[:group] = group
  end
end.parse!

begin
  # check alias option
  if !(alias_for_user = options[:alias_for_user]).nil?
    SshKeyMan::AliasGen.generate alias_for_user
    exit
  end

  # check group option
  raise "Please provide group name." if (group = options[:group]).nil?

  SshKeyMan::PublicKeyCombiner.combine group
  SshKeyMan::Uploader.upload_all_public_keys group
  puts "Done!"
rescue => e
  puts e.to_s
  puts "Check help: ssh-key-sync-man --help"
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ssh-key-sync-man-0.2.0 bin/ssh-key-sync-man
ssh-key-sync-man-0.1.5 bin/ssh-key-sync-man