github_cli 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml CHANGED
@@ -1,17 +1,17 @@
1
1
  before_install:
2
2
  - gem install bundler
3
- branches:
4
- only: master
5
- notifications:
6
- email:false
7
3
  matrix:
8
4
  allow_failures:
9
5
  - rvm: ruby-head
10
- - jruby
11
- - rbx-19mode
6
+ - rvm: jruby-19mode
7
+ - rvm: rbx-19mode
12
8
  rvm:
13
9
  - 1.9.2
14
10
  - 1.9.3
15
11
  - rbx-19mode
16
- - jruby
12
+ - jruby-19mode
17
13
  - ruby-head
14
+ branches:
15
+ only: master
16
+ notifications:
17
+ email:false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,16 @@
1
+ 0.4.3 (July 14, 2012)
2
+
3
+ * Add communist gem dependency.
4
+ * Fix bug with getting blob data and add blob api feature tests.
5
+ * Fix bug with getting commit data and add commit api feature tests.
6
+ * Fix bug with removing collaborator and add feature tests.
7
+ * Add content, download, email api commands feature tests.
8
+ * Fix bug with missing event api inclusion and add feature tests.
9
+ * Fix bug with checkig if user is a follower and add feature tests.
10
+ * Fix bug with listing starred gists and add gist api feature tests.
11
+ * Add hook api commands feature tests.
12
+ * Fix bugs with labels api coammands using old github_api gem method calls.
13
+
1
14
  0.4.2 (July 12, 2012)
2
15
 
3
16
  * Add 'did you mean' help for mistyped commands.
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ # gem 'communist', :path => '../communist'
4
+
3
5
  gemspec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_cli (0.4.2)
4
+ github_cli (0.4.3)
5
5
  github_api (~> 0.6)
6
6
  thor
7
7
 
@@ -16,6 +16,9 @@ GEM
16
16
  builder (3.0.0)
17
17
  childprocess (0.3.2)
18
18
  ffi (~> 1.0.6)
19
+ communist (0.1.0)
20
+ rack
21
+ sinatra
19
22
  cucumber (1.2.1)
20
23
  builder (>= 2.1.2)
21
24
  diff-lcs (>= 1.1.3)
@@ -45,6 +48,8 @@ GEM
45
48
  multi_json (~> 1.0)
46
49
  rack (~> 1.4)
47
50
  rack (1.4.1)
51
+ rack-protection (1.2.0)
52
+ rack
48
53
  rake (0.9.2.2)
49
54
  rspec (2.10.0)
50
55
  rspec-core (~> 2.10.0)
@@ -54,13 +59,19 @@ GEM
54
59
  rspec-expectations (2.10.0)
55
60
  diff-lcs (~> 1.1.3)
56
61
  rspec-mocks (2.10.1)
62
+ sinatra (1.3.2)
63
+ rack (~> 1.3, >= 1.3.6)
64
+ rack-protection (~> 1.2)
65
+ tilt (~> 1.3, >= 1.3.3)
57
66
  thor (0.15.2)
67
+ tilt (1.3.3)
58
68
 
59
69
  PLATFORMS
60
70
  ruby
61
71
 
62
72
  DEPENDENCIES
63
73
  aruba
74
+ communist
64
75
  github_cli!
65
76
  rake
66
77
  rspec
@@ -6,3 +6,19 @@ Feature: ghc blob
6
6
  Then the exit status should be 0
7
7
  And the output should contain "ghc blob get"
8
8
  And the output should contain "ghc blob create"
9
+
10
+ Scenario: Get blob
11
+ Given the GitHub API server:
12
+ """
13
+ get('/repos/wycats/thor/git/blobs/59b23de9b91d') { status 200 }
14
+ """
15
+ When I run `ghc blob get wycats thor 59b23de9b91d`
16
+ Then the exit status should be 0
17
+
18
+ Scenario: Create blob
19
+ Given the GitHub API server:
20
+ """
21
+ post('/repos/wycats/thor/git/blobs') { status 200 }
22
+ """
23
+ When I run `ghc blob create wycats thor --params=content:'Content' encoding:'utf-8'`
24
+ Then the exit status should be 0
@@ -8,3 +8,36 @@ Feature: ghc collab
8
8
  And the output should contain "ghc collab add"
9
9
  And the output should contain "ghc collab collab"
10
10
  And the output should contain "ghc collab remove"
11
+
12
+ Scenario: List collaborators
13
+ Given the GitHub API server:
14
+ """
15
+ get('/repos/wycats/thor/collaborators') { status 200 }
16
+ """
17
+ When I run `ghc collab ls wycats thor`
18
+ Then the exit status should be 0
19
+
20
+ Scenario: Add collaborator
21
+ Given the GitHub API server:
22
+ """
23
+ put('/repos/wycats/thor/collaborators/octocat') { status 200 }
24
+ """
25
+ When I run `ghc collab add wycats thor octocat`
26
+ Then the exit status should be 0
27
+
28
+ Scenario: Remove collaborator
29
+ Given the GitHub API server:
30
+ """
31
+ delete('/repos/wycats/thor/collaborators/octocat') { status 200 }
32
+ """
33
+ When I run `ghc collab remove wycats thor octocat`
34
+ Then the exit status should be 0
35
+
36
+ Scenario: Check if collaborator
37
+ Given the GitHub API server:
38
+ """
39
+ delete('/repos/wycats/thor/collaborators/octocat') { status 200 }
40
+ """
41
+ When I run `ghc collab collab wycats thor octocat`
42
+ Then the exit status should be 0
43
+
@@ -6,3 +6,19 @@ Feature: ghc commit
6
6
  Then the exit status should be 0
7
7
  And the output should contain "ghc commit get"
8
8
  And the output should contain "ghc commit create"
9
+
10
+ Scenario: Get commit
11
+ Given the GitHub API server:
12
+ """
13
+ get('/repos/wycats/thor/git/commits/59b23de9b91d') { status 200 }
14
+ """
15
+ When I run `ghc commit get wycats thor 59b23de9b91d`
16
+ Then the exit status should be 0
17
+
18
+ Scenario: Create commit
19
+ Given the GitHub API server:
20
+ """
21
+ post('/repos/wycats/thor/git/commits') { status 200 }
22
+ """
23
+ When I run `ghc commit create wycats thor --params=message:'my commit' tree:827efc parents:['7d1b31e']`
24
+ Then the exit status should be 0
@@ -7,3 +7,35 @@ Feature: ghc content
7
7
  And the output should contain "ghc content get"
8
8
  And the output should contain "ghc content readme"
9
9
  And the output should contain "ghc content archive"
10
+
11
+ Scenario: Readme
12
+ Given the GitHub API server:
13
+ """
14
+ get('/repos/wycats/thor/readme') { status 200 }
15
+ """
16
+ When I run `ghc content readme wycats thor`
17
+ Then the exit status should be 0
18
+
19
+ Scenario: Get content
20
+ Given the GitHub API server:
21
+ """
22
+ get('/repos/wycats/thor/contents/lib') { status 200 }
23
+ """
24
+ When I run `ghc content get wycats thor lib`
25
+ Then the exit status should be 0
26
+
27
+ Scenario: Archive
28
+ Given the GitHub API server:
29
+ """
30
+ get('/repos/wycats/thor/zipball/master') { status 200 }
31
+ """
32
+ When I run `ghc content archive wycats thor`
33
+ Then the exit status should be 0
34
+
35
+ Scenario: Archive with params
36
+ Given the GitHub API server:
37
+ """
38
+ get('/repos/wycats/thor/tarball/new_feature') { status 200 }
39
+ """
40
+ When I run `ghc content archive wycats thor --params=archive_format:tarball ref:new_feature`
41
+ Then the exit status should be 0
@@ -9,3 +9,35 @@ Feature: ghc download
9
9
  And the output should contain "ghc download get"
10
10
  And the output should contain "ghc download list"
11
11
  And the output should contain "ghc download upload"
12
+
13
+ Scenario: List downloads
14
+ Given the GitHub API server:
15
+ """
16
+ get('/repos/wycats/thor/downloads') { status 200 }
17
+ """
18
+ When I run `ghc download ls wycats thor`
19
+ Then the exit status should be 0
20
+
21
+ Scenario: Get download
22
+ Given the GitHub API server:
23
+ """
24
+ get('/repos/wycats/thor/downloads/1') { status 200 }
25
+ """
26
+ When I run `ghc download get wycats thor 1`
27
+ Then the exit status should be 0
28
+
29
+ Scenario: Delete download
30
+ Given the GitHub API server:
31
+ """
32
+ delete('/repos/wycats/thor/downloads/1') { status 200 }
33
+ """
34
+ When I run `ghc download delete wycats thor 1`
35
+ Then the exit status should be 0
36
+
37
+ Scenario: Create download
38
+ Given the GitHub API server:
39
+ """
40
+ post('/repos/wycats/thor/downloads') { status 200 }
41
+ """
42
+ When I run `ghc download create wycats thor --params=name:octo.jpg size:113410`
43
+ Then the exit status should be 0
@@ -7,3 +7,27 @@ Feature: ghc email
7
7
  And the output should contain "ghc email delete"
8
8
  And the output should contain "ghc email list"
9
9
  And the output should contain "ghc email add"
10
+
11
+ Scenario: List emails
12
+ Given the GitHub API server:
13
+ """
14
+ get('/user/emails') { status 200 }
15
+ """
16
+ When I run `ghc email ls`
17
+ Then the exit status should be 0
18
+
19
+ Scenario: Add emails
20
+ Given the GitHub API server:
21
+ """
22
+ post('/user/emails') { status 200 }
23
+ """
24
+ When I run `ghc email add user@github.com`
25
+ Then the exit status should be 0
26
+
27
+ Scenario: Delete emails
28
+ Given the GitHub API server:
29
+ """
30
+ delete('/user/emails') { status 200 }
31
+ """
32
+ When I run `ghc email del user@github.com`
33
+ Then the exit status should be 0
@@ -1,10 +1,11 @@
1
1
  Feature: ghc errors notification
2
2
 
3
+ @wip
3
4
  Scenario: Unknown formatting option
4
5
 
5
- When I run `ghc repo list -u wycats --format=unknown`
6
- Then the exit status should be 1
7
- And the output should contain:
8
- """
9
- Fatal error has occurred. Unrecognized formatting options: unknown
10
- """
6
+ # When I run `ghc repo list -u wycats --format=unknown`
7
+ # Then the exit status should be 1
8
+ # And the output should contain:
9
+ # """
10
+ # Fatal error has occurred. Unrecognized formatting options: unknown
11
+ # """
@@ -12,3 +12,83 @@ Feature: ghc event
12
12
  And the output should contain "ghc event received"
13
13
  And the output should contain "ghc event repo"
14
14
  And the output should contain "ghc event user_org"
15
+
16
+ Scenario: Public events
17
+ Given the GitHub API server:
18
+ """
19
+ get('/events') { status 200 }
20
+ """
21
+ When I run `ghc event public`
22
+ Then the exit status should be 0
23
+
24
+ Scenario: Repository events
25
+ Given the GitHub API server:
26
+ """
27
+ get('/repos/wycats/thor/events') { status 200 }
28
+ """
29
+ When I run `ghc event repo wycats thor`
30
+ Then the exit status should be 0
31
+
32
+ Scenario: Issue events
33
+ Given the GitHub API server:
34
+ """
35
+ get('/repos/wycats/thor/issues/events') { status 200 }
36
+ """
37
+ When I run `ghc event issue wycats thor`
38
+ Then the exit status should be 0
39
+
40
+ Scenario: Network events
41
+ Given the GitHub API server:
42
+ """
43
+ get('/networks/wycats/thor/events') { status 200 }
44
+ """
45
+ When I run `ghc event network wycats thor`
46
+ Then the exit status should be 0
47
+
48
+ Scenario: Organization events
49
+ Given the GitHub API server:
50
+ """
51
+ get('/orgs/github/events') { status 200 }
52
+ """
53
+ When I run `ghc event org github`
54
+ Then the exit status should be 0
55
+
56
+ Scenario: Received events
57
+ Given the GitHub API server:
58
+ """
59
+ get('/users/wycats/received_events') { status 200 }
60
+ """
61
+ When I run `ghc event received wycats`
62
+ Then the exit status should be 0
63
+
64
+ Scenario: Received public events
65
+ Given the GitHub API server:
66
+ """
67
+ get('/users/wycats/received_events/public') { status 200 }
68
+ """
69
+ When I run `ghc event received wycats --public`
70
+ Then the exit status should be 0
71
+
72
+ Scenario: Performed events
73
+ Given the GitHub API server:
74
+ """
75
+ get('/users/wycats/events') { status 200 }
76
+ """
77
+ When I run `ghc event performed wycats`
78
+ Then the exit status should be 0
79
+
80
+ Scenario: Performed public events
81
+ Given the GitHub API server:
82
+ """
83
+ get('/users/wycats/events/public') { status 200 }
84
+ """
85
+ When I run `ghc event performed wycats --public`
86
+ Then the exit status should be 0
87
+
88
+ Scenario: User organization events
89
+ Given the GitHub API server:
90
+ """
91
+ get('/users/wycats/events/orgs/rails') { status 200 }
92
+ """
93
+ When I run `ghc event user_org wycats rails`
94
+ Then the exit status should be 0
@@ -9,3 +9,51 @@ Feature: ghc follower
9
9
  And the output should contain "ghc follower following"
10
10
  And the output should contain "ghc follower list"
11
11
  And the output should contain "ghc follower unfollow"
12
+
13
+ Scenario: List for user
14
+ Given the GitHub API server:
15
+ """
16
+ get('/users/wycats/followers') { status 200 }
17
+ """
18
+ When I run `ghc follower ls -u wycats`
19
+ Then the exit status should be 0
20
+
21
+ Scenario: List for the authenticated user
22
+ Given the GitHub API server:
23
+ """
24
+ get('/user/followers') { status 200 }
25
+ """
26
+ When I run `ghc follower ls`
27
+ Then the exit status should be 0
28
+
29
+ Scenario: Follower
30
+ Given the GitHub API server:
31
+ """
32
+ get('/users/following/wycats') { status 200 }
33
+ """
34
+ When I run `ghc follower follower wycats`
35
+ Then the exit status should be 0
36
+
37
+ Scenario: Following
38
+ Given the GitHub API server:
39
+ """
40
+ get('/users/wycats/following') { status 200 }
41
+ """
42
+ When I run `ghc follower following -u wycats`
43
+ Then the exit status should be 0
44
+
45
+ Scenario: Follow
46
+ Given the GitHub API server:
47
+ """
48
+ put('/user/following/wycats') { status 200 }
49
+ """
50
+ When I run `ghc follower follow wycats`
51
+ Then the exit status should be 0
52
+
53
+ Scenario: Unfollow
54
+ Given the GitHub API server:
55
+ """
56
+ delete('/user/following/wycats') { status 200 }
57
+ """
58
+ When I run `ghc follower unfollow wycats`
59
+ Then the exit status should be 0
@@ -7,7 +7,18 @@ Feature: ghc fork
7
7
  And the output should contain "ghc fork create"
8
8
  And the output should contain "ghc fork list"
9
9
 
10
- # Scenario: List forks
11
- # When I run `ghc fork ls wycats thor` interactively
12
- # And I type "q"
13
- # Then the exit status should be 0
10
+ Scenario: List forks
11
+ Given the GitHub API server:
12
+ """
13
+ get('/repos/wycats/thor/forks') { status 200 }
14
+ """
15
+ When I run `ghc fork ls wycats thor`
16
+ Then the exit status should be 0
17
+
18
+ Scenario: Create fork
19
+ Given the GitHub API server:
20
+ """
21
+ post('/repos/wycats/thor/forks') { status 200 }
22
+ """
23
+ When I run `ghc fork create wycats thor`
24
+ Then the exit status should be 0
@@ -13,3 +13,91 @@ Feature: ghc gist
13
13
  And the output should contain "ghc gist star"
14
14
  And the output should contain "ghc gist starred"
15
15
  And the output should contain "ghc gist unstar"
16
+
17
+ Scenario: List gists for user
18
+ Given the GitHub API server:
19
+ """
20
+ get('/users/wycats/gists') { status 200 }
21
+ """
22
+ When I run `ghc gist ls -u wycats`
23
+ Then the exit status should be 0
24
+
25
+ Scenario: List starred gists for the authenticated user
26
+ Given the GitHub API server:
27
+ """
28
+ get('/gists/starred') { status 200 }
29
+ """
30
+ When I run `ghc gist ls --starred`
31
+ Then the exit status should be 0
32
+
33
+ Scenario: List public gists for the authenticated user
34
+ Given the GitHub API server:
35
+ """
36
+ get('/gists/public') { status 200 }
37
+ """
38
+ When I run `ghc gist ls`
39
+ Then the exit status should be 0
40
+
41
+ Scenario: Get gist
42
+ Given the GitHub API server:
43
+ """
44
+ get('/gists/1') { status 200 }
45
+ """
46
+ When I run `ghc gist get 1`
47
+ Then the exit status should be 0
48
+
49
+ Scenario: Create gist
50
+ Given the GitHub API server:
51
+ """
52
+ post('/gists') { status 200 }
53
+ """
54
+ When I run `ghc gist create --params=description:'desc' public:true files:'file' content:'string'`
55
+ Then the exit status should be 0
56
+
57
+ Scenario: Edit gist
58
+ Given the GitHub API server:
59
+ """
60
+ patch('/gists/1') { status 200 }
61
+ """
62
+ When I run `ghc gist edit`
63
+ Then the exit status should be 0
64
+
65
+ Scenario: Star gist
66
+ Given the GitHub API server:
67
+ """
68
+ put('/gists/1/star') { status 200 }
69
+ """
70
+ When I run `ghc gist star 1`
71
+ Then the exit status should be 0
72
+
73
+ Scenario: Unstar gist
74
+ Given the GitHub API server:
75
+ """
76
+ delete('/gists/1/star') { status 200 }
77
+ """
78
+ When I run `ghc gist unstar 1`
79
+ Then the exit status should be 0
80
+
81
+ Scenario: Starred gist
82
+ Given the GitHub API server:
83
+ """
84
+ get('/gists/1/star') { status 200 }
85
+ """
86
+ When I run `ghc gist starred 1`
87
+ Then the exit status should be 0
88
+
89
+ Scenario: Fork gist
90
+ Given the GitHub API server:
91
+ """
92
+ post('/gists/1/fork') { status 200 }
93
+ """
94
+ When I run `ghc gist fork 1`
95
+ Then the exit status should be 0
96
+
97
+ Scenario: Delete gist
98
+ Given the GitHub API server:
99
+ """
100
+ delete('/gists/1') { status 200 }
101
+ """
102
+ When I run `ghc gist del 1`
103
+ Then the exit status should be 0
@@ -10,3 +10,52 @@ Feature: ghc hook
10
10
  And the output should contain "ghc hook get"
11
11
  And the output should contain "ghc hook list"
12
12
  And the output should contain "ghc hook test"
13
+
14
+ Scenario: List hooks
15
+ Given the GitHub API server:
16
+ """
17
+ get('/repos/wycats/thor/hooks') { status 200 }
18
+ """
19
+ When I run `ghc hook ls wycats thor`
20
+ Then the exit status should be 0
21
+
22
+ Scenario: Get hook
23
+ Given the GitHub API server:
24
+ """
25
+ get('/repos/wycats/thor/hooks/1') { status 200 }
26
+ """
27
+ When I run `ghc hook get wycats thor 1`
28
+ Then the exit status should be 0
29
+
30
+ Scenario: Create hook
31
+ Given the GitHub API server:
32
+ """
33
+ post('/repos/wycats/thor/hooks') { status 200 }
34
+ """
35
+ When I run `ghc hook create wycats thor --params=name:web config:{}`
36
+ Then the exit status should be 0
37
+
38
+ Scenario: Edit hook
39
+ Given the GitHub API server:
40
+ """
41
+ patch('/repos/wycats/thor/hooks/1') { status 200 }
42
+ """
43
+ When I run `ghc hook edit wycats thor 1 --params=name:web config:{}`
44
+ Then the exit status should be 0
45
+
46
+ Scenario: Test hook
47
+ Given the GitHub API server:
48
+ """
49
+ post('/repos/wycats/thor/hooks/1/test') { status 200 }
50
+ """
51
+ When I run `ghc hook test wycats thor 1`
52
+ Then the exit status should be 0
53
+
54
+ Scenario: Delete hook
55
+ Given the GitHub API server:
56
+ """
57
+ delete('/repos/wycats/thor/hooks/1') { status 200 }
58
+ """
59
+ When I run `ghc hook del wycats thor 1`
60
+ Then the exit status should be 0
61
+
@@ -14,3 +14,92 @@ Feature: ghc label
14
14
  And the output should contain "ghc label remove"
15
15
  And the output should contain "ghc label replace"
16
16
  And the output should contain "ghc label update"
17
+
18
+ Scenario: List labels
19
+ Given the GitHub API server:
20
+ """
21
+ get('/repos/wycats/thor/labels') { status 200 }
22
+ """
23
+ When I run `ghc label ls wycats thor`
24
+ Then the exit status should be 0
25
+
26
+ Scenario: Get label
27
+ Given the GitHub API server:
28
+ """
29
+ get('/repos/wycats/thor/labels/1') { status 200 }
30
+ """
31
+ When I run `ghc label get wycats thor 1`
32
+ Then the exit status should be 0
33
+
34
+ Scenario: Create label
35
+ Given the GitHub API server:
36
+ """
37
+ post('/repos/wycats/thor/labels') { status 200 }
38
+ """
39
+ When I run `ghc label create wycats thor --params=name:bug color:f3f3f3`
40
+ Then the exit status should be 0
41
+
42
+ Scenario: Update label
43
+ Given the GitHub API server:
44
+ """
45
+ patch('/repos/wycats/thor/labels/1') { status 200 }
46
+ """
47
+ When I run `ghc label update wycats thor 1 --params=name:bug color:f3f3f3`
48
+ Then the exit status should be 0
49
+
50
+ Scenario: Delete label
51
+ Given the GitHub API server:
52
+ """
53
+ delete('/repos/wycats/thor/labels/1') { status 200 }
54
+ """
55
+ When I run `ghc label delete wycats thor 1`
56
+ Then the exit status should be 0
57
+
58
+ Scenario: Add labels
59
+ Given the GitHub API server:
60
+ """
61
+ post('/repos/wycats/thor/issues/1/labels') { status 200 }
62
+ """
63
+ When I run `ghc label add wycats thor 1 'bug' 'feature'`
64
+ Then the exit status should be 0
65
+
66
+ Scenario: Remove label from an issue
67
+ Given the GitHub API server:
68
+ """
69
+ delete('/repos/wycats/thor/issues/1/labels/2') { status 200 }
70
+ """
71
+ When I run `ghc label remove wycats thor 2/1`
72
+ Then the exit status should be 0
73
+
74
+ Scenario: Remove label from an issue
75
+ Given the GitHub API server:
76
+ """
77
+ delete('/repos/wycats/thor/issues/1/labels/2') { status 200 }
78
+ """
79
+ When I run `ghc label remove wycats thor 2/1`
80
+ Then the exit status should be 0
81
+
82
+ Scenario: Remove all labels from an issue
83
+ Given the GitHub API server:
84
+ """
85
+ delete('/repos/wycats/thor/issues/1/labels') { status 200 }
86
+ """
87
+ When I run `ghc label remove wycats thor 1`
88
+ Then the exit status should be 0
89
+
90
+ Scenario: Replace labels
91
+ Given the GitHub API server:
92
+ """
93
+ put('/repos/wycats/thor/issues/1/labels') { status 200 }
94
+ """
95
+ When I run `ghc label replace wycats thor 1 'bug' 'feature'`
96
+ Then the exit status should be 0
97
+
98
+ Scenario: Milestone labels
99
+ Given the GitHub API server:
100
+ """
101
+ get('/repos/wycats/thor/milestones/1/labels') { status 200 }
102
+ """
103
+ When I run `ghc label milestone wycats thor 1`
104
+ Then the exit status should be 0
105
+
@@ -10,7 +10,7 @@ Feature: Github API Commands Search
10
10
  Then the exit status should be 0
11
11
  And the output should contain:
12
12
  """
13
- Github CLI client
13
+ GitHub API v3 CLI client
14
14
 
15
15
  Commands:
16
16
  """
@@ -1,4 +1,5 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__) + '/../../lib')
2
2
  require 'aruba/cucumber'
3
+ require 'communist/cucumber'
3
4
  require 'fileutils'
4
5
  require 'rspec/expectations'
@@ -1,7 +1,7 @@
1
1
  require 'fileutils'
2
2
 
3
3
  Before do
4
- @aruba_timeout_seconds = 5
4
+ @aruba_timeout_seconds = 10
5
5
  @real_home = ENV['HOME']
6
6
  fake_home = File.join('/tmp', 'fakehome')
7
7
  FileUtils.rm_rf fake_home if File.exists? fake_home
data/github_cli.gemspec CHANGED
@@ -21,4 +21,5 @@ Gem::Specification.new do |gem|
21
21
  gem.add_development_dependency 'rspec'
22
22
  gem.add_development_dependency 'aruba'
23
23
  gem.add_development_dependency 'rake'
24
+ gem.add_development_dependency 'communist'
24
25
  end
@@ -22,6 +22,10 @@ module GithubCLI
22
22
  @@api = Github.new
23
23
  @@api.oauth_token = GithubCLI.config['oauth_token']
24
24
  @@api.basic_auth = GithubCLI.config['basic_auth']
25
+ puts "#{ENV['TEST_HOST']}"
26
+ if ENV['TEST_HOST']
27
+ @@api.endpoint = 'http://' + ENV['TEST_HOST']
28
+ end
25
29
  @@api
26
30
  end
27
31
 
@@ -16,6 +16,7 @@ end
16
16
  content
17
17
  download
18
18
  email
19
+ event
19
20
  follower
20
21
  fork
21
22
  gist
@@ -7,7 +7,7 @@ module GithubCLI
7
7
 
8
8
  def get(user, repo, sha, params, format)
9
9
  output format do
10
- github_api.git_data.blobs.get user, repo, params
10
+ github_api.git_data.blobs.get user, repo, sha, params
11
11
  end
12
12
  end
13
13
 
@@ -7,7 +7,7 @@ module GithubCLI
7
7
 
8
8
  def get(user, repo, sha, params, format)
9
9
  output format do
10
- github_api.git_data.commits.get user, repo, params
10
+ github_api.git_data.commits.get user, repo, sha, params
11
11
  end
12
12
  end
13
13
 
@@ -5,65 +5,63 @@ module GithubCLI
5
5
 
6
6
  class << self
7
7
 
8
- def all(params, format)
8
+ def all(user, repo, params, format)
9
9
  output format do
10
- github_api.issues.labels params
10
+ github_api.issues.labels.list user, repo, params
11
11
  end
12
12
  end
13
13
 
14
14
  def get(user, repo, name, params, format)
15
15
  output format do
16
- github_api.issues.get_label user, repo, name, params
16
+ github_api.issues.labels.get user, repo, name, params
17
17
  end
18
18
  end
19
19
 
20
20
  def create(user, repo, params, format)
21
21
  output format do
22
- github_api.issues.create_label user, repo, params
22
+ github_api.issues.labels.create user, repo, params
23
23
  end
24
24
  end
25
25
 
26
26
  def update(user, repo, name, params, format)
27
27
  output format do
28
- github_api.issues.update_label user, repo, params
28
+ github_api.issues.labels.update user, repo, name, params
29
29
  end
30
30
  end
31
31
 
32
32
  def delete(user, repo, name, params, format)
33
33
  output format do
34
- github_api.issues.delete_label user, repo, name, params
34
+ github_api.issues.labels.delete user, repo, name, params
35
35
  end
36
36
  end
37
37
 
38
- def issue(user, repo, number, params, format)
38
+ def issue(user, repo, issue_id, params, format)
39
39
  output format do
40
- github_api.issues.labels_for user, repo, number, params
40
+ github_api.issues.labels.issue user, repo, issue_id, params
41
41
  end
42
42
  end
43
43
 
44
- def add(user, repo, number, *args)
45
- # TODO extract params from args
46
- output :table do
47
- github_api.issues.add_labels user, repo, args
44
+ def add(user, repo, issue_id, *args, params, format)
45
+ output format do
46
+ github_api.issues.labels.add user, repo, issue_id, *args, params
48
47
  end
49
48
  end
50
49
 
51
- def remove(user, repo, number, name=nil, params, format)
50
+ def remove(user, repo, issue_id, label_id, params, format)
52
51
  output format do
53
- github_api.issues.remove_label user, repo, number, name, params
52
+ github_api.issues.labels.remove user, repo, issue_id, label_id, params
54
53
  end
55
54
  end
56
55
 
57
- def replace(user, repo, number, *args)
58
- # TODO extract params from args
59
- output :table do
60
- github_api.issues.replace_labels user, repo, number, args
56
+ def replace(user, repo, issue_id, *args, params, format)
57
+ output format do
58
+ github_api.issues.labels.replace user, repo, issue_id, *args, params
61
59
  end
62
60
  end
63
61
 
64
62
  def milestone(user, repo, number, params, format)
65
63
  output format do
66
- gitub_api.issues.milestone_labels user, repo, number, params
64
+ github_api.issues.labels.milestone user, repo, number, params
67
65
  end
68
66
  end
69
67
  end
@@ -22,7 +22,7 @@ module GithubCLI
22
22
 
23
23
  desc 'remove <user> <repo> <id>', 'Remove a collaborator'
24
24
  def remove(user, repo, collab)
25
- Collaborator.remove user, repo, collab, options[:params]. options[:format]
25
+ Collaborator.remove user, repo, collab, options[:params], options[:format]
26
26
  end
27
27
 
28
28
  end # Collaborators
@@ -23,7 +23,7 @@ module GithubCLI
23
23
 
24
24
  desc 'follower <user>', 'Check if you are following a user'
25
25
  def follower(user)
26
- Follower.following? user, options[:params], options[:format]
26
+ Follower.follower user, options[:params], options[:format]
27
27
  end
28
28
 
29
29
  desc 'follow <user>', 'Follow a user'
@@ -13,12 +13,14 @@ module GithubCLI
13
13
  :default => false,
14
14
  :desc => 'List the authenticated users starred gists'
15
15
  def list
16
- Gist.starred if options[:starred]
17
-
18
- if options[:user]
19
- options[:params]['user'] = options[:user]
16
+ if options[:starred]
17
+ Gist.starred options[:params], options[:format]
18
+ else
19
+ if options[:user]
20
+ options[:params]['user'] = options[:user]
21
+ end
22
+ Gist.all options[:params], options[:format]
20
23
  end
21
- Gist.all options[:params], options[:format]
22
24
  end
23
25
 
24
26
  desc 'get <id>', 'Get a single gist'
@@ -40,25 +40,20 @@ module GithubCLI
40
40
  Label.issue user, repo, number, options[:params], options[:format]
41
41
  end
42
42
 
43
- desc 'add <user> <repo> <number>', 'Add labels to an issue.'
44
- method_option :labels, :type => :string,
45
- :desc => 'Labels to be added to this issue.'
46
- def add(user, repo, number)
47
- Label.add user, repo, number, options[:labels], options[:params]
43
+ desc 'add <user> <repo> <issue_id> <label>[<label>...]', 'Add labels to <issue_id>.'
44
+ def add(user, repo, issue_id, *args)
45
+ Label.add user, repo, issue_id, *args, options[:params], options[:format]
48
46
  end
49
47
 
50
- desc 'remove <user> <repo> <number>', 'List labels on an issue.'
51
- method_option :name, :type => :string, :default => nil,
52
- :desc => 'Label name'
48
+ desc 'remove <user> <repo> [<label_id>/]<issue_id>', 'Remove <label_id> from an <issue_id>'
53
49
  def remove(user, repo, number)
54
- Label.issue user, repo, number, options[:name], options[:params], options[:format]
50
+ label_id, issue_id = Arguments.new(number).parse
51
+ Label.remove user, repo, issue_id, label_id, options[:params], options[:format]
55
52
  end
56
53
 
57
- desc 'replace <user> <repo> <number>', 'Replace all labels for an issue.'
58
- method_option :labels, :type => :string,
59
- :desc => 'Labels to be replace in this issue.'
60
- def replace(user, repo, number)
61
- Label.replace user, repo, number, options[:labels], options[:params]
54
+ desc 'replace <user> <repo> <issue_id> <label>[<label>...]', 'Replace all labels for an <issue_id>.'
55
+ def replace(user, repo, issue_id, *args)
56
+ Label.replace user, repo, issue_id, *args, options[:params], options[:format]
62
57
  end
63
58
 
64
59
  desc 'milestone <user> <repo> <number>', 'Get labels for every issue in a milestone.'
@@ -1,3 +1,3 @@
1
1
  module GithubCLI
2
- VERSION = "0.4.2"
2
+ VERSION = "0.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-12 00:00:00.000000000Z
12
+ date: 2012-07-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: github_api
16
- requirement: &2153403460 !ruby/object:Gem::Requirement
16
+ requirement: &2153314780 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153403460
24
+ version_requirements: *2153314780
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: thor
27
- requirement: &2153403000 !ruby/object:Gem::Requirement
27
+ requirement: &2153314140 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2153403000
35
+ version_requirements: *2153314140
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &2153402520 !ruby/object:Gem::Requirement
38
+ requirement: &2153313280 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2153402520
46
+ version_requirements: *2153313280
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: aruba
49
- requirement: &2153401860 !ruby/object:Gem::Requirement
49
+ requirement: &2153312620 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2153401860
57
+ version_requirements: *2153312620
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rake
60
- requirement: &2153401360 !ruby/object:Gem::Requirement
60
+ requirement: &2153311820 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,7 +65,18 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153401360
68
+ version_requirements: *2153311820
69
+ - !ruby/object:Gem::Dependency
70
+ name: communist
71
+ requirement: &2153311020 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2153311020
69
80
  description: CLI-based access to GitHub API v3
70
81
  email:
71
82
  - ''