stephencelis-ghi 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/History.rdoc CHANGED
@@ -1,3 +1,11 @@
1
+ === 0.1.7 / 2009-08-26
2
+
3
+ * 2 bugfixes
4
+
5
+ * Allow dots in repo names.
6
+ * Fix bug preventing invocation from non-GitHub repo directories.
7
+
8
+
1
9
  === 0.1.6 / 2009-08-05
2
10
 
3
11
  * 1 minor enhancement
data/lib/ghi.rb CHANGED
@@ -2,7 +2,7 @@ require "net/http"
2
2
  require "yaml"
3
3
 
4
4
  module GHI
5
- VERSION = "0.1.6"
5
+ VERSION = "0.1.7"
6
6
 
7
7
  class << self
8
8
  def login
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{([^:/]+)/([^/\.\s]+)(?:\.git)?$}
213
- remotes.find { |r| r.include? "github.com" }.match repo_expression
214
- @user, @repo = $1, $2
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 -l as list open" do
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
- it "should parse -lo as list open" do
47
- @args = ["-lo"]
48
- @action, @state = :list, :open
49
- end
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
- it "should parse -lc as list closed" do
52
- @args = ["-lc"]
53
- @action, @state = :list, :closed
54
- end
50
+ it "should parse -l as list open" do
51
+ @args = ["-l"]
52
+ @action, @state = :list, :open
53
+ end
55
54
 
56
- it "should parse -l2 as show issue 2" do
57
- @args = ["-l2"]
58
- @action, @number = :show, 2
59
- end
55
+ it "should parse -lo as list open" do
56
+ @args = ["-lo"]
57
+ @action, @state = :list, :open
58
+ end
60
59
 
61
- it "should parse -l 'term' as search open for 'term'" do
62
- @args = ["-l", "term"]
63
- @action, @state, @term = :search, :open, "term"
64
- end
60
+ it "should parse -lc as list closed" do
61
+ @args = ["-lc"]
62
+ @action, @state = :list, :closed
63
+ end
65
64
 
66
- it "should parse -o as open new issue" do
67
- @args = ["-o"]
68
- @action = :open
69
- end
65
+ it "should parse -l2 as show issue 2" do
66
+ @args = ["-l2"]
67
+ @action, @number = :show, 2
68
+ end
70
69
 
71
- it "should parse -o 'New Issue' as open issue with title 'New Issue'" do
72
- @args = ["-o", "New Issue"]
73
- @action, @title = :open, "New Issue"
74
- end
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
- it "should parse -om 'New Issue' as open issue with'New Issue'" do
77
- @args = ["-om", "New Issue"]
78
- @action, @title = :open, "New Issue"
79
- end
75
+ it "should parse -o as open new issue" do
76
+ @args = ["-o"]
77
+ @action = :open
78
+ end
80
79
 
81
- it "should parse -o 'New Issue' -m as open 'New Issue' in $EDITOR" do
82
- @args = ["-o", "New Issue", "-m"]
83
- @action, @title, @commenting = :open, "New Issue", true
84
- end
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
- it "should parse -o 'Issue' -m 'Body' as open 'Issue' with 'Body'" do
87
- @args = ["-o", "Issue", "-m", "Body"]
88
- @action, @title, @body = :open, "Issue", "Body"
89
- end
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
- it "should parse -o2 as reopen issue 2" do
92
- @args = ["-o2"]
93
- @action, @number = :reopen, 2
94
- end
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
- it "should parse -o2 -m as reopen issue 2 with a comment" do
97
- @args = ["-o2", "-m"]
98
- @action, @number, @commenting = :reopen, 2, true
99
- end
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
- it "should parse -o2 -m 'Comment' as reopen issue 2" do
102
- @args = ["-o2", "-m", "Comment"]
103
- @action, @number, @body = :reopen, 2, "Comment"
104
- end
100
+ it "should parse -o2 as reopen issue 2" do
101
+ @args = ["-o2"]
102
+ @action, @number = :reopen, 2
103
+ end
105
104
 
106
- it "should parse -ol as list open" do
107
- @args = ["-ol"]
108
- @action, @state = :list, :open
109
- end
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
- it "should parse -ou as return open issues url" do
112
- @args = ["-ou"]
113
- @action = :url # Should state be :open?
114
- end
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
- it "should parse -cl as list closed" do
117
- @args = ["-cl"]
118
- @action, @state = :list, :closed
119
- end
115
+ it "should parse -ol as list open" do
116
+ @args = ["-ol"]
117
+ @action, @state = :list, :open
118
+ end
120
119
 
121
- it "should parse -c2 as close issue 2" do
122
- @args = ["-c2"]
123
- @action, @number = :close, 2
124
- end
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
- it "should parse -c2 -m as close issue 2 with a comment" do
127
- @args = ["-c2", "-m"]
128
- @action, @number, @commenting = :close, 2, true
129
- end
125
+ it "should parse -cl as list closed" do
126
+ @args = ["-cl"]
127
+ @action, @state = :list, :closed
128
+ end
130
129
 
131
- it "should parse -c2 -m 'Fixed' as close issue 2 with 'Fixed'" do
132
- @args = ["-c2", "-m", "Fixed"]
133
- @action, @number, @body = :close, 2, "Fixed"
134
- end
130
+ it "should parse -c2 as close issue 2" do
131
+ @args = ["-c2"]
132
+ @action, @number = :close, 2
133
+ end
135
134
 
136
- it "should parse -m2 -c as close issue 2 with a comment" do
137
- @args = ["-m2", "-c"]
138
- @action, @number, @commenting = :close, 2, true
139
- end
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
- it "should parse -cu as return closed issues url" do
142
- @args = ["-cu"]
143
- @action, @state = :url, :closed
144
- end
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
- it "should parse -e2 as edit issue 2" do
147
- @args = ["-e2"]
148
- @action, @number = :edit, 2
149
- end
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
- it "should parse -rlocalrepo as localuser/localrepo" do
152
- GHI.stub!(:login).and_return "localuser"
153
- @args = ["-rlocalrepo", "-l"]
154
- @action, @state, @user, @repo = :list, :open, "localuser", "localrepo"
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
- it "should parse -rremoteuser/remoterepo as remoteuser/remoterepo" do
158
- @args = ["-rremoteuser/remoterepo", "-l"]
159
- @action, @state, @user, @repo = :list, :open, "remoteuser", "remoterepo"
160
- end
155
+ it "should parse -e2 as edit issue 2" do
156
+ @args = ["-e2"]
157
+ @action, @number = :edit, 2
158
+ end
161
159
 
162
- it "should parse -rremoteuser/remoterepo as a later argument" do
163
- @args = ["-1", "-rremoteuser/remoterepo"]
164
- @action, @number, @user, @repo = :show, 1, "remoteuser", "remoterepo"
165
- end
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
- it "should parse -t2 'tag' as label issue 2 with 'tag'" do
168
- @args = ["-t2", "tag"]
169
- @action, @number, @tag = :label, 2, "tag"
170
- end
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
- it "should parse -d2 'tag' as remove label 'tag' from issue 2" do
173
- @args = ["-d2", "tag"]
174
- @action, @number, @tag = :unlabel, 2, "tag"
175
- end
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
- it "should parse -m2 as comment on issue 2" do
178
- @args = ["-m2"]
179
- @action, @number, @commenting = :comment, 2, true
180
- end
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
- it "should parse -m2 'Comment' as comment 'Comment' on issue 2" do
183
- @args = ["-m2", "Comment"]
184
- @action, @number, @body = :comment, 2, "Comment"
185
- end
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
- it "should parse -u as return open issues url" do
188
- @args = ["-u"]
189
- @action = :url # Should state be :open?
190
- end
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
- it "should parse -uo as return open issues url" do
193
- @args = ["-uo"]
194
- @action = :url # Should state be :open?
195
- end
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
- it "should parse -uc as return open issues url" do
198
- @args = ["-uc"]
199
- @action, @state = :url, :closed
200
- end
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
- it "should parse -u2 as return issue 2 url" do
203
- @args = ["-u2"]
204
- @action, @number = :url, 2
205
- end
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
- it "should parse -uu as return unread issues url" do
208
- @args = ["-uu"]
209
- @action, @state = :url, :unread
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.6
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-07-08 00:00:00 -07:00
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.3.5
63
+ rubygems_version: 1.2.0
65
64
  signing_key:
66
65
  specification_version: 3
67
66
  summary: GitHub Issues on the command line