github_cli 0.5.9 → 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/.travis.yml +1 -0
- data/CHANGELOG.md +12 -1
- data/Gemfile.lock +12 -10
- data/README.md +18 -0
- data/features/authorization.feature +53 -0
- data/features/blob.feature +1 -1
- data/features/download.feature +13 -11
- data/features/gist.feature +9 -1
- data/features/label.feature +11 -12
- data/features/member.feature +5 -4
- data/features/merging.feature +5 -4
- data/features/organization.feature +5 -4
- data/features/repository.feature +9 -1
- data/features/search.feature +5 -4
- data/github_cli.gemspec +1 -1
- data/lib/github_cli/api.rb +56 -49
- data/lib/github_cli/apis/assignee.rb +6 -6
- data/lib/github_cli/apis/authorization.rb +5 -5
- data/lib/github_cli/apis/blob.rb +6 -6
- data/lib/github_cli/apis/collaborator.rb +12 -12
- data/lib/github_cli/apis/commit.rb +6 -6
- data/lib/github_cli/apis/content.rb +9 -9
- data/lib/github_cli/apis/download.rb +15 -15
- data/lib/github_cli/apis/email.rb +9 -9
- data/lib/github_cli/apis/event.rb +24 -24
- data/lib/github_cli/apis/follower.rb +16 -15
- data/lib/github_cli/apis/fork.rb +6 -6
- data/lib/github_cli/apis/gist.rb +31 -30
- data/lib/github_cli/apis/hook.rb +6 -6
- data/lib/github_cli/apis/issue.rb +12 -12
- data/lib/github_cli/apis/key.rb +15 -15
- data/lib/github_cli/apis/label.rb +24 -26
- data/lib/github_cli/apis/member.rb +15 -27
- data/lib/github_cli/apis/merging.rb +3 -3
- data/lib/github_cli/apis/milestone.rb +15 -15
- data/lib/github_cli/apis/notification.rb +18 -18
- data/lib/github_cli/apis/organization.rb +9 -9
- data/lib/github_cli/apis/pull_request.rb +24 -24
- data/lib/github_cli/apis/reference.rb +15 -15
- data/lib/github_cli/apis/repository.rb +13 -12
- data/lib/github_cli/apis/search.rb +12 -12
- data/lib/github_cli/apis/starring.rb +15 -15
- data/lib/github_cli/apis/status.rb +6 -6
- data/lib/github_cli/apis/tag.rb +6 -6
- data/lib/github_cli/apis/team.rb +39 -39
- data/lib/github_cli/apis/tree.rb +6 -6
- data/lib/github_cli/apis/user.rb +9 -9
- data/lib/github_cli/apis/watching.rb +15 -15
- data/lib/github_cli/cli.rb +24 -16
- data/lib/github_cli/commands/assignees.rb +8 -2
- data/lib/github_cli/commands/authorizations.rb +10 -13
- data/lib/github_cli/commands/blobs.rb +9 -3
- data/lib/github_cli/commands/collaborators.rb +16 -4
- data/lib/github_cli/commands/commits.rb +11 -6
- data/lib/github_cli/commands/contents.rb +9 -6
- data/lib/github_cli/commands/downloads.rb +30 -6
- data/lib/github_cli/commands/emails.rb +12 -3
- data/lib/github_cli/commands/events.rb +30 -8
- data/lib/github_cli/commands/followers.rb +20 -5
- data/lib/github_cli/commands/forks.rb +6 -4
- data/lib/github_cli/commands/gists.rb +39 -12
- data/lib/github_cli/commands/hooks.rb +1 -1
- data/lib/github_cli/commands/issues.rb +15 -4
- data/lib/github_cli/commands/keys.rb +20 -5
- data/lib/github_cli/commands/labels.rb +53 -14
- data/lib/github_cli/commands/members.rb +28 -9
- data/lib/github_cli/commands/merging.rb +3 -2
- data/lib/github_cli/commands/milestones.rb +27 -15
- data/lib/github_cli/commands/notifications.rb +19 -11
- data/lib/github_cli/commands/organizations.rb +24 -5
- data/lib/github_cli/commands/pull_requests.rb +30 -8
- data/lib/github_cli/commands/references.rb +17 -5
- data/lib/github_cli/commands/repositories.rb +6 -4
- data/lib/github_cli/commands/search.rb +24 -6
- data/lib/github_cli/commands/starring.rb +19 -5
- data/lib/github_cli/commands/statuses.rb +7 -3
- data/lib/github_cli/commands/tags.rb +7 -3
- data/lib/github_cli/commands/teams.rb +52 -17
- data/lib/github_cli/commands/trees.rb +6 -2
- data/lib/github_cli/commands/users.rb +9 -3
- data/lib/github_cli/commands/watching.rb +19 -5
- data/lib/github_cli/vendor/thor/actions/directory.rb +2 -0
- data/lib/github_cli/vendor/thor/actions/empty_directory.rb +3 -19
- data/lib/github_cli/vendor/thor/actions/file_manipulation.rb +4 -1
- data/lib/github_cli/vendor/thor/actions.rb +1 -1
- data/lib/github_cli/vendor/thor/base.rb +20 -18
- data/lib/github_cli/vendor/thor/command.rb +1 -1
- data/lib/github_cli/vendor/thor/error.rb +0 -4
- data/lib/github_cli/vendor/thor/group.rb +4 -9
- data/lib/github_cli/vendor/thor/runner.rb +1 -1
- data/lib/github_cli/vendor/thor/shell/basic.rb +25 -7
- data/lib/github_cli/vendor/thor/version.rb +1 -1
- data/lib/github_cli/vendor/thor.rb +17 -2
- data/lib/github_cli/version.rb +1 -1
- data/spec/github_cli/api/configure_spec.rb +50 -0
- data/spec/github_cli/api/github_api_spec.rb +19 -0
- data/spec/github_cli/commands/assignees_spec.rb +1 -1
- data/spec/github_cli/commands/blobs_spec.rb +1 -1
- data/spec/github_cli/commands/collaborators_spec.rb +1 -1
- data/spec/github_cli/commands/commits_spec.rb +1 -1
- data/spec/github_cli/commands/contents_spec.rb +1 -1
- data/spec/github_cli/commands/downloads_spec.rb +35 -0
- data/spec/github_cli/commands/emails_spec.rb +1 -1
- data/spec/github_cli/commands/events_spec.rb +1 -1
- data/spec/github_cli/commands/followers_spec.rb +1 -1
- data/spec/github_cli/commands/forks_spec.rb +1 -1
- data/spec/github_cli/commands/gists_spec.rb +6 -1
- data/spec/github_cli/commands/issues_spec.rb +1 -1
- data/spec/github_cli/commands/keys_spec.rb +1 -1
- data/spec/github_cli/commands/labels_spec.rb +13 -3
- data/spec/github_cli/commands/members_spec.rb +46 -0
- data/spec/github_cli/commands/merging_spec.rb +1 -1
- data/spec/github_cli/commands/milestones_spec.rb +1 -1
- data/spec/github_cli/commands/notifications_spec.rb +1 -1
- data/spec/github_cli/commands/organizations_spec.rb +30 -0
- data/spec/github_cli/commands/pull_requests_spec.rb +1 -1
- data/spec/github_cli/commands/references_spec.rb +1 -1
- data/spec/github_cli/commands/repositories_spec.rb +5 -0
- data/spec/github_cli/commands/starring_spec.rb +1 -1
- data/spec/github_cli/commands/statuses_spec.rb +1 -1
- data/spec/github_cli/commands/tags_spec.rb +1 -1
- data/spec/github_cli/commands/teams_spec.rb +1 -1
- data/spec/github_cli/commands/trees_spec.rb +1 -1
- data/spec/github_cli/commands/users_spec.rb +1 -1
- data/spec/github_cli/commands/watching_spec.rb +1 -1
- metadata +27 -17
- data/spec/github_cli/api_spec.rb +0 -19
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.6.0 (June 1, 2013)
|
|
2
|
+
|
|
3
|
+
* Add authorize command to ease pain with getting authenticated
|
|
4
|
+
* Add 'every' flag to repository listing command
|
|
5
|
+
* Add 'public' flag to gist listing command
|
|
6
|
+
* Change all commands to pass through global options to configure api requests
|
|
7
|
+
* Update vendor dependencies
|
|
8
|
+
* Add ability to configure all github api request options
|
|
9
|
+
|
|
10
|
+
0.5.9 (April 17, 2013)
|
|
2
11
|
|
|
3
12
|
* Change API class configure to take options and allow for basic auth,
|
|
4
13
|
stop using class api variable
|
|
5
14
|
* Change API commands to take and pass options for global configuration
|
|
15
|
+
* Add --quiet option for supressing output only for repo/hook/auth commands
|
|
16
|
+
* Fix problem with repo create command and boolean option flags
|
|
6
17
|
|
|
7
18
|
0.5.8 (April 14, 2013)
|
|
8
19
|
|
data/Gemfile.lock
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
github_cli (0.
|
|
5
|
-
github_api (~> 0.
|
|
4
|
+
github_cli (0.6.0)
|
|
5
|
+
github_api (~> 0.10)
|
|
6
6
|
|
|
7
7
|
GEM
|
|
8
8
|
remote: https://rubygems.org/
|
|
9
9
|
specs:
|
|
10
|
+
addressable (2.3.4)
|
|
10
11
|
aruba (0.5.1)
|
|
11
12
|
childprocess (~> 0.3.6)
|
|
12
13
|
cucumber (>= 1.1.1)
|
|
@@ -24,28 +25,29 @@ GEM
|
|
|
24
25
|
gherkin (~> 2.11.0)
|
|
25
26
|
json (>= 1.4.6)
|
|
26
27
|
diff-lcs (1.2.1)
|
|
27
|
-
faraday (0.8.
|
|
28
|
+
faraday (0.8.7)
|
|
28
29
|
multipart-post (~> 1.1)
|
|
29
30
|
ffi (1.3.1)
|
|
30
31
|
gherkin (2.11.6)
|
|
31
32
|
json (>= 1.7.6)
|
|
32
|
-
github_api (0.
|
|
33
|
+
github_api (0.10.1)
|
|
34
|
+
addressable
|
|
33
35
|
faraday (~> 0.8.1)
|
|
34
|
-
hashie (
|
|
36
|
+
hashie (>= 1.2)
|
|
35
37
|
multi_json (~> 1.4)
|
|
36
38
|
nokogiri (~> 1.5.2)
|
|
37
39
|
oauth2
|
|
38
|
-
hashie (2.0.
|
|
40
|
+
hashie (2.0.5)
|
|
39
41
|
hpricot (0.8.6)
|
|
40
42
|
httpauth (0.2.0)
|
|
41
|
-
json (1.
|
|
42
|
-
jwt (0.1.
|
|
43
|
+
json (1.8.0)
|
|
44
|
+
jwt (0.1.8)
|
|
43
45
|
multi_json (>= 1.5)
|
|
44
|
-
multi_json (1.
|
|
46
|
+
multi_json (1.7.4)
|
|
45
47
|
multi_xml (0.5.3)
|
|
46
48
|
multipart-post (1.2.0)
|
|
47
49
|
mustache (0.99.4)
|
|
48
|
-
nokogiri (1.5.
|
|
50
|
+
nokogiri (1.5.9)
|
|
49
51
|
oauth2 (0.9.1)
|
|
50
52
|
faraday (~> 0.8)
|
|
51
53
|
httpauth (~> 0.1)
|
data/README.md
CHANGED
|
@@ -54,8 +54,12 @@ user.name # Default user name
|
|
|
54
54
|
user.repo # Default repo name
|
|
55
55
|
user.org # Default organization name
|
|
56
56
|
core.editor # Editor to be opened
|
|
57
|
+
core.endpoint # The api endpoint, by deafult https://api.github.com
|
|
58
|
+
core.site # The web endpoint, by default https://github.com
|
|
57
59
|
core.pager # Pager to be used, by default less
|
|
58
60
|
core.format # Output formating
|
|
61
|
+
core.quiet # Surpass output to show only response status
|
|
62
|
+
core.ssl # SSL settings
|
|
59
63
|
core.auto_pagination # Switch on default results pagination, default false
|
|
60
64
|
```
|
|
61
65
|
|
|
@@ -181,6 +185,14 @@ to limit returned results pass `pattern`
|
|
|
181
185
|
$ gcli list re* # Returns all commands matching the pattern
|
|
182
186
|
```
|
|
183
187
|
|
|
188
|
+
### Subcommands
|
|
189
|
+
|
|
190
|
+
To see a list of subcommands that a given command provides just type top-level command like so
|
|
191
|
+
|
|
192
|
+
```shell
|
|
193
|
+
$ gcli repo
|
|
194
|
+
```
|
|
195
|
+
|
|
184
196
|
### Output Format
|
|
185
197
|
|
|
186
198
|
The API responses can be formatted as `csv`, `json`, `pretty`, `table`.
|
|
@@ -196,6 +208,12 @@ To get `csv` formatting for easy command piping do
|
|
|
196
208
|
gcli repo ls -u wycats --format=csv
|
|
197
209
|
```
|
|
198
210
|
|
|
211
|
+
To suppress output pass `--quiet` option like so
|
|
212
|
+
|
|
213
|
+
```shell
|
|
214
|
+
gcli repo create ... --quiet=true
|
|
215
|
+
```
|
|
216
|
+
|
|
199
217
|
### Output Paging
|
|
200
218
|
|
|
201
219
|
By default all responses are paged. You can switch off paging by supplying `no-pager` flag.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Feature: gcli auth
|
|
2
|
+
|
|
3
|
+
@ci-run
|
|
4
|
+
Scenario: Available commands
|
|
5
|
+
|
|
6
|
+
When I run `gcli auth`
|
|
7
|
+
Then the exit status should be 0
|
|
8
|
+
And the output should contain "auth list"
|
|
9
|
+
And the output should contain "auth get"
|
|
10
|
+
And the output should contain "auth create"
|
|
11
|
+
And the output should contain "auth update"
|
|
12
|
+
And the output should contain "auth delete"
|
|
13
|
+
|
|
14
|
+
Scenario: List authorizations
|
|
15
|
+
Given the Github API server:
|
|
16
|
+
"""
|
|
17
|
+
get('/authorizations') { status 200 }
|
|
18
|
+
"""
|
|
19
|
+
When I run `gcli auth ls --login=piotr --password=secret`
|
|
20
|
+
Then the exit status should be 0
|
|
21
|
+
|
|
22
|
+
Scenario: Get authorization
|
|
23
|
+
Given the Github API server:
|
|
24
|
+
"""
|
|
25
|
+
get('/authorizations/1') { status 200 }
|
|
26
|
+
"""
|
|
27
|
+
When I run `gcli auth get 1 --login=piotr --password=secret`
|
|
28
|
+
Then the exit status should be 0
|
|
29
|
+
|
|
30
|
+
Scenario: Create authorization
|
|
31
|
+
Given the Github API server:
|
|
32
|
+
"""
|
|
33
|
+
post('/authorizations') { status 200 }
|
|
34
|
+
"""
|
|
35
|
+
When I run `gcli auth create --scopes=repo --login=piotr --password=secret`
|
|
36
|
+
Then the exit status should be 0
|
|
37
|
+
|
|
38
|
+
Scenario: Update authorization
|
|
39
|
+
Given the Github API server:
|
|
40
|
+
"""
|
|
41
|
+
patch('/authorizations/1') { status 200 }
|
|
42
|
+
"""
|
|
43
|
+
When I run `gcli auth update 1 --scopes=repo --login=piotr --password=secret`
|
|
44
|
+
Then the exit status should be 0
|
|
45
|
+
|
|
46
|
+
Scenario: Delete authorization
|
|
47
|
+
Given the Github API server:
|
|
48
|
+
"""
|
|
49
|
+
delete('/authorizations/1') { status 200 }
|
|
50
|
+
"""
|
|
51
|
+
When I run `gcli auth delete 1 --login=piotr --password=secret`
|
|
52
|
+
Then the exit status should be 0
|
|
53
|
+
|
data/features/blob.feature
CHANGED
|
@@ -21,5 +21,5 @@ Feature: gcli blob
|
|
|
21
21
|
"""
|
|
22
22
|
post('/repos/wycats/thor/git/blobs') { status 200 }
|
|
23
23
|
"""
|
|
24
|
-
When I run `gcli blob create wycats thor --
|
|
24
|
+
When I run `gcli blob create wycats thor --content=Content --encoding='utf-8'`
|
|
25
25
|
Then the exit status should be 0
|
data/features/download.feature
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
Feature: gcli download
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli download`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
-
And the output should contain "
|
|
9
|
-
And the output should contain "
|
|
10
|
-
And the output should contain "
|
|
11
|
-
And the output should contain "
|
|
8
|
+
And the output should contain "download create"
|
|
9
|
+
And the output should contain "download delete"
|
|
10
|
+
And the output should contain "download get"
|
|
11
|
+
And the output should contain "download list"
|
|
12
|
+
And the output should contain "download upload"
|
|
12
13
|
|
|
13
14
|
Scenario: List downloads
|
|
14
15
|
Given the GitHub API server:
|
|
@@ -26,18 +27,19 @@ Feature: gcli download
|
|
|
26
27
|
When I run `gcli download get wycats thor 1`
|
|
27
28
|
Then the exit status should be 0
|
|
28
29
|
|
|
29
|
-
Scenario:
|
|
30
|
+
Scenario: Create download
|
|
30
31
|
Given the GitHub API server:
|
|
31
32
|
"""
|
|
32
|
-
|
|
33
|
+
post('/repos/wycats/thor/downloads') { status 200 }
|
|
33
34
|
"""
|
|
34
|
-
When I run `gcli download
|
|
35
|
+
When I run `gcli download create wycats thor --name=octo.jpg --size=113410`
|
|
35
36
|
Then the exit status should be 0
|
|
36
37
|
|
|
37
|
-
Scenario:
|
|
38
|
+
Scenario: Delete download
|
|
38
39
|
Given the GitHub API server:
|
|
39
40
|
"""
|
|
40
|
-
|
|
41
|
+
delete('/repos/wycats/thor/downloads/1') { status 200 }
|
|
41
42
|
"""
|
|
42
|
-
When I run `gcli download
|
|
43
|
+
When I run `gcli download delete wycats thor 1`
|
|
43
44
|
Then the exit status should be 0
|
|
45
|
+
|
data/features/gist.feature
CHANGED
|
@@ -32,11 +32,19 @@ Feature: gcli gist
|
|
|
32
32
|
Then the exit status should be 0
|
|
33
33
|
|
|
34
34
|
Scenario: List public gists for the authenticated user
|
|
35
|
+
Given the GitHub API server:
|
|
36
|
+
"""
|
|
37
|
+
get('/gists') { status 200 }
|
|
38
|
+
"""
|
|
39
|
+
When I run `gcli gist ls --login=piotr --password=secret`
|
|
40
|
+
Then the exit status should be 0
|
|
41
|
+
|
|
42
|
+
Scenario: List all public gists
|
|
35
43
|
Given the GitHub API server:
|
|
36
44
|
"""
|
|
37
45
|
get('/gists/public') { status 200 }
|
|
38
46
|
"""
|
|
39
|
-
When I run `gcli gist ls`
|
|
47
|
+
When I run `gcli gist ls --public`
|
|
40
48
|
Then the exit status should be 0
|
|
41
49
|
|
|
42
50
|
Scenario: Get gist
|
data/features/label.feature
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
Feature: gcli label
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli label`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
-
And the output should contain "
|
|
9
|
-
And the output should contain "
|
|
10
|
-
And the output should contain "
|
|
11
|
-
And the output should contain "
|
|
12
|
-
And the output should contain "
|
|
13
|
-
And the output should contain "
|
|
14
|
-
And the output should contain "
|
|
15
|
-
And the output should contain "gcli label replace"
|
|
16
|
-
And the output should contain "gcli label update"
|
|
8
|
+
And the output should contain "label add"
|
|
9
|
+
And the output should contain "label create"
|
|
10
|
+
And the output should contain "label delete"
|
|
11
|
+
And the output should contain "label get"
|
|
12
|
+
And the output should contain "label list"
|
|
13
|
+
And the output should contain "label remove"
|
|
14
|
+
And the output should contain "label replace"
|
|
15
|
+
And the output should contain "label update"
|
|
17
16
|
|
|
18
17
|
Scenario: List labels
|
|
19
18
|
Given the GitHub API server:
|
|
@@ -36,7 +35,7 @@ Feature: gcli label
|
|
|
36
35
|
"""
|
|
37
36
|
post('/repos/wycats/thor/labels') { status 200 }
|
|
38
37
|
"""
|
|
39
|
-
When I run `gcli label create wycats thor --
|
|
38
|
+
When I run `gcli label create wycats thor --name=bug --color=f3f3f3`
|
|
40
39
|
Then the exit status should be 0
|
|
41
40
|
|
|
42
41
|
Scenario: Update label
|
|
@@ -44,7 +43,7 @@ Feature: gcli label
|
|
|
44
43
|
"""
|
|
45
44
|
patch('/repos/wycats/thor/labels/1') { status 200 }
|
|
46
45
|
"""
|
|
47
|
-
When I run `gcli label update wycats thor 1 --
|
|
46
|
+
When I run `gcli label update wycats thor 1 --name=bug --color=f3f3f3`
|
|
48
47
|
Then the exit status should be 0
|
|
49
48
|
|
|
50
49
|
Scenario: Delete label
|
data/features/member.feature
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Feature: gcli member
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli member`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
-
And the output should contain "
|
|
9
|
-
And the output should contain "
|
|
10
|
-
And the output should contain "
|
|
8
|
+
And the output should contain "member delete"
|
|
9
|
+
And the output should contain "member list"
|
|
10
|
+
And the output should contain "member member"
|
|
11
|
+
And the output should contain "member publicize"
|
|
11
12
|
|
|
12
13
|
Scenario: List members
|
|
13
14
|
Given the GitHub API server:
|
data/features/merging.feature
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Feature: gcli merge
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli merge`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
+
And the output should contain "merge perform"
|
|
8
9
|
|
|
9
10
|
Scenario: Merge success
|
|
10
11
|
Given the GitHub API server:
|
|
@@ -15,7 +16,7 @@ Feature: gcli merge
|
|
|
15
16
|
status 201
|
|
16
17
|
}
|
|
17
18
|
"""
|
|
18
|
-
When I successfully run `gcli merge perform wycats thor --
|
|
19
|
+
When I successfully run `gcli merge perform wycats thor --base=master --head=cool_feature`
|
|
19
20
|
Then the stdout should contain "octokit"
|
|
20
21
|
And the stdout should contain "201"
|
|
21
22
|
|
|
@@ -26,7 +27,7 @@ Feature: gcli merge
|
|
|
26
27
|
status 204
|
|
27
28
|
}
|
|
28
29
|
"""
|
|
29
|
-
When I successfully run `gcli merge perform wycats thor --
|
|
30
|
+
When I successfully run `gcli merge perform wycats thor --base=master --head=cool_feature`
|
|
30
31
|
Then the stdout should contain "204"
|
|
31
32
|
|
|
32
33
|
Scenario: Merge conflict
|
|
@@ -37,7 +38,7 @@ Feature: gcli merge
|
|
|
37
38
|
status 409
|
|
38
39
|
}
|
|
39
40
|
"""
|
|
40
|
-
When I run `gcli merge perform wycats thor --
|
|
41
|
+
When I run `gcli merge perform wycats thor --base=master --head=cool_feature`
|
|
41
42
|
Then the exit status should be 1
|
|
42
43
|
Then the stdout should contain "Merge conflict"
|
|
43
44
|
And the stdout should contain "409"
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
Feature: gcli org
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli org`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
-
And the output should contain "
|
|
9
|
-
And the output should contain "
|
|
8
|
+
And the output should contain "org edit"
|
|
9
|
+
And the output should contain "org list"
|
|
10
|
+
And the output should contain "org get"
|
|
10
11
|
|
|
11
12
|
Scenario: List public organizations for a user
|
|
12
13
|
Given the GitHub API server:
|
|
@@ -37,5 +38,5 @@ Feature: gcli org
|
|
|
37
38
|
"""
|
|
38
39
|
patch('/orgs/rails') { status 200 }
|
|
39
40
|
"""
|
|
40
|
-
When I run `gcli org edit rails --
|
|
41
|
+
When I run `gcli org edit rails --name=github --company=GitHub --email=support@github.com`
|
|
41
42
|
Then the exit status should be 0
|
data/features/repository.feature
CHANGED
|
@@ -21,7 +21,15 @@ Feature: gcli repository
|
|
|
21
21
|
"""
|
|
22
22
|
get('/repositories') { status 200 }
|
|
23
23
|
"""
|
|
24
|
-
When I run `gcli repo ls`
|
|
24
|
+
When I run `gcli repo ls --every`
|
|
25
|
+
Then the exit status should be 0
|
|
26
|
+
|
|
27
|
+
Scenario: List all repositories for the authenticated user
|
|
28
|
+
Given the GitHub API server:
|
|
29
|
+
"""
|
|
30
|
+
get('/user/repos') { status 200 }
|
|
31
|
+
"""
|
|
32
|
+
When I run `gcli repo ls --login=piotr --password=secret`
|
|
25
33
|
Then the exit status should be 0
|
|
26
34
|
|
|
27
35
|
Scenario: List repositories for user
|
data/features/search.feature
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Feature: gcli search
|
|
2
2
|
|
|
3
|
+
@ci-run
|
|
3
4
|
Scenario: Available commands
|
|
4
5
|
|
|
5
6
|
When I run `gcli search`
|
|
6
7
|
Then the exit status should be 0
|
|
7
|
-
And the output should contain "
|
|
8
|
-
And the output should contain "
|
|
9
|
-
And the output should contain "
|
|
10
|
-
And the output should contain "
|
|
8
|
+
And the output should contain "search email"
|
|
9
|
+
And the output should contain "search issue"
|
|
10
|
+
And the output should contain "search repo"
|
|
11
|
+
And the output should contain "search user"
|
|
11
12
|
|
|
12
13
|
Scenario: Search issues
|
|
13
14
|
Given the GitHub API server:
|
data/github_cli.gemspec
CHANGED
|
@@ -17,7 +17,7 @@ Gem::Specification.new do |gem|
|
|
|
17
17
|
gem.require_paths = ["lib"]
|
|
18
18
|
gem.version = GithubCLI::VERSION
|
|
19
19
|
|
|
20
|
-
gem.add_dependency 'github_api', '~> 0.
|
|
20
|
+
gem.add_dependency 'github_api', '~> 0.10'
|
|
21
21
|
|
|
22
22
|
gem.add_development_dependency 'rspec'
|
|
23
23
|
gem.add_development_dependency 'aruba'
|
data/lib/github_cli/api.rb
CHANGED
|
@@ -5,64 +5,71 @@ module GithubCLI
|
|
|
5
5
|
# The API class is the main entry point for creating GithubCLI APIs.
|
|
6
6
|
class API
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
@github_api ||= begin
|
|
15
|
-
@github_api = configure(options)
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# this could become a command such as configure that gets class options
|
|
20
|
-
#
|
|
21
|
-
# @api public
|
|
22
|
-
def configure(options={})
|
|
23
|
-
api = Github.new
|
|
24
|
-
config = GithubCLI.config.data
|
|
25
|
-
|
|
26
|
-
api.oauth_token = config['user.token'] if config['user.token']
|
|
8
|
+
# Access or initialize Github API client
|
|
9
|
+
#
|
|
10
|
+
# @api public
|
|
11
|
+
def self.github_api(options={})
|
|
12
|
+
@github_api ||= configure(options)
|
|
13
|
+
end
|
|
27
14
|
|
|
28
|
-
|
|
15
|
+
# Configures api options if provided in the configuration file
|
|
16
|
+
#
|
|
17
|
+
# @api public
|
|
18
|
+
def self.configure(options={})
|
|
19
|
+
api = Github.new
|
|
20
|
+
config = GithubCLI.config
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
api.basic_auth = set_basic_auth(config, options)
|
|
23
|
+
api.ssl = config['core.ssl'] if config['core.ssl']
|
|
24
|
+
api.adapter = config['core.adapter'] if config['core.adapter']
|
|
25
|
+
api.oauth_token = config['user.token'] if config['user.token']
|
|
26
|
+
api.site = config['core.site'] if config['core.site']
|
|
27
|
+
api.endpoint = config['core.endpoint'] if config['core.endpoint']
|
|
28
|
+
api.auto_pagination = options['auto_pagination'] || config['core.auto_pagination']
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
end
|
|
35
|
-
api
|
|
30
|
+
if (test_env = ENV['TEST_HOST'])
|
|
31
|
+
api.endpoint = 'http://' + test_env
|
|
36
32
|
end
|
|
33
|
+
api
|
|
34
|
+
end
|
|
37
35
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
end
|
|
36
|
+
# Set user basic authentication
|
|
37
|
+
#
|
|
38
|
+
# @api public
|
|
39
|
+
def self.set_basic_auth(config, options)
|
|
40
|
+
if (login = options['login']) && (password = options['password'])
|
|
41
|
+
"#{login}:#{password}"
|
|
42
|
+
elsif (login = config['user.login']) && (password = config['user.password'])
|
|
43
|
+
"#{login}:#{password}"
|
|
44
|
+
else
|
|
45
|
+
nil
|
|
49
46
|
end
|
|
47
|
+
end
|
|
50
48
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
49
|
+
# Procoess response and output to shell
|
|
50
|
+
#
|
|
51
|
+
# @param [Hash] options the options to format the output
|
|
52
|
+
# @option options [String] :format
|
|
53
|
+
# The format type
|
|
54
|
+
# @option options [String] :quiet
|
|
55
|
+
# The flag for reducing the output
|
|
56
|
+
#
|
|
57
|
+
# @api public
|
|
58
|
+
def self.output(options, &block)
|
|
59
|
+
config = GithubCLI.config
|
|
60
|
+
format = options.fetch(:format) { config['core.format'] || :table }
|
|
61
|
+
quiet = options.fetch(:quiet) { config['core.quiet'] }
|
|
62
|
+
|
|
63
|
+
GithubCLI.on_error do
|
|
64
|
+
response = block.call
|
|
65
|
+
if response.respond_to?(:body)
|
|
66
|
+
formatter = Formatter.new response, :format => format, :quiet => quiet
|
|
67
|
+
formatter.render_output
|
|
68
|
+
else
|
|
69
|
+
Terminal.line response
|
|
63
70
|
end
|
|
71
|
+
response
|
|
64
72
|
end
|
|
65
|
-
|
|
66
73
|
end
|
|
67
74
|
|
|
68
75
|
end # API
|
|
@@ -5,15 +5,15 @@ module GithubCLI
|
|
|
5
5
|
|
|
6
6
|
class << self
|
|
7
7
|
|
|
8
|
-
def all(user, repo, params,
|
|
9
|
-
output
|
|
10
|
-
github_api.issues.assignees.list user, repo, params
|
|
8
|
+
def all(user, repo, params, options)
|
|
9
|
+
output options do
|
|
10
|
+
github_api(options).issues.assignees.list user, repo, params
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def check(user, repo, assignee, params,
|
|
15
|
-
output
|
|
16
|
-
github_api.issues.assignees.check user, repo, assignee, params
|
|
14
|
+
def check(user, repo, assignee, params, options)
|
|
15
|
+
output options do
|
|
16
|
+
github_api(options).issues.assignees.check user, repo, assignee, params
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
@@ -6,31 +6,31 @@ module GithubCLI
|
|
|
6
6
|
class << self
|
|
7
7
|
|
|
8
8
|
def all(params, options)
|
|
9
|
-
output options
|
|
9
|
+
output options do
|
|
10
10
|
github_api(options).oauth.list params
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
def get(id, params, options)
|
|
15
|
-
output options
|
|
15
|
+
output options do
|
|
16
16
|
github_api(options).oauth.get id, params
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def create(params, options)
|
|
21
|
-
output options
|
|
21
|
+
output options do
|
|
22
22
|
github_api(options).oauth.create params
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
def update(id, params, options)
|
|
27
|
-
output options
|
|
27
|
+
output options do
|
|
28
28
|
github_api(options).oauth.update id, params
|
|
29
29
|
end
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
def delete(id, params, options)
|
|
33
|
-
output options
|
|
33
|
+
output options do
|
|
34
34
|
github_api(options).oauth.delete id, params
|
|
35
35
|
end
|
|
36
36
|
end
|
data/lib/github_cli/apis/blob.rb
CHANGED
|
@@ -5,15 +5,15 @@ module GithubCLI
|
|
|
5
5
|
|
|
6
6
|
class << self
|
|
7
7
|
|
|
8
|
-
def get(user, repo, sha, params,
|
|
9
|
-
output
|
|
10
|
-
github_api.git_data.blobs.get user, repo, sha, params
|
|
8
|
+
def get(user, repo, sha, params, options)
|
|
9
|
+
output options do
|
|
10
|
+
github_api(options).git_data.blobs.get user, repo, sha, params
|
|
11
11
|
end
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def create(user, repo, params,
|
|
15
|
-
output
|
|
16
|
-
github_api.git_data.blobs.create user, repo, params
|
|
14
|
+
def create(user, repo, params, options)
|
|
15
|
+
output options do
|
|
16
|
+
github_api(options).git_data.blobs.create user, repo, params
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|