github_cli 0.4.4 → 0.5.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.
Files changed (67) hide show
  1. data/.gitignore +1 -0
  2. data/.travis.yml +0 -2
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile.lock +9 -3
  5. data/README.md +68 -48
  6. data/Rakefile +47 -1
  7. data/bin/gcli +18 -0
  8. data/bin/ghc +1 -17
  9. data/features/blob.feature +6 -6
  10. data/features/collaborator.feature +10 -10
  11. data/features/commit.feature +6 -6
  12. data/features/completion.feature +3 -3
  13. data/features/config.feature +55 -0
  14. data/features/content.feature +9 -9
  15. data/features/download.feature +11 -11
  16. data/features/email.feature +8 -8
  17. data/features/errors.feature +11 -9
  18. data/features/event.feature +20 -20
  19. data/features/executable.feature +4 -4
  20. data/features/follower.feature +13 -13
  21. data/features/fork.feature +6 -6
  22. data/features/gist.feature +22 -22
  23. data/features/hook.feature +14 -14
  24. data/features/init.feature +48 -0
  25. data/features/issue.feature +12 -12
  26. data/features/key.feature +12 -12
  27. data/features/label.feature +23 -23
  28. data/features/member.feature +13 -13
  29. data/features/milestone.feature +12 -12
  30. data/features/organization.feature +9 -9
  31. data/features/pull_request.feature +18 -18
  32. data/features/reference.feature +13 -13
  33. data/features/repository.feature +20 -20
  34. data/features/search.feature +10 -10
  35. data/features/search_commands.feature +4 -4
  36. data/features/support/hooks.rb +3 -1
  37. data/features/tag.feature +6 -6
  38. data/features/team.feature +28 -28
  39. data/features/tree.feature +5 -5
  40. data/features/usage.feature +3 -3
  41. data/features/user.feature +7 -7
  42. data/features/watching.feature +13 -13
  43. data/fixtures/simple_config +9 -8
  44. data/github_cli.gemspec +2 -2
  45. data/lib/github_cli/api.rb +3 -3
  46. data/lib/github_cli/cli.rb +96 -17
  47. data/lib/github_cli/config.rb +30 -9
  48. data/lib/github_cli/editor.rb +11 -6
  49. data/lib/github_cli/man/gcli-config.1 +102 -0
  50. data/lib/github_cli/man/gcli-config.1.txt +96 -0
  51. data/lib/github_cli/man/gcli-repo.1 +16 -0
  52. data/lib/github_cli/man/gcli-repo.1.txt +15 -0
  53. data/lib/github_cli/man/gcli.1 +34 -0
  54. data/lib/github_cli/man/gcli.1.txt +33 -0
  55. data/lib/github_cli/manpage.rb +42 -0
  56. data/lib/github_cli/pager.rb +1 -1
  57. data/lib/github_cli/terminal.rb +8 -2
  58. data/lib/github_cli/thor_ext.rb +12 -1
  59. data/lib/github_cli/vendor.rb +10 -0
  60. data/lib/github_cli/version.rb +1 -1
  61. data/lib/github_cli.rb +7 -2
  62. data/man/gcli-config.1.ronn +82 -0
  63. data/man/gcli-repo.1.ronn +7 -0
  64. data/man/gcli.1.ronn +29 -0
  65. data/spec/github_cli/config_spec.rb +21 -7
  66. metadata +43 -22
  67. data/features/settings.feature +0 -35
data/man/gcli.1.ronn ADDED
@@ -0,0 +1,29 @@
1
+ gcli(1) -- Command Line Access to GitHub API v3
2
+ ===============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `gcli` COMMAND SUBCOMMAND [<args>]
7
+
8
+ ## DESCRIPTION
9
+
10
+ The `gcli` utility integrates command line with GitHub API v3.
11
+
12
+ ## OPTIONS
13
+
14
+ * `--token`:
15
+ Authentication token.
16
+
17
+ * `--no-color`:
18
+ Prints output without color.
19
+
20
+ * `--pager`:
21
+ Sets command to be used for paging results. This option can be also set in the
22
+ configuration file.
23
+
24
+ * `--verbose`:
25
+ Include
26
+
27
+ ## AUTHOR
28
+
29
+ Piotr Murach
@@ -20,11 +20,11 @@ describe GithubCLI::Config do
20
20
 
21
21
  context 'array access' do
22
22
  it 'returns value for the key' do
23
- config['basic_auth'].should == 'login:password'
23
+ config['auth.basic'].should == 'login:password'
24
24
  end
25
25
 
26
26
  it 'searches in commands' do
27
- config['issue-list'].should == { 'inputs' => 'ticket' }
27
+ config['issue.list'].should == { 'title' => 'ticket' }
28
28
  end
29
29
 
30
30
  it 'returns nil for missing key' do
@@ -34,7 +34,7 @@ describe GithubCLI::Config do
34
34
 
35
35
  context '#fetch' do
36
36
  it 'finds value' do
37
- config.fetch('oauth_token').should == 'ad7f9asdf97as98df7as9fd7'
37
+ config.fetch('auth.token').should == 'ad7f9asdf97as98df7as9fd7'
38
38
  end
39
39
 
40
40
  it 'uses default value' do
@@ -48,12 +48,27 @@ describe GithubCLI::Config do
48
48
  end
49
49
  end
50
50
 
51
+ context '#pretty' do
52
+ it 'collects options into array' do
53
+ options= {'auth.token' => 'abc123' }
54
+ config.stub(:all).and_return options
55
+ config.pretty.should == [['auth.token','abc123']]
56
+ end
57
+
58
+ it 'marks nil option value as undefined' do
59
+ options= {'option' => nil}
60
+ config.stub(:all).and_return options
61
+ config.pretty.should == [['option', 'UNDEFINED']]
62
+ end
63
+ end
64
+
51
65
  context '#save' do
52
66
  let(:attrs) { {} }
53
67
  let(:cmd) { stub(:cmd, :namespace => 'repo', :name => 'create') }
54
68
 
55
69
  before do
56
70
  GithubCLI::Command.stub(:all) { [cmd] }
71
+ File.stub(:open)
57
72
  end
58
73
 
59
74
  it 'saves config to yaml format' do
@@ -64,20 +79,19 @@ describe GithubCLI::Config do
64
79
 
65
80
  it 'retrieves api commands' do
66
81
  config.save attrs
67
- attrs.should have_key described_class::COMMAND_KEY
68
- attrs[described_class::COMMAND_KEY].should have_key 'repo-create'
82
+ attrs.should have_key 'commands.repo.create'
69
83
  end
70
84
 
71
85
  it 'skips commands with no namespace' do
72
86
  cmd.stub(:namespace) { '' }
73
87
  config.save attrs
74
- attrs[described_class::COMMAND_KEY].should be_empty
88
+ attrs.keys.should be_empty
75
89
  end
76
90
 
77
91
  it 'skips help commands' do
78
92
  cmd.stub(:name) { 'help' }
79
93
  config.save attrs
80
- attrs[described_class::COMMAND_KEY].should be_empty
94
+ attrs.keys.should be_empty
81
95
  end
82
96
  end
83
97
 
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.4
4
+ version: 0.5.0
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-15 00:00:00.000000000Z
12
+ date: 2012-08-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: github_api
16
- requirement: &2153331340 !ruby/object:Gem::Requirement
16
+ requirement: &2161175120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,21 +21,21 @@ dependencies:
21
21
  version: '0.6'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2153331340
24
+ version_requirements: *2161175120
25
25
  - !ruby/object:Gem::Dependency
26
- name: thor
27
- requirement: &2153330860 !ruby/object:Gem::Requirement
26
+ name: rspec
27
+ requirement: &2161174420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: '0'
33
- type: :runtime
33
+ type: :development
34
34
  prerelease: false
35
- version_requirements: *2153330860
35
+ version_requirements: *2161174420
36
36
  - !ruby/object:Gem::Dependency
37
- name: rspec
38
- requirement: &2153330160 !ruby/object:Gem::Requirement
37
+ name: aruba
38
+ requirement: &2161173120 !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: *2153330160
46
+ version_requirements: *2161173120
47
47
  - !ruby/object:Gem::Dependency
48
- name: aruba
49
- requirement: &2153329500 !ruby/object:Gem::Requirement
48
+ name: rake
49
+ requirement: &2161171840 !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: *2153329500
57
+ version_requirements: *2161171840
58
58
  - !ruby/object:Gem::Dependency
59
- name: rake
60
- requirement: &2153328840 !ruby/object:Gem::Requirement
59
+ name: communist
60
+ requirement: &2161171080 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2153328840
68
+ version_requirements: *2161171080
69
69
  - !ruby/object:Gem::Dependency
70
- name: communist
71
- requirement: &2153328140 !ruby/object:Gem::Requirement
70
+ name: ronn
71
+ requirement: &2161170300 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,11 +76,12 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2153328140
79
+ version_requirements: *2161170300
80
80
  description: CLI-based access to GitHub API v3
81
81
  email:
82
82
  - ''
83
83
  executables:
84
+ - gcli
84
85
  - ghc
85
86
  extensions: []
86
87
  extra_rdoc_files: []
@@ -95,11 +96,13 @@ files:
95
96
  - LICENSE
96
97
  - README.md
97
98
  - Rakefile
99
+ - bin/gcli
98
100
  - bin/ghc
99
101
  - features/blob.feature
100
102
  - features/collaborator.feature
101
103
  - features/commit.feature
102
104
  - features/completion.feature
105
+ - features/config.feature
103
106
  - features/content.feature
104
107
  - features/download.feature
105
108
  - features/email.feature
@@ -110,6 +113,7 @@ files:
110
113
  - features/fork.feature
111
114
  - features/gist.feature
112
115
  - features/hook.feature
116
+ - features/init.feature
113
117
  - features/issue.feature
114
118
  - features/key.feature
115
119
  - features/label.feature
@@ -121,7 +125,6 @@ files:
121
125
  - features/repository.feature
122
126
  - features/search.feature
123
127
  - features/search_commands.feature
124
- - features/settings.feature
125
128
  - features/support/env.rb
126
129
  - features/support/hooks.rb
127
130
  - features/tag.feature
@@ -205,6 +208,7 @@ files:
205
208
  - lib/github_cli/formatters/csv.rb
206
209
  - lib/github_cli/formatters/table.rb
207
210
  - lib/github_cli/helpers.rb
211
+ - lib/github_cli/manpage.rb
208
212
  - lib/github_cli/pager.rb
209
213
  - lib/github_cli/subcommands.rb
210
214
  - lib/github_cli/system.rb
@@ -212,7 +216,11 @@ files:
212
216
  - lib/github_cli/thor_ext.rb
213
217
  - lib/github_cli/ui.rb
214
218
  - lib/github_cli/util.rb
219
+ - lib/github_cli/vendor.rb
215
220
  - lib/github_cli/version.rb
221
+ - man/gcli-config.1.ronn
222
+ - man/gcli-repo.1.ronn
223
+ - man/gcli.1.ronn
216
224
  - spec/github_cli/api_spec.rb
217
225
  - spec/github_cli/cli_spec.rb
218
226
  - spec/github_cli/command_spec.rb
@@ -221,6 +229,12 @@ files:
221
229
  - spec/github_cli/pager_spec.rb
222
230
  - spec/github_cli/util_spec.rb
223
231
  - spec/spec_helper.rb
232
+ - lib/github_cli/man/gcli-config.1
233
+ - lib/github_cli/man/gcli-config.1.txt
234
+ - lib/github_cli/man/gcli-repo.1
235
+ - lib/github_cli/man/gcli-repo.1.txt
236
+ - lib/github_cli/man/gcli.1
237
+ - lib/github_cli/man/gcli.1.txt
224
238
  homepage: http://github.com/peter-murach/github_cli
225
239
  licenses: []
226
240
  post_install_message:
@@ -233,12 +247,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
233
247
  - - ! '>='
234
248
  - !ruby/object:Gem::Version
235
249
  version: '0'
250
+ segments:
251
+ - 0
252
+ hash: 183483969768155757
236
253
  required_rubygems_version: !ruby/object:Gem::Requirement
237
254
  none: false
238
255
  requirements:
239
256
  - - ! '>='
240
257
  - !ruby/object:Gem::Version
241
258
  version: '0'
259
+ segments:
260
+ - 0
261
+ hash: 183483969768155757
242
262
  requirements: []
243
263
  rubyforge_project:
244
264
  rubygems_version: 1.8.10
@@ -251,6 +271,7 @@ test_files:
251
271
  - features/collaborator.feature
252
272
  - features/commit.feature
253
273
  - features/completion.feature
274
+ - features/config.feature
254
275
  - features/content.feature
255
276
  - features/download.feature
256
277
  - features/email.feature
@@ -261,6 +282,7 @@ test_files:
261
282
  - features/fork.feature
262
283
  - features/gist.feature
263
284
  - features/hook.feature
285
+ - features/init.feature
264
286
  - features/issue.feature
265
287
  - features/key.feature
266
288
  - features/label.feature
@@ -272,7 +294,6 @@ test_files:
272
294
  - features/repository.feature
273
295
  - features/search.feature
274
296
  - features/search_commands.feature
275
- - features/settings.feature
276
297
  - features/support/env.rb
277
298
  - features/support/hooks.rb
278
299
  - features/tag.feature
@@ -1,35 +0,0 @@
1
- @settings
2
- Feature: Global Settings
3
-
4
- As a developer who wants to set global settings for interaction with GitHub API
5
- When I use interface provided by GHC
6
- I have ability to create configuration file
7
-
8
- Scenario: Installs Default Configuration File
9
- When I run `ghc init` interactively
10
- And I type "token"
11
- Then the output should contain:
12
- """
13
- Writing new configuration file to /tmp/fakehome/.githubrc
14
- """
15
- And a file named "/tmp/fakehome/.githubrc" should exist
16
- And the file "/tmp/fakehome/.githubrc" should contain "oauth_token: token"
17
-
18
- Scenario: Configuration File Exists
19
- Given an empty file named "/tmp/fakehome/.githubrc"
20
- When I run `ghc init`
21
- Then the output should contain:
22
- """
23
- Not overwritting existing config file /tmp/fakehome/.githubrc, use --force to override.
24
- """
25
-
26
- Scenario: Force Config File Override
27
- Given an empty file named "/tmp/fakehome/.githubrc"
28
- When I run `ghc init --force` interactively
29
- And I type "token"
30
- Then the output should contain:
31
- """
32
- Please specify your GitHub Authentication Token (register on github.com to get it):
33
- """
34
-
35
- Scenario: Check for presence of yaml attribute