stephencelis-ghi 0.1.6 → 0.1.7
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/History.rdoc +8 -0
- data/lib/ghi.rb +1 -1
- data/lib/ghi/cli.rb +5 -3
- data/spec/ghi/cli_spec.rb +146 -136
- metadata +3 -4
data/History.rdoc
CHANGED
data/lib/ghi.rb
CHANGED
data/lib/ghi/cli.rb
CHANGED
@@ -209,9 +209,11 @@ module GHI::CLI #:nodoc:
|
|
209
209
|
@args, @argv = argv, argv.dup
|
210
210
|
|
211
211
|
remotes = `git config --get-regexp remote\..+\.url`.split /\n/
|
212
|
-
repo_expression = %r{([^:/]+)/([
|
213
|
-
remotes.find { |r| r.include? "github.com" }
|
214
|
-
|
212
|
+
repo_expression = %r{([^:/]+)/([^/\s]+)(?:\.git)$}
|
213
|
+
if remote = remotes.find { |r| r.include? "github.com" }
|
214
|
+
remote.match repo_expression
|
215
|
+
@user, @repo = $1, $2
|
216
|
+
end
|
215
217
|
|
216
218
|
option_parser.parse!(*args)
|
217
219
|
|
data/spec/ghi/cli_spec.rb
CHANGED
@@ -19,7 +19,6 @@ describe GHI::CLI::Executable do
|
|
19
19
|
end
|
20
20
|
|
21
21
|
after :each do
|
22
|
-
@cli.stub!(:`).and_return "stub@github.com:localuser/ghi.git"
|
23
22
|
@cli.should_receive(@action)
|
24
23
|
@cli.parse! @args
|
25
24
|
@cli.action.should == @action
|
@@ -38,175 +37,186 @@ describe GHI::CLI::Executable do
|
|
38
37
|
end
|
39
38
|
end
|
40
39
|
|
41
|
-
it "should parse -
|
42
|
-
@args = ["-l"]
|
43
|
-
@action, @state = :list, :open
|
40
|
+
it "should always parse -r" do
|
41
|
+
@args = ["-rremoteuser/remoterepo", "-l"]
|
42
|
+
@action, @state, @user, @repo = :list, :open, "remoteuser", "remoterepo"
|
44
43
|
end
|
45
44
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
45
|
+
describe "inside a repository" do
|
46
|
+
after :each do
|
47
|
+
@cli.stub!(:`).and_return "stub@github.com:localuser/ghi.git"
|
48
|
+
end
|
50
49
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
50
|
+
it "should parse -l as list open" do
|
51
|
+
@args = ["-l"]
|
52
|
+
@action, @state = :list, :open
|
53
|
+
end
|
55
54
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
55
|
+
it "should parse -lo as list open" do
|
56
|
+
@args = ["-lo"]
|
57
|
+
@action, @state = :list, :open
|
58
|
+
end
|
60
59
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
it "should parse -lc as list closed" do
|
61
|
+
@args = ["-lc"]
|
62
|
+
@action, @state = :list, :closed
|
63
|
+
end
|
65
64
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
65
|
+
it "should parse -l2 as show issue 2" do
|
66
|
+
@args = ["-l2"]
|
67
|
+
@action, @number = :show, 2
|
68
|
+
end
|
70
69
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
70
|
+
it "should parse -l 'term' as search open for 'term'" do
|
71
|
+
@args = ["-l", "term"]
|
72
|
+
@action, @state, @term = :search, :open, "term"
|
73
|
+
end
|
75
74
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
75
|
+
it "should parse -o as open new issue" do
|
76
|
+
@args = ["-o"]
|
77
|
+
@action = :open
|
78
|
+
end
|
80
79
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
80
|
+
it "should parse -o 'New Issue' as open issue with title 'New Issue'" do
|
81
|
+
@args = ["-o", "New Issue"]
|
82
|
+
@action, @title = :open, "New Issue"
|
83
|
+
end
|
85
84
|
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
85
|
+
it "should parse -om 'New Issue' as open issue with'New Issue'" do
|
86
|
+
@args = ["-om", "New Issue"]
|
87
|
+
@action, @title = :open, "New Issue"
|
88
|
+
end
|
90
89
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
90
|
+
it "should parse -o 'New Issue' -m as open 'New Issue' in $EDITOR" do
|
91
|
+
@args = ["-o", "New Issue", "-m"]
|
92
|
+
@action, @title, @commenting = :open, "New Issue", true
|
93
|
+
end
|
95
94
|
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
it "should parse -o 'Issue' -m 'Body' as open 'Issue' with 'Body'" do
|
96
|
+
@args = ["-o", "Issue", "-m", "Body"]
|
97
|
+
@action, @title, @body = :open, "Issue", "Body"
|
98
|
+
end
|
100
99
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
100
|
+
it "should parse -o2 as reopen issue 2" do
|
101
|
+
@args = ["-o2"]
|
102
|
+
@action, @number = :reopen, 2
|
103
|
+
end
|
105
104
|
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
105
|
+
it "should parse -o2 -m as reopen issue 2 with a comment" do
|
106
|
+
@args = ["-o2", "-m"]
|
107
|
+
@action, @number, @commenting = :reopen, 2, true
|
108
|
+
end
|
110
109
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
110
|
+
it "should parse -o2 -m 'Comment' as reopen issue 2" do
|
111
|
+
@args = ["-o2", "-m", "Comment"]
|
112
|
+
@action, @number, @body = :reopen, 2, "Comment"
|
113
|
+
end
|
115
114
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
115
|
+
it "should parse -ol as list open" do
|
116
|
+
@args = ["-ol"]
|
117
|
+
@action, @state = :list, :open
|
118
|
+
end
|
120
119
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
it "should parse -ou as return open issues url" do
|
121
|
+
@args = ["-ou"]
|
122
|
+
@action = :url # Should state be :open?
|
123
|
+
end
|
125
124
|
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
125
|
+
it "should parse -cl as list closed" do
|
126
|
+
@args = ["-cl"]
|
127
|
+
@action, @state = :list, :closed
|
128
|
+
end
|
130
129
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
130
|
+
it "should parse -c2 as close issue 2" do
|
131
|
+
@args = ["-c2"]
|
132
|
+
@action, @number = :close, 2
|
133
|
+
end
|
135
134
|
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
135
|
+
it "should parse -c2 -m as close issue 2 with a comment" do
|
136
|
+
@args = ["-c2", "-m"]
|
137
|
+
@action, @number, @commenting = :close, 2, true
|
138
|
+
end
|
140
139
|
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
140
|
+
it "should parse -c2 -m 'Fixed' as close issue 2 with 'Fixed'" do
|
141
|
+
@args = ["-c2", "-m", "Fixed"]
|
142
|
+
@action, @number, @body = :close, 2, "Fixed"
|
143
|
+
end
|
145
144
|
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
145
|
+
it "should parse -m2 -c as close issue 2 with a comment" do
|
146
|
+
@args = ["-m2", "-c"]
|
147
|
+
@action, @number, @commenting = :close, 2, true
|
148
|
+
end
|
150
149
|
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
end
|
150
|
+
it "should parse -cu as return closed issues url" do
|
151
|
+
@args = ["-cu"]
|
152
|
+
@action, @state = :url, :closed
|
153
|
+
end
|
156
154
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
155
|
+
it "should parse -e2 as edit issue 2" do
|
156
|
+
@args = ["-e2"]
|
157
|
+
@action, @number = :edit, 2
|
158
|
+
end
|
161
159
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
160
|
+
it "should parse -rlocalrepo as localuser/localrepo" do
|
161
|
+
GHI.stub!(:login).and_return "localuser"
|
162
|
+
@args = ["-rlocalrepo", "-l"]
|
163
|
+
@action, @state, @user, @repo = :list, :open, "localuser", "localrepo"
|
164
|
+
end
|
166
165
|
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
166
|
+
it "should parse -rremoteuser/remoterepo as remoteuser/remoterepo" do
|
167
|
+
@args = ["-rremoteuser/remoterepo", "-l"]
|
168
|
+
@action, @state, @user, @repo = :list, :open, "remoteuser", "remoterepo"
|
169
|
+
end
|
171
170
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
171
|
+
it "should parse -rremoteuser/remoterepo as a later argument" do
|
172
|
+
@args = ["-1", "-rremoteuser/remoterepo"]
|
173
|
+
@action, @number, @user, @repo = :show, 1, "remoteuser", "remoterepo"
|
174
|
+
end
|
176
175
|
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
176
|
+
it "should parse -t2 'tag' as label issue 2 with 'tag'" do
|
177
|
+
@args = ["-t2", "tag"]
|
178
|
+
@action, @number, @tag = :label, 2, "tag"
|
179
|
+
end
|
181
180
|
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
181
|
+
it "should parse -d2 'tag' as remove label 'tag' from issue 2" do
|
182
|
+
@args = ["-d2", "tag"]
|
183
|
+
@action, @number, @tag = :unlabel, 2, "tag"
|
184
|
+
end
|
186
185
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
186
|
+
it "should parse -m2 as comment on issue 2" do
|
187
|
+
@args = ["-m2"]
|
188
|
+
@action, @number, @commenting = :comment, 2, true
|
189
|
+
end
|
191
190
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
191
|
+
it "should parse -m2 'Comment' as comment 'Comment' on issue 2" do
|
192
|
+
@args = ["-m2", "Comment"]
|
193
|
+
@action, @number, @body = :comment, 2, "Comment"
|
194
|
+
end
|
196
195
|
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
196
|
+
it "should parse -u as return open issues url" do
|
197
|
+
@args = ["-u"]
|
198
|
+
@action = :url # Should state be :open?
|
199
|
+
end
|
201
200
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
201
|
+
it "should parse -uo as return open issues url" do
|
202
|
+
@args = ["-uo"]
|
203
|
+
@action = :url # Should state be :open?
|
204
|
+
end
|
206
205
|
|
207
|
-
|
208
|
-
|
209
|
-
|
206
|
+
it "should parse -uc as return open issues url" do
|
207
|
+
@args = ["-uc"]
|
208
|
+
@action, @state = :url, :closed
|
209
|
+
end
|
210
|
+
|
211
|
+
it "should parse -u2 as return issue 2 url" do
|
212
|
+
@args = ["-u2"]
|
213
|
+
@action, @number = :url, 2
|
214
|
+
end
|
215
|
+
|
216
|
+
it "should parse -uu as return unread issues url" do
|
217
|
+
@args = ["-uu"]
|
218
|
+
@action, @state = :url, :unread
|
219
|
+
end
|
210
220
|
end
|
211
221
|
end
|
212
222
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stephencelis-ghi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Celis
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-08-26 00:00:00 -07:00
|
13
13
|
default_executable: ghi
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -39,7 +39,6 @@ files:
|
|
39
39
|
- spec/ghi_spec.rb
|
40
40
|
has_rdoc: true
|
41
41
|
homepage: http://github.com/stephencelis/ghi
|
42
|
-
licenses:
|
43
42
|
post_install_message:
|
44
43
|
rdoc_options:
|
45
44
|
- --main
|
@@ -61,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
60
|
requirements: []
|
62
61
|
|
63
62
|
rubyforge_project: ghi
|
64
|
-
rubygems_version: 1.
|
63
|
+
rubygems_version: 1.2.0
|
65
64
|
signing_key:
|
66
65
|
specification_version: 3
|
67
66
|
summary: GitHub Issues on the command line
|