Module: VagrantPlugins::GitCredentials::Util
- Included in:
- Action::AddKey, Action::RemoveKey
- Defined in:
- lib/vagrant-gitcredentials/Util.rb
Instance Method Summary collapse
-
#createKey ⇒ Object
generates new ssh key and calls github v3 api to add key to user account.
-
#deleteKey ⇒ Object
calls github v3 api to remove key from user account.
-
#promptCredentials ⇒ Object
get (temporarily) git credentials from user.
Instance Method Details
#createKey ⇒ Object
generates new ssh key and calls github v3 api to add key to user account
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/vagrant-gitcredentials/Util.rb', line 5 def createKey promptCredentials() srcPath= "scripts/github.sh" destPath = "~/.ssh/github.sh" # create script @machine.communicate.upload(srcPath, destPath) # set permissions for execution @machine.communicate.execute("chmod 755 ~/.ssh/github.sh") # execute script w/ permissions @machine.communicate.execute("sh ~/.ssh/github.sh #{gitUsername} #{gitPassword}") @ui.info("created ssh key") end |
#deleteKey ⇒ Object
calls github v3 api to remove key from user account
20 21 22 |
# File 'lib/vagrant-gitcredentials/Util.rb', line 20 def deleteKey @ui.info("not yet implemented") end |
#promptCredentials ⇒ Object
get (temporarily) git credentials from user
25 26 27 28 29 |
# File 'lib/vagrant-gitcredentials/Util.rb', line 25 def promptCredentials @ui.info("We will now generate an ssh key and add it to your github account.") @gitUsername = @ui.ask("What is your github account name? ") @gitPassword = @ui.ask("What is your github account password? (not stored) ") end |