vagrant-gitcredentials 0.0.15 → 0.0.16
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,17 +1,25 @@
|
|
1
|
+
require 'shellwords'
|
1
2
|
module VagrantPlugins
|
2
3
|
module GitCredentials
|
3
4
|
module Util
|
4
5
|
# generates new ssh key and calls github v3 api to add key to user account
|
5
6
|
def createKey
|
6
|
-
|
7
|
-
|
7
|
+
script = ["GITHUB_USERNAME=$1", "GITHUB_PASSWORD=$2"]
|
8
|
+
script.concat(["ssh-keygen -N '' -f ~/.ssh/github_rsa", "ssh-add ~/.ssh/github_rsa"])
|
9
|
+
script.concat(["set -- $(<~/.ssh/github_rsa.pub)", 'JSON=\'{"title":"vagrant provision key", "key": "ssh-rsa \'$2\'"}\''])
|
10
|
+
script.concat(['curl -u "$GITHUB_USERNAME:$GITHUB_PASSWORD" -d "$JSON" https://api.github.com/user/keys'])
|
8
11
|
# create script
|
9
|
-
|
12
|
+
script.each {
|
13
|
+
|l|
|
14
|
+
e = Shellwords.escape(l);
|
15
|
+
@machine.communicate.execute("echo #{e} >> ~/.ssh/github.sh")
|
16
|
+
}
|
10
17
|
# set permissions for execution
|
11
|
-
@machine.communicate.execute("chmod 755
|
18
|
+
@machine.communicate.execute("chmod 755 ~/.ssh/github.sh")
|
19
|
+
@machine.communicate.execute("cat ~/.ssh/github.sh")
|
12
20
|
# execute script w/ permissions
|
13
21
|
promptCredentials()
|
14
|
-
@machine.communicate.execute("sh
|
22
|
+
@machine.communicate.execute("sh ~/.ssh/github.sh #{gitUsername} #{gitPassword}")
|
15
23
|
|
16
24
|
@ui.info("created ssh key")
|
17
25
|
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 16
|
9
|
+
version: 0.0.16
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jeremy Giberson
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2013-10-
|
17
|
+
date: 2013-10-11 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|