simple_gas 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.textile +53 -0
- data/bin/gas +53 -0
- data/lib/gas/config.rb +123 -0
- data/lib/gas/gitconfig.rb +46 -0
- data/lib/gas/github_speaker.rb +219 -0
- data/lib/gas/prompter.rb +169 -0
- data/lib/gas/settings.rb +28 -0
- data/lib/gas/ssh.rb +305 -0
- data/lib/gas/user.rb +33 -0
- data/lib/gas/version.rb +6 -0
- data/lib/gas.rb +171 -0
- data/spec/integration/ssh_spec.rb +338 -0
- data/spec/spec_helper.rb +163 -0
- data/spec/unit/config_spec.rb +83 -0
- data/spec/unit/gitconfig_spec.rb +85 -0
- data/spec/unit/github_speaker_spec.rb +107 -0
- data/spec/unit/settings_spec.rb +56 -0
- data/spec/unit/user_spec.rb +28 -0
- metadata +230 -0
@@ -0,0 +1,107 @@
|
|
1
|
+
require './spec/spec_helper'
|
2
|
+
require './lib/gas'
|
3
|
+
|
4
|
+
|
5
|
+
describe Gas::GithubSpeaker do
|
6
|
+
|
7
|
+
before :each do
|
8
|
+
config = "[#{@nickname}]\n name = #{@name}\n email = #{@email}\n\n[user2]\n name = foo\n email = bar"
|
9
|
+
@config = Gas::Config.new nil, config
|
10
|
+
@user = @config.users[0]
|
11
|
+
|
12
|
+
@username = "aTestGitAccount" # be VERY careful when plugging in your own testing account here...
|
13
|
+
@password = "plzdon'thackthetestaccount1" # It will delete ALL keys associated with that account if you run the tests
|
14
|
+
|
15
|
+
@sample_rsa = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDn74QR9yHb+hcid8iH3+FTaEwnKtwjttseJDbIA2PaivN2uvESrvHlp8Ss/cRox3fFu34QR5DpdOhlfULjTX7yKVuxhaNrAJaqg8rX8hgr9U1Botnyy1DBueEyyA3o1fxRkmwTf6FNnkt1BxWP635tD0lbmUubwaadXjQqPOf3Uw=="
|
16
|
+
|
17
|
+
VCR.use_cassette('instantiate_github_speaker') do
|
18
|
+
@github_speaker = Gas::GithubSpeaker.new(@user, @username, @password)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "test keys" do
|
23
|
+
|
24
|
+
describe "with no keys..." do
|
25
|
+
after :each do
|
26
|
+
delete_all_keys_in_github_account!(@github_speaker)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should post_key! all the way up to github" do
|
30
|
+
initial_length = 'VCR introduces scope =('
|
31
|
+
final_length = ''
|
32
|
+
|
33
|
+
VCR.use_cassette('get_keys-find_none') do
|
34
|
+
initial_length = get_keys(@username, @password).length
|
35
|
+
end
|
36
|
+
|
37
|
+
VCR.use_cassette('githubspeaker-post_key') do # this test has been saved under fixtures/install-delete-a-key.yml
|
38
|
+
@github_speaker.post_key! @sample_rsa
|
39
|
+
end
|
40
|
+
|
41
|
+
VCR.use_cassette('get_keys-find_one') do
|
42
|
+
final_length = get_keys(@username, @password).length
|
43
|
+
end
|
44
|
+
|
45
|
+
(final_length - initial_length).should be(1)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should expose an empty array when no keys..." do
|
49
|
+
VCR.use_cassette('check_keys-empty') do
|
50
|
+
@github_speaker.keys.empty?.should be_true
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should expose a key created..." do
|
55
|
+
VCR.use_cassette('github_speaker-post_key') do
|
56
|
+
@github_speaker.post_key! @sample_rsa
|
57
|
+
end
|
58
|
+
|
59
|
+
@github_speaker.keys.empty?.should be_false
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "with a key" do
|
64
|
+
before :each do
|
65
|
+
VCR.use_cassette('github_speaker-post_key') do
|
66
|
+
@github_speaker.post_key! @sample_rsa
|
67
|
+
end
|
68
|
+
|
69
|
+
@key_id = @github_speaker.keys.first['id']
|
70
|
+
end
|
71
|
+
|
72
|
+
after :each do
|
73
|
+
delete_all_keys_in_github_account!(@github_speaker)
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should remove_key! from github" do
|
77
|
+
initial_length = ''
|
78
|
+
final_length = ''
|
79
|
+
|
80
|
+
VCR.use_cassette('get_keys-find_one') do
|
81
|
+
initial_length = get_keys(@username, @password).length
|
82
|
+
end
|
83
|
+
|
84
|
+
VCR.use_cassette('githubspeaker-remove_key') do
|
85
|
+
@github_speaker.remove_key! @sample_rsa
|
86
|
+
end
|
87
|
+
|
88
|
+
VCR.use_cassette('get_keys-find_none') do
|
89
|
+
final_length = get_keys(@username, @password).length
|
90
|
+
end
|
91
|
+
|
92
|
+
(final_length - initial_length).should be(-1)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should remove a key from @keys" do
|
96
|
+
#require 'pry';binding.pry
|
97
|
+
Gas::GithubSpeaker.publicize_methods do
|
98
|
+
@github_speaker.remove_key_from_keys @key_id
|
99
|
+
end
|
100
|
+
|
101
|
+
@github_speaker.keys.empty?.should be_true
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require './spec/spec_helper'
|
2
|
+
|
3
|
+
require './lib/gas'
|
4
|
+
|
5
|
+
describe Gas::Settings do
|
6
|
+
|
7
|
+
before(:all) do
|
8
|
+
@subject = Gas::Settings.new
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should respond to base_dir' do
|
12
|
+
@subject.should respond_to :base_dir
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'should give default value for base_dir' do
|
16
|
+
@subject.base_dir.should == '~'
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should respond to gas_dir' do
|
20
|
+
@subject.should respond_to :gas_dir
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'should give default value for gas_dir' do
|
24
|
+
@subject.gas_dir.should == "#{@subject.base_dir}/.gas"
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'should respond to ssh_dir' do
|
28
|
+
@subject.should respond_to :ssh_dir
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should give default value for ssh_dir' do
|
32
|
+
@subject.ssh_dir.should == "#{@subject.base_dir}/.ssh"
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should respond to github_server' do
|
36
|
+
@subject.should respond_to :github_server
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'should give default value for github_server' do
|
40
|
+
@subject.github_server.should == 'api.github.com'
|
41
|
+
end
|
42
|
+
|
43
|
+
it 'should be configurable' do
|
44
|
+
@subject.configure do |s|
|
45
|
+
s.base_dir = 'test'
|
46
|
+
s.gas_dir = 'foo'
|
47
|
+
s.ssh_dir = 'bar'
|
48
|
+
s.github_server = 'foobar'
|
49
|
+
end
|
50
|
+
@subject.base_dir.should eq 'test'
|
51
|
+
@subject.gas_dir.should eq "#{@subject.base_dir}/foo"
|
52
|
+
@subject.ssh_dir.should eq "#{@subject.base_dir}/bar"
|
53
|
+
@subject.github_server.should eq 'foobar'
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require './spec/spec_helper'
|
2
|
+
|
3
|
+
require './lib/gas'
|
4
|
+
|
5
|
+
describe Gas::User do
|
6
|
+
it 'should output in the right format' do
|
7
|
+
name = 'Fredrik Wallgren'
|
8
|
+
email = 'fredrik.wallgren@gmail.com'
|
9
|
+
nickname = 'walle'
|
10
|
+
user = Gas::User.new name, email, nickname
|
11
|
+
user.to_s.should == " [#{nickname}]\n name = #{name}\n email = #{email}"
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'should output a git user in the right format' do
|
15
|
+
name = 'Fredrik Wallgren'
|
16
|
+
email = 'fredrik.wallgren@gmail.com'
|
17
|
+
user = Gas::User.new name, email
|
18
|
+
user.git_user.should == " [user]\n name = #{name}\n email = #{email}"
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'should be able to have a nickname' do
|
22
|
+
name = 'Fredrik Wallgren'
|
23
|
+
email = 'fredrik.wallgren@gmail.com'
|
24
|
+
nickname = 'walle'
|
25
|
+
user = Gas::User.new name, email, nickname
|
26
|
+
user.nickname.should == nickname
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,230 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple_gas
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.9
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Fredrik Wallgren
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: thor
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.14.6
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.14.6
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: sshkey
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 1.2.2
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 1.2.2
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: highline
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: json
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: bundler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rr
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: vcr
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
none: false
|
146
|
+
requirements:
|
147
|
+
- - ! '>='
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '0'
|
150
|
+
type: :development
|
151
|
+
prerelease: false
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
none: false
|
154
|
+
requirements:
|
155
|
+
- - ! '>='
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: pry
|
160
|
+
requirement: !ruby/object:Gem::Requirement
|
161
|
+
none: false
|
162
|
+
requirements:
|
163
|
+
- - ! '>='
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :development
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
description: Gas is a utility to keep track of your git authors. Add them to gas and
|
175
|
+
switch at any time. Great if you use one author at work and one at home or if you
|
176
|
+
are doing pair programming. Includes SSH support.
|
177
|
+
email: fredrik.wallgren@gmail.com
|
178
|
+
executables:
|
179
|
+
- gas
|
180
|
+
extensions: []
|
181
|
+
extra_rdoc_files:
|
182
|
+
- README.textile
|
183
|
+
- LICENSE
|
184
|
+
files:
|
185
|
+
- bin/gas
|
186
|
+
- lib/gas/config.rb
|
187
|
+
- lib/gas/gitconfig.rb
|
188
|
+
- lib/gas/github_speaker.rb
|
189
|
+
- lib/gas/prompter.rb
|
190
|
+
- lib/gas/settings.rb
|
191
|
+
- lib/gas/ssh.rb
|
192
|
+
- lib/gas/user.rb
|
193
|
+
- lib/gas/version.rb
|
194
|
+
- lib/gas.rb
|
195
|
+
- spec/integration/ssh_spec.rb
|
196
|
+
- spec/spec_helper.rb
|
197
|
+
- spec/unit/config_spec.rb
|
198
|
+
- spec/unit/gitconfig_spec.rb
|
199
|
+
- spec/unit/github_speaker_spec.rb
|
200
|
+
- spec/unit/settings_spec.rb
|
201
|
+
- spec/unit/user_spec.rb
|
202
|
+
- LICENSE
|
203
|
+
- README.textile
|
204
|
+
homepage: https://github.com/anhkind/gas
|
205
|
+
licenses: []
|
206
|
+
post_install_message:
|
207
|
+
rdoc_options:
|
208
|
+
- --charset=UTF-8
|
209
|
+
require_paths:
|
210
|
+
- - lib
|
211
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
none: false
|
213
|
+
requirements:
|
214
|
+
- - ! '>='
|
215
|
+
- !ruby/object:Gem::Version
|
216
|
+
version: '0'
|
217
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
218
|
+
none: false
|
219
|
+
requirements:
|
220
|
+
- - ! '>='
|
221
|
+
- !ruby/object:Gem::Version
|
222
|
+
version: '0'
|
223
|
+
requirements: []
|
224
|
+
rubyforge_project: simple_gas
|
225
|
+
rubygems_version: 1.8.24
|
226
|
+
signing_key:
|
227
|
+
specification_version: 3
|
228
|
+
summary: Manage your git author accounts
|
229
|
+
test_files: []
|
230
|
+
has_rdoc:
|