gas 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -8,14 +8,14 @@ describe Gas::User do
8
8
  email = 'fredrik.wallgren@gmail.com'
9
9
  nickname = 'walle'
10
10
  user = Gas::User.new name, email, nickname
11
- user.to_s.should == "[#{nickname}]\n name = #{name}\n email = #{email}"
11
+ user.to_s.should == " [#{nickname}]\n name = #{name}\n email = #{email}"
12
12
  end
13
13
 
14
14
  it 'should output a git user in the right format' do
15
15
  name = 'Fredrik Wallgren'
16
16
  email = 'fredrik.wallgren@gmail.com'
17
17
  user = Gas::User.new name, email
18
- user.git_user.should == "[user]\n name = #{name}\n email = #{email}"
18
+ user.git_user.should == " [user]\n name = #{name}\n email = #{email}"
19
19
  end
20
20
 
21
21
  it 'should be able to have a nickname' do
@@ -1,5 +1,6 @@
1
1
  # encoding: utf-8
2
2
 
3
+
3
4
  RSpec.configure do |config|
4
5
  config.mock_with :rr
5
6
  end
@@ -12,3 +13,75 @@ def mock_cli_call(mock_object, command)
12
13
  # To be able to mock ` (http://blog.astrails.com/2010/7/5/how-to-mock-backticks-operator-in-your-test-specs-using-rr)
13
14
  mock(mock_object).__double_definition_create__.call(:`, command) { yield }
14
15
  end
16
+
17
+
18
+ def move_the_testers_personal_ssh_key_out_of_way
19
+ if File.exists?(SSH_DIRECTORY + "/id_rsa")
20
+ @pattern_to_restore_privl = File.open(SSH_DIRECTORY + "/id_rsa","r").read # this test requires some juggling of files that may already exist.
21
+ File.open(GAS_DIRECTORY + "/temp_test","w+").puts @pattern_to_restore_privl
22
+ File.delete(SSH_DIRECTORY + "/id_rsa")
23
+ end
24
+
25
+ if File.exists?(SSH_DIRECTORY + "/id_rsa.pub")
26
+ @pattern_to_restore_publ = File.open(SSH_DIRECTORY + "/id_rsa.pub","r").read # We don't want to mess things up for the tester, so we will need to save these files and then delete them
27
+ File.open(GAS_DIRECTORY + "/temp_test.pub","w+").puts @pattern_to_restore_publ
28
+ File.delete(SSH_DIRECTORY + "/id_rsa.pub")
29
+ end
30
+
31
+ end
32
+
33
+ def restore_the_testers_ssh_key
34
+ if File.exists?(GAS_DIRECTORY + "/temp_test")
35
+ @pattern_to_restore_privl = File.open(GAS_DIRECTORY + "/temp_test","r").read # this test requires some juggling of files that may already exist.
36
+ File.open(SSH_DIRECTORY + "/id_rsa","w+").puts @pattern_to_restore_privl
37
+ File.delete(GAS_DIRECTORY + "/temp_test")
38
+ end
39
+
40
+ if File.exists?(GAS_DIRECTORY + "/temp_test.pub")
41
+ @pattern_to_restore_publ = File.open(GAS_DIRECTORY + "/temp_test.pub","r").read # We don't want to mess things up for the tester, so we will need to save these files and then delete them
42
+ File.open(SSH_DIRECTORY + "/id_rsa.pub","w+").puts @pattern_to_restore_publ
43
+ File.delete(GAS_DIRECTORY + "/temp_test.pub")
44
+ end
45
+ end
46
+
47
+
48
+ def clean_out_ssh_directory
49
+ if File.exists?(SSH_DIRECTORY + "/id_rsa")
50
+ File.delete(SSH_DIRECTORY + "/id_rsa")
51
+ end
52
+
53
+ if File.exists?(SSH_DIRECTORY + "/id_rsa.pub")
54
+ File.delete(SSH_DIRECTORY + "/id_rsa.pub")
55
+ end
56
+ end
57
+
58
+ def clean_out_gas_directory(nickname)
59
+ if File.exists?(GAS_DIRECTORY + "/#{nickname}_id_rsa")
60
+ File.delete(GAS_DIRECTORY + "/#{nickname}_id_rsa")
61
+ end
62
+
63
+ if File.exists?(SSH_DIRECTORY + "/#{nickname}_id_rsa.pub")
64
+ File.delete(@ssh_dir + "/#{nickname}_id_rsa.pub")
65
+ end
66
+ end
67
+
68
+
69
+ def create_user_no_git(nickname, name, email)
70
+ Gas::Ssh.stub!(:user_wants_gas_to_handle_rsa_keys?).and_return(true)
71
+ #Gas::Ssh.stub!(:user_wants_to_use_key_already_in_ssh?).and_return(false)
72
+ Gas::Ssh.stub!(:user_wants_to_install_key_to_github?).and_return(false)
73
+
74
+ Gas.add(nickname,name,email)
75
+
76
+ Gas::Ssh.unstub!(:user_wants_gas_to_handle_rsa_keys?)
77
+ #Gas::Ssh.unstub!(:user_wants_to_use_key_already_in_ssh?)
78
+ Gas::Ssh.unstub!(:user_wants_to_install_key_to_github?)
79
+ end
80
+
81
+ # toasts ssh keys for a given nickname and removal from gas.authors
82
+ def delete_user_no_git(nickname)
83
+
84
+ Gas.delete(nickname)
85
+
86
+ end
87
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-07-30 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2011-10-15 00:00:00.000000000Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: thor
17
- requirement: &21428080 !ruby/object:Gem::Requirement
16
+ requirement: &14036680 !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,32 @@ dependencies:
22
21
  version: 0.14.6
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *21428080
24
+ version_requirements: *14036680
25
+ - !ruby/object:Gem::Dependency
26
+ name: sshkey
27
+ requirement: &14032240 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: 1.2.2
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *14032240
36
+ - !ruby/object:Gem::Dependency
37
+ name: highline
38
+ requirement: &14030920 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *14030920
26
47
  - !ruby/object:Gem::Dependency
27
48
  name: rake
28
- requirement: &21427660 !ruby/object:Gem::Requirement
49
+ requirement: &14028160 !ruby/object:Gem::Requirement
29
50
  none: false
30
51
  requirements:
31
52
  - - ! '>='
@@ -33,10 +54,10 @@ dependencies:
33
54
  version: '0'
34
55
  type: :development
35
56
  prerelease: false
36
- version_requirements: *21427660
57
+ version_requirements: *14028160
37
58
  - !ruby/object:Gem::Dependency
38
59
  name: bundler
39
- requirement: &21427200 !ruby/object:Gem::Requirement
60
+ requirement: &14026440 !ruby/object:Gem::Requirement
40
61
  none: false
41
62
  requirements:
42
63
  - - ! '>='
@@ -44,10 +65,10 @@ dependencies:
44
65
  version: '0'
45
66
  type: :development
46
67
  prerelease: false
47
- version_requirements: *21427200
68
+ version_requirements: *14026440
48
69
  - !ruby/object:Gem::Dependency
49
70
  name: rspec
50
- requirement: &21426780 !ruby/object:Gem::Requirement
71
+ requirement: &14023560 !ruby/object:Gem::Requirement
51
72
  none: false
52
73
  requirements:
53
74
  - - ! '>='
@@ -55,10 +76,10 @@ dependencies:
55
76
  version: '0'
56
77
  type: :development
57
78
  prerelease: false
58
- version_requirements: *21426780
79
+ version_requirements: *14023560
59
80
  - !ruby/object:Gem::Dependency
60
81
  name: rr
61
- requirement: &21426360 !ruby/object:Gem::Requirement
82
+ requirement: &14022040 !ruby/object:Gem::Requirement
62
83
  none: false
63
84
  requirements:
64
85
  - - ! '>='
@@ -66,9 +87,10 @@ dependencies:
66
87
  version: '0'
67
88
  type: :development
68
89
  prerelease: false
69
- version_requirements: *21426360
90
+ version_requirements: *14022040
70
91
  description: Gas is a utility to keep track of your git authors. Add them to gas and
71
- switch at any time. Great if you use one author at work and one at home for instance.
92
+ switch at any time. Great if you use one author at work and one at home or if you
93
+ are doing pair programming. Includes SSH support.
72
94
  email: fredrik.wallgren@gmail.com
73
95
  executables:
74
96
  - gas
@@ -80,16 +102,17 @@ files:
80
102
  - bin/gas
81
103
  - lib/gas.rb
82
104
  - lib/gas/version.rb
105
+ - lib/gas/ssh.rb
83
106
  - lib/gas/user.rb
84
107
  - lib/gas/gitconfig.rb
85
108
  - lib/gas/config.rb
86
109
  - spec/spec_helper.rb
87
110
  - spec/gas/user_spec.rb
111
+ - spec/gas/ssh_spec.rb
88
112
  - spec/gas/config_spec.rb
89
113
  - spec/gas/gitconfig_spec.rb
90
114
  - LICENSE
91
115
  - README.textile
92
- has_rdoc: true
93
116
  homepage: https://github.com/walle/gas
94
117
  licenses: []
95
118
  post_install_message:
@@ -103,15 +126,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
103
126
  - - ! '>='
104
127
  - !ruby/object:Gem::Version
105
128
  version: '0'
129
+ segments:
130
+ - 0
131
+ hash: 3442034922902480779
106
132
  required_rubygems_version: !ruby/object:Gem::Requirement
107
133
  none: false
108
134
  requirements:
109
135
  - - ! '>='
110
136
  - !ruby/object:Gem::Version
111
137
  version: '0'
138
+ segments:
139
+ - 0
140
+ hash: 3442034922902480779
112
141
  requirements: []
113
142
  rubyforge_project: gas
114
- rubygems_version: 1.6.2
143
+ rubygems_version: 1.8.6
115
144
  signing_key:
116
145
  specification_version: 3
117
146
  summary: Manage your git author accounts