vagrant-gitcredentials 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-gitcredentials.gemspec
4
+ gemspec
5
+
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Jeremy Giberson
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # Vagrant::Gitcredentials
2
+
3
+ On "vagrant up" an SSH key is generated and registered with your github.com account.
4
+ This allows the Guest VM to execute git statements without having to provide credentials each time.
5
+
6
+ ## Installation
7
+
8
+ Add this line to your application's Gemfile:
9
+
10
+ gem 'vagrant-gitcredentials'
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install vagrant-gitcredentials
19
+
20
+ ## Usage
21
+
22
+ TODO: Write usage instructions here
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ #require "bundler/gem_tasks"
2
+ require 'rubygems'
3
+ require 'bundler/setup'
4
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,19 @@
1
+ module Vagrant
2
+ module GitCredentials
3
+ module Action
4
+ class AddKey
5
+ include GitCredentials
6
+
7
+ def initialize(app, env)
8
+ @app = app
9
+ @machine = env[:machine]
10
+ end
11
+
12
+ def call(env)
13
+ addKey
14
+ @app.call(env)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ module Vagrant
2
+ module GitCredentials
3
+ module Action
4
+ class RemoveKey
5
+ include GitCredentials
6
+
7
+ def initialize(app, env)
8
+ @app = app
9
+ @machine = env[:machine]
10
+ end
11
+
12
+ def call(env)
13
+ removeKey
14
+ @app.call(env)
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,25 @@
1
+ module Vagrant
2
+ module GitCredentials
3
+ module GitCredentials
4
+
5
+ # generates new ssh key and calls github v3 api to add key to user account
6
+ def addKey
7
+ promptCredentials()
8
+ # do stuff
9
+ @ui.say("created ssh key")
10
+ end
11
+
12
+ # calls github v3 api to remove key from user account
13
+ def removeKey
14
+ @ui.say("not yet implemented")
15
+ end
16
+
17
+ # get (temporarily) git credentials from user
18
+ def promptCredentials
19
+ @ui.say("We will now generate an ssh key and add it to your github account.")
20
+ @gitUsername = @ui.ask("What is your github account name? ")
21
+ @gitPassword = @ui.ask("What is your github account password? (not stored) ")
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ require "vagrant/gitcredentials/Action/AddKey"
2
+ require "vagrant/gitcredentials/Action/RemoveKey"
3
+
4
+ module Vagrant
5
+ module GitCredentials
6
+ class Plugin < Vagrant.plugin('2')
7
+ name 'GitCredentials'
8
+ description <<-DESC
9
+ Generates an ssh key and uploads it to user's github account authenticating the guest
10
+ machine for git command.
11
+ DESC
12
+
13
+ action_hook(:gitcredentials, :machine_action_up) do |hook|
14
+ hook.append(Action::AddKey)
15
+ end
16
+
17
+ action_hook(:gitcredentials, :machine_action_destroy) do |hook|
18
+ hook.append(Action::RemoveKey)
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Gitcredentials
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,8 @@
1
+ require "vagrant/gitcredentials/version"
2
+ require "vagrant/gitcredentials/plugin"
3
+
4
+ module Vagrant
5
+ module Gitcredentials
6
+ @source_root ||= Pathname.new(File.expand_path('../../', __FILE__))
7
+ end
8
+ end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant/gitcredentials/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-gitcredentials"
8
+ spec.version = Vagrant::Gitcredentials::VERSION
9
+ spec.authors = ["Jeremy Giberson"]
10
+ spec.email = ["jeremyg@webpt.com"]
11
+ spec.description = %q{Generates SSH key and registers it with your gitHub account}
12
+ spec.summary = %q{Allows Guest VM to execute git commands (against gitHub repos) with your credentials.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.3"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-gitcredentials
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Jeremy Giberson
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2013-10-10 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ type: :development
22
+ version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ segments:
27
+ - 1
28
+ - 3
29
+ version: "1.3"
30
+ name: bundler
31
+ requirement: *id001
32
+ prerelease: false
33
+ - !ruby/object:Gem::Dependency
34
+ type: :development
35
+ version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ version: "0"
42
+ name: rake
43
+ requirement: *id002
44
+ prerelease: false
45
+ description: Generates SSH key and registers it with your gitHub account
46
+ email:
47
+ - jeremyg@webpt.com
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files: []
53
+
54
+ files:
55
+ - .gitignore
56
+ - Gemfile
57
+ - LICENSE.txt
58
+ - README.md
59
+ - Rakefile
60
+ - lib/vagrant/gitcredentials.rb
61
+ - lib/vagrant/gitcredentials/Action/AddKey.rb
62
+ - lib/vagrant/gitcredentials/Action/RemoveKey.rb
63
+ - lib/vagrant/gitcredentials/GitCredentials.rb
64
+ - lib/vagrant/gitcredentials/plugin.rb
65
+ - lib/vagrant/gitcredentials/version.rb
66
+ - vagrant-gitcredentials.gemspec
67
+ has_rdoc: true
68
+ homepage: ""
69
+ licenses:
70
+ - MIT
71
+ post_install_message:
72
+ rdoc_options: []
73
+
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ segments:
81
+ - 0
82
+ version: "0"
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
90
+ requirements: []
91
+
92
+ rubyforge_project:
93
+ rubygems_version: 1.3.6
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Allows Guest VM to execute git commands (against gitHub repos) with your credentials.
97
+ test_files: []
98
+