vagrant-gitcredentials 0.0.10 → 0.0.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ GITHUB_USERNAME=$1
2
+ GITHUB_PASSWORD=$2
3
+ ssh-keygen -N "" -f ~/.ssh/github_rsa
4
+ # add new github key to the chain
5
+ ssh-add ~/.ssh/github_rsa
6
+ # read public key into variables
7
+ set -- $(<~/.ssh/github_rsa.pub)
8
+ # define the payload for github api to create a new key
9
+ JSON='{"title":"vagrant provision key", "key": "ssh-rsa '$2'"}'
10
+ # add key to github account
11
+ curl -u "$GITHUB_USERNAME:$GITHUB_PASSWORD" -d "$JSON" https://api.github.com/user/keys
@@ -1,10 +1,21 @@
1
1
  module VagrantPlugins
2
2
  module GitCredentials
3
3
  module Util
4
+ srcPath= "scripts/github.sh"
5
+ destPath = "~/.ssh/github.sh"
6
+
4
7
  # generates new ssh key and calls github v3 api to add key to user account
5
8
  def createKey
6
9
  promptCredentials()
7
10
  # do stuff
11
+ with_target_vms(argv, :reverse => true) do |machine|
12
+ # create script
13
+ machine.communicate.upload(srcPath, destPath)
14
+ # set permissions for execution
15
+ machine.communicate.execute("chmod 755 ~/.ssh/github.sh")
16
+ # execute script w/ permissions
17
+ machine.communicate.execute("sh ~/.ssh/github.sh #{gitUsername} #{gitPassword}")
18
+ end
8
19
  @ui.info("created ssh key")
9
20
  end
10
21
 
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module GitCredentials
3
- VERSION = "0.0.10"
3
+ VERSION = "0.0.11"
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
- - 10
9
- version: 0.0.10
8
+ - 11
9
+ version: 0.0.11
10
10
  platform: ruby
11
11
  authors:
12
12
  - Jeremy Giberson
@@ -57,6 +57,7 @@ files:
57
57
  - LICENSE.txt
58
58
  - README.md
59
59
  - Rakefile
60
+ - lib/scripts/github.sh
60
61
  - lib/vagrant-gitcredentials.rb
61
62
  - lib/vagrant-gitcredentials/Action/AddKey.rb
62
63
  - lib/vagrant-gitcredentials/Action/RemoveKey.rb