vagrant-gitcredentials 0.0.21 → 0.0.22

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,20 +7,26 @@ module VagrantPlugins
7
7
  script = ["GITHUB_USERNAME=$1", "GITHUB_PASSWORD=$2"]
8
8
  script.concat(["ssh-keygen -N '' -f ~/.ssh/github_rsa", "ssh-add ~/.ssh/github_rsa"])
9
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'])
11
- @machine.communicate.execute("echo '' > ~/.ssh/github.sh")
12
- # create script
13
- script.each {
14
- |l|
15
- e = Shellwords.escape(l);
16
- @machine.communicate.execute("echo #{e} >> ~/.ssh/github.sh")
17
- }
18
- # set permissions for execution
19
- @machine.communicate.execute("chmod 755 ~/.ssh/github.sh")
20
- @machine.communicate.execute("cat ~/.ssh/github.sh")
21
- # execute script w/ permissions
22
- promptCredentials()
23
- @machine.communicate.execute("sh ~/.ssh/github.sh #@gitUsername #@gitPassword")
10
+ script.concat(['curl -u "$GITHUB_USERNAME:$GITHUB_PASSWORD" -d "$JSON" https://api.github.com/user/keys > ~/.ssh/git.response'])
11
+
12
+ # if we have a successful response, skip generating key
13
+ unless @machine.communicate.test('grep '"id"' ~/.ssh/git.response')
14
+
15
+ @machine.communicate.execute("echo '' > ~/.ssh/github.sh")
16
+ # create script
17
+ script.each {
18
+ |l|
19
+ e = Shellwords.escape(l);
20
+ @machine.communicate.execute("echo #{e} >> ~/.ssh/github.sh")
21
+ }
22
+ # set permissions for execution
23
+ @machine.communicate.execute("chmod 755 ~/.ssh/github.sh")
24
+ @machine.communicate.execute("cat ~/.ssh/github.sh")
25
+ # execute script w/ permissions
26
+ promptCredentials()
27
+ @machine.communicate.execute("sh ~/.ssh/github.sh #@gitUsername #@gitPassword")
28
+ end
29
+
24
30
  @machine.communicate.execute("sh /vagrant_shared/build/scripts/recipies/github.sh")
25
31
 
26
32
  @ui.info("created ssh key")
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GitCredentials
3
- VERSION = "0.0.21"
3
+ VERSION = "0.0.22"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 21
9
- version: 0.0.21
8
+ - 22
9
+ version: 0.0.22
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeremy Giberson