github 0.5.0 → 0.6.0
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/Gemfile.lock +1 -5
- data/History.txt +8 -2
- data/README.md +1 -1
- data/lib/commands/helpers.rb +1 -1
- data/lib/github/command.rb +24 -4
- data/lib/github/version.rb +1 -1
- data/spec/command_spec.rb +29 -9
- metadata +36 -28
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
github (0.
|
4
|
+
github (0.6.0)
|
5
5
|
highline (~> 1.5.1)
|
6
6
|
json (~> 1.4.6)
|
7
7
|
launchy (~> 0.3.7)
|
@@ -31,9 +31,5 @@ PLATFORMS
|
|
31
31
|
DEPENDENCIES
|
32
32
|
activerecord (~> 2.3.10)
|
33
33
|
github!
|
34
|
-
highline (~> 1.5.1)
|
35
|
-
json (~> 1.4.6)
|
36
|
-
launchy (~> 0.3.7)
|
37
34
|
rake
|
38
35
|
rspec (~> 1.3.1)
|
39
|
-
text-format (= 1.0.0)
|
data/History.txt
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
+
== 0.6.0
|
2
|
+
|
3
|
+
* If credentials not setup, then user prompted for them
|
4
|
+
* Corrected the "gem source --add" call [kedarmhaswade]
|
5
|
+
* Verify network-cache is non-empty [bfroehle]
|
6
|
+
|
1
7
|
== 0.5.0 2011-1-17
|
2
8
|
|
3
|
-
* Support for ruby 1.9.2 [
|
4
|
-
* Clean fail if haven't setup github config yet [
|
9
|
+
* Support for ruby 1.9.2 [keithpitt]
|
10
|
+
* Clean fail if haven't setup github config yet [keithpitt]
|
5
11
|
|
6
12
|
== 0.4.6 2010-11-04
|
7
13
|
|
data/README.md
CHANGED
data/lib/commands/helpers.rb
CHANGED
data/lib/github/command.rb
CHANGED
@@ -69,20 +69,40 @@ module GitHub
|
|
69
69
|
def github_user
|
70
70
|
user = git("config --get github.user")
|
71
71
|
if user.empty?
|
72
|
-
|
72
|
+
request_github_credentials
|
73
|
+
user = github_user
|
73
74
|
end
|
74
|
-
|
75
75
|
user
|
76
76
|
end
|
77
77
|
|
78
78
|
def github_token
|
79
79
|
token = git("config --get github.token")
|
80
80
|
if token.empty?
|
81
|
-
|
81
|
+
request_github_credentials
|
82
|
+
token = github_token
|
82
83
|
end
|
83
|
-
|
84
84
|
token
|
85
85
|
end
|
86
|
+
|
87
|
+
def request_github_credentials
|
88
|
+
puts "Please enter your GitHub credentials:"
|
89
|
+
user = highline.ask("Username: ") while user.nil? || user.empty?
|
90
|
+
|
91
|
+
git("config --global github.user '#{user}'")
|
92
|
+
puts("Your account token is at https://github.com/account under 'Account Admin'.")
|
93
|
+
puts("Press Enter to launch page in browser.")
|
94
|
+
token = highline.ask("Token: ")
|
95
|
+
while token.strip.empty?
|
96
|
+
helper.open "https://github.com/account"
|
97
|
+
token = highline.ask("Token: ")
|
98
|
+
end
|
99
|
+
git("config --global github.token '#{token}'")
|
100
|
+
true
|
101
|
+
end
|
102
|
+
|
103
|
+
def highline
|
104
|
+
@highline ||= HighLine.new
|
105
|
+
end
|
86
106
|
|
87
107
|
def shell_user
|
88
108
|
ENV['USER']
|
data/lib/github/version.rb
CHANGED
data/spec/command_spec.rb
CHANGED
@@ -79,18 +79,38 @@ describe GitHub::Command do
|
|
79
79
|
@command.should_receive(:exit!).once
|
80
80
|
@command.die "message"
|
81
81
|
end
|
82
|
-
|
83
|
-
it "
|
84
|
-
@command.should_receive(:git).once.with("config --get github.
|
85
|
-
@command.should_receive(:puts).once.with("
|
86
|
-
|
87
|
-
|
82
|
+
|
83
|
+
it "requests github API credentials if not found" do
|
84
|
+
@command.should_receive(:git).once.with("config --get github.user").and_return("")
|
85
|
+
@command.should_receive(:puts).once.with("Please enter your GitHub credentials:")
|
86
|
+
h = mock("HighLine")
|
87
|
+
h.should_receive(:ask).once.with("Username: ").and_return("drnic")
|
88
|
+
@command.should_receive(:puts).once.with("Your account token is at https://github.com/account under 'Account Admin'.")
|
89
|
+
@command.should_receive(:puts).once.with("Press Enter to launch page in browser.")
|
90
|
+
h.should_receive(:ask).once.with("Token: ").and_return("TOKEN")
|
91
|
+
@command.should_receive(:highline).twice.and_return(h)
|
92
|
+
@command.should_receive(:git).once.with("config --global github.user 'drnic'")
|
93
|
+
@command.should_receive(:git).once.with("config --global github.token 'TOKEN'")
|
94
|
+
@command.should_receive(:git).once.with("config --get github.user").and_return("drnic")
|
95
|
+
@command.github_user
|
88
96
|
end
|
89
97
|
|
90
|
-
it "
|
98
|
+
it "requests github API credentials if not found, and shows accounts page" do
|
91
99
|
@command.should_receive(:git).once.with("config --get github.user").and_return("")
|
92
|
-
@command.should_receive(:puts).once.with("
|
93
|
-
|
100
|
+
@command.should_receive(:puts).once.with("Please enter your GitHub credentials:")
|
101
|
+
h = mock("HighLine")
|
102
|
+
h.should_receive(:ask).once.with("Username: ").and_return("drnic")
|
103
|
+
@command.should_receive(:puts).once.with("Your account token is at https://github.com/account under 'Account Admin'.")
|
104
|
+
@command.should_receive(:puts).once.with("Press Enter to launch page in browser.")
|
105
|
+
h.should_receive(:ask).once.with("Token: ").and_return("")
|
106
|
+
helper = mock("GitHub::Helper")
|
107
|
+
helper.should_receive("open").once.with("https://github.com/account")
|
108
|
+
@command.should_receive(:helper).once.and_return(helper)
|
109
|
+
h.should_receive(:ask).once.with("Token: ").and_return("TOKEN")
|
110
|
+
@command.should_receive(:highline).any_number_of_times.and_return(h)
|
111
|
+
@command.should_receive(:git).once.with("config --global github.user 'drnic'")
|
112
|
+
@command.should_receive(:git).once.with("config --global github.token 'TOKEN'")
|
113
|
+
@command.should_receive(:git).once.with("config --get github.user").and_return("drnic")
|
94
114
|
@command.github_user
|
95
115
|
end
|
96
116
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
+
- 6
|
8
9
|
- 0
|
9
|
-
version: 0.
|
10
|
+
version: 0.6.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Chris Wanstrath
|
@@ -17,112 +18,119 @@ autorequire:
|
|
17
18
|
bindir: bin
|
18
19
|
cert_chain: []
|
19
20
|
|
20
|
-
date: 2011-01-
|
21
|
+
date: 2011-01-30 00:00:00 -08:00
|
21
22
|
default_executable:
|
22
23
|
dependencies:
|
23
24
|
- !ruby/object:Gem::Dependency
|
24
|
-
|
25
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
26
26
|
none: false
|
27
27
|
requirements:
|
28
28
|
- - "="
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 23
|
30
31
|
segments:
|
31
32
|
- 1
|
32
33
|
- 0
|
33
34
|
- 0
|
34
35
|
version: 1.0.0
|
35
36
|
type: :runtime
|
37
|
+
requirement: *id001
|
38
|
+
name: text-format
|
36
39
|
prerelease: false
|
37
|
-
version_requirements: *id001
|
38
40
|
- !ruby/object:Gem::Dependency
|
39
|
-
|
40
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
41
42
|
none: false
|
42
43
|
requirements:
|
43
44
|
- - ~>
|
44
45
|
- !ruby/object:Gem::Version
|
46
|
+
hash: 1
|
45
47
|
segments:
|
46
48
|
- 1
|
47
49
|
- 5
|
48
50
|
- 1
|
49
51
|
version: 1.5.1
|
50
52
|
type: :runtime
|
53
|
+
requirement: *id002
|
54
|
+
name: highline
|
51
55
|
prerelease: false
|
52
|
-
version_requirements: *id002
|
53
56
|
- !ruby/object:Gem::Dependency
|
54
|
-
|
55
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
58
|
none: false
|
57
59
|
requirements:
|
58
60
|
- - ~>
|
59
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 11
|
60
63
|
segments:
|
61
64
|
- 1
|
62
65
|
- 4
|
63
66
|
- 6
|
64
67
|
version: 1.4.6
|
65
68
|
type: :runtime
|
69
|
+
requirement: *id003
|
70
|
+
name: json
|
66
71
|
prerelease: false
|
67
|
-
version_requirements: *id003
|
68
72
|
- !ruby/object:Gem::Dependency
|
69
|
-
|
70
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
71
74
|
none: false
|
72
75
|
requirements:
|
73
76
|
- - ~>
|
74
77
|
- !ruby/object:Gem::Version
|
78
|
+
hash: 29
|
75
79
|
segments:
|
76
80
|
- 0
|
77
81
|
- 3
|
78
82
|
- 7
|
79
83
|
version: 0.3.7
|
80
84
|
type: :runtime
|
85
|
+
requirement: *id004
|
86
|
+
name: launchy
|
81
87
|
prerelease: false
|
82
|
-
version_requirements: *id004
|
83
88
|
- !ruby/object:Gem::Dependency
|
84
|
-
|
85
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
86
90
|
none: false
|
87
91
|
requirements:
|
88
92
|
- - ">="
|
89
93
|
- !ruby/object:Gem::Version
|
94
|
+
hash: 3
|
90
95
|
segments:
|
91
96
|
- 0
|
92
97
|
version: "0"
|
93
98
|
type: :development
|
99
|
+
requirement: *id005
|
100
|
+
name: rake
|
94
101
|
prerelease: false
|
95
|
-
version_requirements: *id005
|
96
102
|
- !ruby/object:Gem::Dependency
|
97
|
-
|
98
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
103
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
99
104
|
none: false
|
100
105
|
requirements:
|
101
106
|
- - ~>
|
102
107
|
- !ruby/object:Gem::Version
|
108
|
+
hash: 25
|
103
109
|
segments:
|
104
110
|
- 1
|
105
111
|
- 3
|
106
112
|
- 1
|
107
113
|
version: 1.3.1
|
108
114
|
type: :development
|
115
|
+
requirement: *id006
|
116
|
+
name: rspec
|
109
117
|
prerelease: false
|
110
|
-
version_requirements: *id006
|
111
118
|
- !ruby/object:Gem::Dependency
|
112
|
-
|
113
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
119
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
114
120
|
none: false
|
115
121
|
requirements:
|
116
122
|
- - ~>
|
117
123
|
- !ruby/object:Gem::Version
|
124
|
+
hash: 23
|
118
125
|
segments:
|
119
126
|
- 2
|
120
127
|
- 3
|
121
128
|
- 10
|
122
129
|
version: 2.3.10
|
123
130
|
type: :development
|
131
|
+
requirement: *id007
|
132
|
+
name: activerecord
|
124
133
|
prerelease: false
|
125
|
-
version_requirements: *id007
|
126
134
|
description: The official `github` command line helper for simplifying your GitHub experience.
|
127
135
|
email:
|
128
136
|
- drnicwilliams@gmail.com
|
@@ -194,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
194
202
|
requirements:
|
195
203
|
- - ">="
|
196
204
|
- !ruby/object:Gem::Version
|
197
|
-
hash:
|
205
|
+
hash: 3
|
198
206
|
segments:
|
199
207
|
- 0
|
200
208
|
version: "0"
|
@@ -203,14 +211,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
203
211
|
requirements:
|
204
212
|
- - ">="
|
205
213
|
- !ruby/object:Gem::Version
|
206
|
-
hash:
|
214
|
+
hash: 3
|
207
215
|
segments:
|
208
216
|
- 0
|
209
217
|
version: "0"
|
210
218
|
requirements: []
|
211
219
|
|
212
220
|
rubyforge_project: github
|
213
|
-
rubygems_version: 1.
|
221
|
+
rubygems_version: 1.4.2
|
214
222
|
signing_key:
|
215
223
|
specification_version: 3
|
216
224
|
summary: The official `github` command line helper for simplifying your GitHub experience.
|