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 +4 -2
- data/VERSION +1 -1
- data/cap-ssh-key-man.gemspec +1 -1
- data/lib/cap-ssh-key-man.rb +0 -1
- data/lib/cap-ssh-key-man/public_key_combiner.rb +2 -2
- data/lib/cap-ssh-key-man/tasks/sync.rb +7 -2
- metadata +3 -3
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.
|
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.
|
1
|
+
1.2.3
|
data/cap-ssh-key-man.gemspec
CHANGED
data/lib/cap-ssh-key-man.rb
CHANGED
@@ -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.
|
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(
|
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
|
-
|
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:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 1.2.
|
9
|
+
- 3
|
10
|
+
version: 1.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Michael He
|