cap-ssh-key-man 1.2.2 → 1.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -10,11 +10,13 @@ Usage
10
10
 
11
11
  1. Add `gem "cap-ssh-key-man"` in your Gemfile.
12
12
 
13
- 2. Add `require 'cap-ssh-key-man'` to `config/deploy.rb` of your rails project.
13
+ 2. Add `require 'cap-ssh-key-man/tasks/rsync'` to `config/deploy.rb` of your rails project.
14
14
 
15
15
  3. Put all public ssh keys to `config/developer_ssh_keys` dir of your rails project.
16
16
 
17
- 4. Execute `cap sshkey:deploy`
17
+ 4. Add `set :sshkeys_path, PATH_TO_SSHKEYS_STORE_PATH` to `deploy.rb`.
18
+
19
+ 5. Execute `cap sshkey:deploy`
18
20
 
19
21
  Done.
20
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.2
1
+ 1.2.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{cap-ssh-key-man}
8
- s.version = "1.2.2"
8
+ s.version = "1.2.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Michael He"]
@@ -1 +0,0 @@
1
- Dir[File.join(File.dirname(__FILE__), 'cap-ssh-key-man/tasks/*.rb')].sort.each { |lib| require lib }
@@ -5,10 +5,10 @@ module CapSshKeyMan
5
5
  OMNI_RSA_KEY_PATH = File.expand_path(File.join "~", ".ssh", "id_rsa.pub")
6
6
  OMNI_DSA_KEY_PATH = File.expand_path(File.join "~", ".ssh", "id_dsa.pub")
7
7
 
8
- def self.combine_developer_public_keys
8
+ def self.combine_developer_public_keys_to public_key_path = PUBLIC_KEY_PATH
9
9
  File.open AUTHORIZED_KEYS_PATH, "w" do |f|
10
10
  f.write File.read(get_current_user_public_key_path) if get_current_user_public_key_path
11
- files = Dir[File.join(PUBLIC_KEY_PATH, '*')]
11
+ files = Dir[File.join(public_key_path, '*')]
12
12
  raise "Can't find any public keys in #{public_key_path} dir." if files.size == 0
13
13
  files.each do |file|
14
14
  f.write File.read(file)
@@ -1,11 +1,16 @@
1
+ abort "cap-ssh-key-man requires Capistrano 2" unless Capistrano::Configuration.respond_to?(:instance)
1
2
  require "cap-ssh-key-man/public_key_combiner"
3
+
2
4
  Capistrano::Configuration.instance(true).load do
3
5
  namespace :sshkey do
4
6
  desc "Sync keys to servers"
5
7
  task :deploy do
6
- CapSshKeyMan::PublicKeyCombiner.combine_developer_public_keys
8
+ if !exists?(:sshkeys_path) or !File.exist?(sshkeys_path)
9
+ abort "Please add 'set :sshkeys_path, YOUR_PUBLIC_KEY_DIR' in your deploy.rb, and put public keys in YOUR_PUBLIC_KEY_DIR."
10
+ end
11
+ CapSshKeyMan::PublicKeyCombiner.combine_developer_public_keys_to sshkeys_path
7
12
  put File.read(CapSshKeyMan::PublicKeyCombiner::AUTHORIZED_KEYS_PATH), File.join("/home/#{user}", ".ssh", "authorized_keys")
8
13
  FileUtils.rm CapSshKeyMan::PublicKeyCombiner::AUTHORIZED_KEYS_PATH # delete temp file after use it.
9
14
  end
10
15
  end
11
- end
16
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cap-ssh-key-man
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 2
10
- version: 1.2.2
9
+ - 3
10
+ version: 1.2.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael He