github_cli 0.5.7 → 0.5.8

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ 0.5.8 (April 14, 2013)
2
+
3
+ * Change forks commands to take specific options and add tests
4
+ * Change statuses commands to take specific options and add tests
5
+ * Add authorize command for easy token creation
6
+ * Add whoami as convenience command for checking user
7
+ * Change content commands to take specific options and add tests
8
+ * Change blob create command to add specific options and tests
9
+ * Add remaining notify commands for full Notifications support
10
+ * Change merge command to take specific options and add tests
11
+
1
12
  0.5.7 (April 4, 2013)
2
13
 
3
14
  * Change apis.rb to dynamically load api files
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github_cli (0.5.7)
4
+ github_cli (0.5.8)
5
5
  github_api (~> 0.9)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -121,7 +121,7 @@ $ gcli config user.token '...'
121
121
 
122
122
  ### Arguments
123
123
 
124
- The required arguments come first as per command description, then are followed by the optional arguments supplied inside a `params` flag.
124
+ The required arguments come first as per command description, then are followed by the optional arguments supplied as specific options.
125
125
 
126
126
  For instance, one can create repository by supplying parameters in the following way:
127
127
 
@@ -135,6 +135,18 @@ To create repository inside organization:
135
135
  $ gcli repo create github/github_api --desc='Test repo for kitty.'
136
136
  ```
137
137
 
138
+ To provide array argument, pass space delimited strings like so
139
+
140
+ ```
141
+ $ gcli hook create <user> <repo> --events=push issues status
142
+ ```
143
+
144
+ To provide hash argument, pass space delimited key:value pairs such as
145
+
146
+ ```
147
+ $ gcli hook create <user> <repo> --config=url:"http://example.com/path" content_type:json
148
+ ```
149
+
138
150
  To find out which options are required and which are optional use `help` command:
139
151
 
140
152
  ```shell
@@ -1,12 +1,13 @@
1
1
  Feature: gcli content
2
2
 
3
+ @ci-run
3
4
  Scenario: Available commands
4
5
 
5
6
  When I run `gcli content`
6
7
  Then the exit status should be 0
7
- And the output should contain "gcli content get"
8
- And the output should contain "gcli content readme"
9
- And the output should contain "gcli content archive"
8
+ And the output should contain "content get"
9
+ And the output should contain "content readme"
10
+ And the output should contain "content archive"
10
11
 
11
12
  Scenario: Readme
12
13
  Given the GitHub API server:
@@ -37,5 +38,5 @@ Feature: gcli content
37
38
  """
38
39
  get('/repos/wycats/thor/tarball/new_feature') { status 200 }
39
40
  """
40
- When I run `gcli content archive wycats thor --params=archive_format:tarball ref:new_feature`
41
+ When I run `gcli content archive wycats thor --archive_format=tarball --ref=new_feature`
41
42
  Then the exit status should be 0
@@ -1,11 +1,12 @@
1
1
  Feature: gcli fork
2
2
 
3
+ @ci-run
3
4
  Scenario: Available commands
4
5
 
5
6
  When I run `gcli fork`
6
7
  Then the exit status should be 0
7
- And the output should contain "gcli fork create"
8
- And the output should contain "gcli fork list"
8
+ And the output should contain "fork create"
9
+ And the output should contain "fork list"
9
10
 
10
11
  Scenario: List forks
11
12
  Given the GitHub API server:
@@ -31,3 +31,51 @@ Feature: gcli notify
31
31
  """
32
32
  When I run `gcli notify get 1`
33
33
  Then the exit status should be 0
34
+
35
+ Scenario: Mark thread by id
36
+ Given the GitHub API server:
37
+ """
38
+ patch('/notifications/threads/1') { status 200 }
39
+ """
40
+ When I run `gcli notify mark --id=1`
41
+ Then the exit status should be 0
42
+
43
+ Scenario: Mark thread in repository
44
+ Given the GitHub API server:
45
+ """
46
+ put('/repos/wycats/thor/notifications') { status 200 }
47
+ """
48
+ When I run `gcli notify mark --user=wycats --repo=thor`
49
+ Then the exit status should be 0
50
+
51
+ Scenario: Mark thread for an authenticated user
52
+ Given the GitHub API server:
53
+ """
54
+ put('/notifications') { status 200 }
55
+ """
56
+ When I run `gcli notify mark`
57
+ Then the exit status should be 0
58
+
59
+ Scenario: Check thread by id
60
+ Given the GitHub API server:
61
+ """
62
+ get('/notifications/threads/1/subscription') { status 200 }
63
+ """
64
+ When I run `gcli notify check 1`
65
+ Then the exit status should be 0
66
+
67
+ Scenario: Create thread
68
+ Given the GitHub API server:
69
+ """
70
+ put('/notifications/threads/1/subscription') { status 200 }
71
+ """
72
+ When I run `gcli notify create 1`
73
+ Then the exit status should be 0
74
+
75
+ Scenario: Delete thread
76
+ Given the GitHub API server:
77
+ """
78
+ delete('/notifications/threads/1/subscription') { status 200 }
79
+ """
80
+ When I run `gcli notify delete 1`
81
+ Then the exit status should be 0
@@ -1,11 +1,12 @@
1
1
  Feature: gcli status
2
2
 
3
+ @ci-run
3
4
  Scenario: Available commands
4
5
 
5
6
  When I run `gcli status`
6
7
  Then the exit status should be 0
7
- And the output should contain "gcli status list"
8
- And the output should contain "gcli status create"
8
+ And the output should contain "status list"
9
+ And the output should contain "status create"
9
10
 
10
11
  Scenario: List statuses
11
12
  Given the GitHub API server:
@@ -30,7 +31,7 @@ Feature: gcli status
30
31
  status 200
31
32
  }
32
33
  """
33
- When I run `gcli status create wycats thor abc123 --params=state:pending`
34
+ When I run `gcli status create wycats thor abc123 --state=pending`
34
35
  Then the exit status should be 0
35
36
  And the stdout should contain "success"
36
37
 
@@ -39,7 +39,7 @@ module GithubCLI
39
39
  end
40
40
 
41
41
  def output(format=:table, &block)
42
- GithubCLI.on_error do
42
+ # GithubCLI.on_error do
43
43
  response = block.call
44
44
  if response.respond_to?(:body)
45
45
  formatter = Formatter.new response, :format => format
@@ -47,7 +47,7 @@ module GithubCLI
47
47
  else
48
48
  response
49
49
  end
50
- end
50
+ # end
51
51
  end
52
52
 
53
53
  end
@@ -16,6 +16,30 @@ module GithubCLI
16
16
  github_api.activity.notifications.get id, params
17
17
  end
18
18
  end
19
+
20
+ def mark(params, format)
21
+ output format do
22
+ github_api.activity.notifications.mark params
23
+ end
24
+ end
25
+
26
+ def subscribed?(id, params, format)
27
+ output format do
28
+ github_api.activity.notifications.subscribed? id, params
29
+ end
30
+ end
31
+
32
+ def create(id, params, format)
33
+ output format do
34
+ github_api.activity.notifications.create id, params
35
+ end
36
+ end
37
+
38
+ def delete(id, params, format)
39
+ output format do
40
+ github_api.activity.notifications.delete id, params
41
+ end
42
+ end
19
43
  end
20
44
 
21
45
  end # Notification
@@ -5,7 +5,7 @@ module GithubCLI
5
5
 
6
6
  class << self
7
7
 
8
- def list(user, repo, sha, params, format)
8
+ def all(user, repo, sha, params, format)
9
9
  output format do
10
10
  github_api.repos.statuses.list user, repo, sha, params
11
11
  end
@@ -44,7 +44,7 @@ module GithubCLI
44
44
  class_option :version, :type => :boolean, :aliases => ['-V'],
45
45
  :desc => "Show program version"
46
46
 
47
- no_tasks do
47
+ no_commands do
48
48
  def defaults
49
49
  {
50
50
  'user.token' => nil,
@@ -68,6 +68,43 @@ module GithubCLI
68
68
  end
69
69
  end
70
70
 
71
+ option :local, :type => :boolean, :default => false, :aliases => "-l",
72
+ :desc => 'Modify local configuration file, otherwise a global configuration file is changed.'
73
+ desc 'authorize', 'Add user authentication token'
74
+ long_desc <<-DESC
75
+ Create authorization token for a user named <username> Save user credentials to the .githubrc file.\n
76
+
77
+ The username, password, and email are read in from prompts.
78
+
79
+ You may use this command to change your details.
80
+ DESC
81
+ def authorize
82
+ params = {}
83
+ params['scopes'] = options[:scopes] || %w(public_repo repo)
84
+ params['note'] = options[:note] || 'github_cli'
85
+ params['note_url'] = options[:note_url] || 'https://github.com/peter-murach/github_cli'
86
+ # Need to configure client with login and password
87
+ res = self.invoke("auth:create", [], params)
88
+ token = res.body['token']
89
+
90
+ config = GithubCLI.config
91
+ config.location = options[:local] ? 'local' : 'global'
92
+ config['user.login'] = login
93
+ config['user.password'] = password
94
+ config['user.token'] = token
95
+
96
+ GithubCLI.ui.warn <<-EOF
97
+ Your #{GithubCLI.config.location} has been overwritten!
98
+ EOF
99
+ end
100
+
101
+ desc 'whoami', 'Print the username config to standard out'
102
+ def whoami
103
+ config = GithubCLI.config
104
+ me = config['user.login'] || "Not authed. Run 'gcli authorize'"
105
+ GithubCLI.ui.info me
106
+ end
107
+
71
108
  desc 'init', 'Create a configuration file or overwirte existing one'
72
109
  long_desc <<-DESC
73
110
  Initializes a configuration file where you can set default options for
@@ -77,21 +114,22 @@ module GithubCLI
77
114
  override the bult-in defaults and allow you to save typing commonly used
78
115
  command line options.
79
116
  DESC
80
- method_option :force, :type => :boolean, :default => false, :aliases => "-f",
81
- :banner => "Overwrite configuration file. "
82
- method_option :local, :type => :boolean, :default => false,
83
- :desc => 'Create local configuration file, otherwise a global configuration file in user home is created.'
117
+ option :force, :type => :boolean, :default => false, :aliases => "-f",
118
+ :banner => "Overwrite configuration file. "
119
+ option :local, :type => :boolean, :default => false, :aliases => "-l",
120
+ :desc => 'Create local configuration file, otherwise a global configuration file in user home is created.'
84
121
  def init(filename=nil)
85
122
  config_filename = filename ? filename : options[:filename]
86
- GithubCLI.config.filename = config_filename
87
- GithubCLI.config.location = options[:local] ? 'local' : 'global'
123
+ config = GithubCLI.config
124
+ config.filename = config_filename
125
+ config.location = options[:local] ? 'local' : 'global'
88
126
 
89
127
  if File.exists?(GithubCLI.config.path) && !options[:force]
90
128
  GithubCLI.ui.error "Not overwritting existing config file #{GithubCLI.config.path}, use --force to override."
91
129
  exit 1
92
130
  end
93
131
 
94
- GithubCLI.config.save(defaults)
132
+ config.save(defaults)
95
133
  GithubCLI.ui.confirm "Writing new configuration file to #{GithubCLI.config.path}"
96
134
  end
97
135
 
@@ -105,12 +143,12 @@ module GithubCLI
105
143
  There two types of config files, global and project specific. When modifying
106
144
  options ensure that you modifying the correct config.
107
145
  DESC
108
- method_option :local, :type => :boolean, :default => false,
109
- :desc => 'use local config file'
110
- method_option :list, :type => :boolean, :default => false, :aliases => '-l',
111
- :desc => 'list all'
112
- method_option :edit, :type => :boolean, :default => false, :aliases => '-e',
113
- :desc => 'opens an editor'
146
+ option :local, :type => :boolean, :default => false,
147
+ :desc => 'use local config file'
148
+ option :list, :type => :boolean, :default => false, :aliases => '-l',
149
+ :desc => 'list all'
150
+ option :edit, :type => :boolean, :default => false, :aliases => '-e',
151
+ :desc => 'opens an editor'
114
152
  def config(*args)
115
153
  name, value = args.shift, args.shift
116
154
  GithubCLI.config.location = options[:local] ? 'local' : 'global'
@@ -148,7 +186,7 @@ module GithubCLI
148
186
 
149
187
  desc 'version', 'Display Github CLI version.'
150
188
  def version
151
- GithubCLI.ui.info "#{GithubCLI.program_name} v#{GithubCLI::VERSION}"
189
+ GithubCLI.ui.info "#{GithubCLI.program_name} #{GithubCLI::VERSION}"
152
190
  end
153
191
 
154
192
  end # CLI
@@ -39,8 +39,8 @@ module GithubCLI
39
39
  DESC
40
40
  def create
41
41
  params = options[:params].dup
42
- params['scopes'] = options[:scopes] if options[:scopes]
43
- params['note'] = options[:note] if options[:note]
42
+ params['scopes'] = options[:scopes] if options[:scopes]
43
+ params['note'] = options[:note] if options[:note]
44
44
  params['note_url'] = options[:note_url] if options[:note_url]
45
45
  Authorization.create params, options[:format]
46
46
  end
@@ -67,11 +67,11 @@ module GithubCLI
67
67
  DESC
68
68
  def update(id)
69
69
  params = options[:params].dup
70
- params['scopes'] = options[:scopes] if options[:scopes]
71
- params['add_scopes'] = options[:add_scopes] if options[:add_scopes]
70
+ params['scopes'] = options[:scopes] if options[:scopes]
71
+ params['add_scopes'] = options[:add_scopes] if options[:add_scopes]
72
72
  params['remove_scopes'] = options[:remove_scopes] if options[:remove_scopes]
73
- params['note'] = options[:note] if options[:note]
74
- params['note_url'] = options[:note_url] if options[:note_url]
73
+ params['note'] = options[:note] if options[:note]
74
+ params['note_url'] = options[:note_url] if options[:note_url]
75
75
  Authorization.update id, params, options[:format]
76
76
  end
77
77
 
@@ -10,6 +10,9 @@ module GithubCLI
10
10
  Blob.get user, repo, sha, options[:params], options[:format]
11
11
  end
12
12
 
13
+ option :content, :type => :string
14
+ option :encoding, :type => :string, :banner => "utf-8|base64",
15
+ :desc => "String containing encoding utf-8 or base64"
13
16
  desc 'create <user> <repo>', 'Create a new Blob'
14
17
  long_desc <<-DESC
15
18
  Inputs
@@ -18,7 +21,11 @@ module GithubCLI
18
21
  encoding - String containing encoding utf-8 or base64
19
22
  DESC
20
23
  def create(user, repo)
21
- Blob.create user, repo, options[:params], options[:format]
24
+ params = options[:params].dup
25
+ params['content'] = options[:content] if options[:content]
26
+ params['encoding'] = options[:encoding] if options[:encoding]
27
+
28
+ Blob.create user, repo, params, options[:format]
22
29
  end
23
30
 
24
31
  end # Blobs
@@ -5,6 +5,8 @@ module GithubCLI
5
5
 
6
6
  namespace :content
7
7
 
8
+ option :ref, :type => :string,
9
+ :desc => "The String name of the Commit/Branch/Tag. Defaults to master."
8
10
  desc 'get <user> <repo> <path>', 'Get repository <path> contents'
9
11
  long_desc <<-DESC
10
12
  This method returns the contents of any file or directory in a repository.
@@ -14,9 +16,14 @@ module GithubCLI
14
16
  ref - Optional string - The String name of the Commit/Branch/Tag. Defaults to master.
15
17
  DESC
16
18
  def get(user, repo, path)
17
- Content.get user, repo, path, options[:params], options[:format]
19
+ params = options[:params].dup
20
+ params['ref'] = options[:ref] if options[:ref]
21
+
22
+ Content.get user, repo, path, params, options[:format]
18
23
  end
19
24
 
25
+ option :ref, :type => :string,
26
+ :desc => "The String name of the Commit/Branch/Tag. Defaults to master."
20
27
  desc 'readme <user> <repo>', 'Get the README'
21
28
  long_desc <<-DESC
22
29
  Parameters
@@ -24,9 +31,16 @@ module GithubCLI
24
31
  ref - Optional string - The String name of the Commit/Branch/Tag. Defaults to master.
25
32
  DESC
26
33
  def readme(user, repo)
27
- Content.readme user, repo, options[:params], options[:format]
34
+ params = options[:params].dup
35
+ params['ref'] = options[:ref] if options[:ref]
36
+
37
+ Content.readme user, repo, params, options[:format]
28
38
  end
29
39
 
40
+ option :ref, :type => :string,
41
+ :desc => "The String name of the Commit/Branch/Tag. Defaults to master."
42
+ option :archive_format, :type => :string, :banner => "tarball|zipball",
43
+ :desc => "Either tarball or zipball"
30
44
  desc 'archive <user> <repo>', 'Get archive link'
31
45
  long_desc <<-DESC
32
46
  This method will return a 302 to a URL to download a tarball or zipball
@@ -42,7 +56,11 @@ module GithubCLI
42
56
  ref - Optional string - valid Git reference, defaults to master\n
43
57
  DESC
44
58
  def archive(user, repo)
45
- Content.archive user, repo, options[:params], options[:format]
59
+ params = options[:params].dup
60
+ params['ref'] = options[:ref] if options[:ref]
61
+ params['archive_format'] = options[:archive_format] if options[:archive_format]
62
+
63
+ Content.archive user, repo, params, options[:format]
46
64
  end
47
65
 
48
66
  end # Contents
@@ -5,6 +5,9 @@ module GithubCLI
5
5
 
6
6
  namespace :fork
7
7
 
8
+ option :sort, :type => :string, :aliases => ["-s"],
9
+ :banner => '<sort-category>',
10
+ :desc => 'Sort by newest, oldest or watchers'
8
11
  desc 'list <user> <repo>', 'Lists forks'
9
12
  long_desc <<-DESC
10
13
  List repository forks
@@ -13,24 +16,21 @@ module GithubCLI
13
16
 
14
17
  sort - newest, oldest, watchers, default: newest
15
18
  DESC
16
- method_option :sort, :type => :string, :aliases => ["-s"],
17
- :desc => 'Sort by newest, oldest or watchers',
18
- :banner => '<sort-category>'
19
19
  def list(user, repo)
20
- if options[:sort]
21
- options[:params]['sort'] = options[:sort]
22
- end
23
- Fork.all user, repo, options[:params], options[:format]
20
+ params = options[:params].dup
21
+ params['sort'] = options[:sort] if options[:sort]
22
+
23
+ Fork.all user, repo, params, options[:format]
24
24
  end
25
25
 
26
+ option :org, :type => :string,
27
+ :desc => 'Organization login. The repository will be forked into this organization.'
26
28
  desc 'create <user> <repo>', 'Create a new fork'
27
- method_option :org, :type => :string,
28
- :desc => ' Organization login. The repository will be forked into this organization.'
29
29
  def create(user, repo)
30
- if options[:org]
31
- options[:params]['org'] = options[:org]
32
- end
33
- Fork.create user, repo, options[:params], options[:format]
30
+ params = options[:params].dup
31
+ params['organization'] = options[:org] if options[:org]
32
+
33
+ Fork.create user, repo, params, options[:format]
34
34
  end
35
35
 
36
36
  end # Forks
@@ -5,6 +5,12 @@ module GithubCLI
5
5
 
6
6
  namespace :merge
7
7
 
8
+ option :base, :type => :string, :required => true,
9
+ :desc => "The name of the base branch that the head will be merged into"
10
+ option :head, :type => :string, :required => true,
11
+ :desc => "The head to merge. This can be a branch name or a commit SHA1"
12
+ option :message, :type => :string,
13
+ :desc => "Commit message to use for the merge commit"
8
14
  desc 'perform <user> <repo>', 'Perform merge'
9
15
  long_desc <<-DESC
10
16
  Inputs
@@ -14,7 +20,12 @@ module GithubCLI
14
20
  commit_message - Optional String - Commit message to use for the merge commit. If omitted, a default message will be used.\n
15
21
  DESC
16
22
  def perform(user, repo)
17
- Merging.merge user, repo, options[:params], options[:format]
23
+ params = options[:params].dup
24
+ params['base'] = options[:base] if options[:base]
25
+ params['head'] = options[:head] if options[:head]
26
+ params['commit_message'] = options[:message] if options[:message]
27
+
28
+ Merging.merge user, repo, params, options[:format]
18
29
  end
19
30
 
20
31
  end # Merging
@@ -34,5 +34,52 @@ module GithubCLI
34
34
  Notification.get id, options[:params], options[:format]
35
35
  end
36
36
 
37
+ option :user, :type => :string, :aliases => ["-u"]
38
+ option :repo, :type => :string, :aliases => ["-r"]
39
+ option :read, :type => :boolean
40
+ option :id, :type => :numeric, :desc => "thread id to be marked"
41
+ desc 'mark', 'Mark as read'
42
+ def mark
43
+ params = options[:params].dup
44
+ params['user'] = options[:user] if options[:user]
45
+ params['repo'] = options[:repo] if options[:repo]
46
+ params['read'] = options[:read] if options[:read]
47
+ params['thread_id'] = options[:id] if options[:id]
48
+
49
+ Notification.mark params, options[:format]
50
+ end
51
+
52
+ desc 'check', 'Check to see if the current user is subscribed to a thread'
53
+ def check(id)
54
+ params = options[:params].dup
55
+
56
+ Notification.subscribed? id, params, options[:format]
57
+ end
58
+
59
+ option :subscribed, :type => :boolean,
60
+ :desc => 'determines if notifications should be received from this thread'
61
+ option :ignored, :type => :boolean,
62
+ :desc => 'determines if all notifications should be blocked from this thread'
63
+ desc 'create', 'Create a thread subscription'
64
+ long_desc <<-DESC
65
+ This lets you subscribe to a thread, or ignore it. Subscribing to a thread
66
+ is unnecessary if the user is already subscribed to the repository. Ignoring
67
+ a thread will mute all future notifications (until you comment or get @mentioned).
68
+ DESC
69
+ def create(id)
70
+ params = options[:params].dup
71
+ params['subscribed'] = options[:subscribed] if options[:subscrirbed]
72
+ params['ignored'] = options[:ignored] if options[:ignored]
73
+
74
+ Notification.create id, params, options[:format]
75
+ end
76
+
77
+ desc 'delete', 'Delete a thread subscription'
78
+ def delete(id)
79
+ params = options[:params].dup
80
+
81
+ Notification.delete id, params, options[:format]
82
+ end
83
+
37
84
  end # Notifications
38
85
  end # GithubCLI
@@ -7,9 +7,15 @@ module GithubCLI
7
7
 
8
8
  desc 'list <user> <repo> <sha>', 'Lists statuses for a <sha>'
9
9
  def list(user, repo, sha)
10
- Status.list user, repo, sha, options[:params], options[:format]
10
+ Status.all user, repo, sha, options[:params], options[:format]
11
11
  end
12
12
 
13
+ option :state, :type => :string, :required => true,
14
+ :banner => "pending|success|error|failure",
15
+ :desc => "State of the status"
16
+ option :target, :type => :string, :banner => "url",
17
+ :desc => "Target url to associate with this status"
18
+ option :desc, :type => :string, :desc => "Short description of the status"
13
19
  desc 'create <user> <repo> <sha>', 'Create a status'
14
20
  long_desc <<-DESC
15
21
  Inputs
@@ -19,7 +25,12 @@ module GithubCLI
19
25
  description - Optional string - Short description of the status\n
20
26
  DESC
21
27
  def create(user, repo, sha)
22
- Status.create user, repo, sha, options[:params], options[:format]
28
+ params = options[:params].dup
29
+ params['state'] = options[:state] if options[:state]
30
+ params['target_url'] = options[:target] if options[:target]
31
+ params['description'] = options[:desc] if options[:desc]
32
+
33
+ Status.create user, repo, sha, params, options[:format]
23
34
  end
24
35
 
25
36
  end # Statuses
@@ -19,6 +19,10 @@ module GithubCLI
19
19
  def on_error
20
20
  yield
21
21
  rescue Exception => error
22
+ handle_error(error)
23
+ end
24
+
25
+ def handle_error(error)
22
26
  case error
23
27
  when Github::Error::NotFound
24
28
  terminal.newline
@@ -5,7 +5,11 @@ module GithubCLI
5
5
  extend self
6
6
 
7
7
  MANPAGES = %w[
8
+ gcli-authorize.1
8
9
  gcli-config.1
10
+ gcli-repo.1
11
+ gcli.1
12
+ gcli-whoami.1
9
13
  ]
10
14
 
11
15
  def has?(command)
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
2
 
3
3
  module GithubCLI
4
- VERSION = "0.5.7"
4
+ VERSION = "0.5.8"
5
5
  end
@@ -0,0 +1,19 @@
1
+ gcli-authorize(1) -- Add a authentication token
2
+ ===============================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `gcli authorize` [--local]
7
+
8
+ ## DESCRIPTION
9
+
10
+ Create authentication token for a user named <login> in the GitHub, and
11
+ save the credentials to the `.githubrc` file.
12
+
13
+ The login, password, and email are read in from prompts.
14
+
15
+ ## SEE ALSO
16
+
17
+ * gcli-auth(1)
18
+ * gcli-config(1)
19
+ * gcli-whoami(1)
data/man/gcli-repo.1.ronn CHANGED
@@ -3,5 +3,18 @@ gcli-repo(1) - Manage repository data
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
+ `gcli repo` `branch` <user> <repo> <name><br>
6
7
  `gcli repo` `branches` user repo<br>
7
8
  `gcli repo` `contribs|contributors` user repo<br>
9
+ `gcli repo` `create` [<org>/]<name><br>
10
+ `gcli repo` `delete` <user> <repo><br>
11
+ `gcli repo` `edit` <user> <repo> <name><br>
12
+ `gcli repo` `get` <user> <repo><br>
13
+ `gcli repo` `langs` <user> <repo><br>
14
+ `gcli repo` `list`<br>
15
+ `gcli repo` `tags` <user> <repo><br>
16
+ `gcli repo` `teams` <user> <repo><br>
17
+
18
+ ## DESCRIPTION
19
+
20
+ Manage GitHub repositories through the underlying API HTTP methods.
@@ -0,0 +1,10 @@
1
+ gcli-whoami(1) - Display gcli username
2
+ ======================================
3
+
4
+ ## SYNOPSIS
5
+
6
+ `gcli whoami`
7
+
8
+ ## SEE ALSO
9
+
10
+ * gcli-config(1)
data/man/gcli.1.ronn CHANGED
@@ -3,7 +3,7 @@ gcli(1) -- Command Line Access to GitHub API v3
3
3
 
4
4
  ## SYNOPSIS
5
5
 
6
- `gcli` COMMAND SUBCOMMAND [<args>]
6
+ `gcli` <command> <subcommand> [<args>]
7
7
 
8
8
  ## DESCRIPTION
9
9
 
@@ -18,4 +18,9 @@ describe GithubCLI::Commands::Blobs do
18
18
  api_class.should_receive(:create).with(user, repo, {}, format)
19
19
  subject.invoke "blob:create", [user, repo]
20
20
  end
21
+
22
+ it "invokes blob:create --encoding" do
23
+ api_class.should_receive(:create).with(user, repo, {'encoding'=>'utf-8'}, format)
24
+ subject.invoke "blob:create", [user, repo], :encoding => 'utf-8'
25
+ end
21
26
  end
@@ -0,0 +1,41 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Contents do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:path) { 'README.md' }
10
+ let(:api_class) { GithubCLI::Content }
11
+
12
+ it "invokes content:readme" do
13
+ api_class.should_receive(:readme).with(user, repo, {}, format)
14
+ subject.invoke "content:readme", [user, repo]
15
+ end
16
+
17
+ it "invokes content:readme --ref" do
18
+ api_class.should_receive(:readme).with(user, repo, {'ref'=>'master'}, format)
19
+ subject.invoke "content:readme", [user, repo], :ref => "master"
20
+ end
21
+
22
+ it "invokes content:get" do
23
+ api_class.should_receive(:get).with(user, repo, path, {}, format)
24
+ subject.invoke "content:get", [user, repo, path]
25
+ end
26
+
27
+ it "invokes content:get --ref" do
28
+ api_class.should_receive(:get).with(user, repo, path,{'ref'=>'master'},format)
29
+ subject.invoke "content:get", [user, repo, path], :ref => "master"
30
+ end
31
+
32
+ it "invokes content:archive" do
33
+ api_class.should_receive(:archive).with(user, repo, {}, format)
34
+ subject.invoke "content:archive", [user, repo]
35
+ end
36
+
37
+ it "invokes content:archive --ref" do
38
+ api_class.should_receive(:archive).with(user, repo, {'ref'=>'master'}, format)
39
+ subject.invoke "content:archive", [user, repo], :ref => 'master'
40
+ end
41
+ end
@@ -0,0 +1,30 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Forks do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:api_class) { GithubCLI::Fork }
10
+
11
+ it "invokes fork:list" do
12
+ api_class.should_receive(:all).with(user, repo, {}, format)
13
+ subject.invoke "fork:list", [user, repo]
14
+ end
15
+
16
+ it "invokes fork:list --sort" do
17
+ api_class.should_receive(:all).with(user, repo, {'sort' => 'newest'}, format)
18
+ subject.invoke "fork:list", [user, repo], :sort => 'newest'
19
+ end
20
+
21
+ it "invokes fork:create" do
22
+ api_class.should_receive(:create).with(user, repo, {}, format)
23
+ subject.invoke "fork:create", [user, repo]
24
+ end
25
+
26
+ it "invokes fork:create --org" do
27
+ api_class.should_receive(:create).with(user, repo, {'organization' => 'rails'}, format)
28
+ subject.invoke "fork:create", [user, repo], :org => 'rails'
29
+ end
30
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Merging do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:id) { 1 }
10
+ let(:api_class) { GithubCLI::Merging }
11
+
12
+ it "invokes merge:perform" do
13
+ api_class.should_receive(:merge).with(user, repo, {'base'=>'master', 'head'=>'feature'}, format)
14
+ subject.invoke "merge:perform", [user, repo], :base => 'master', :head => 'feature'
15
+ end
16
+
17
+ end
@@ -23,4 +23,35 @@ describe GithubCLI::Commands::Notifications do
23
23
  api_class.should_receive(:get).with(id, {}, format)
24
24
  subject.invoke "notify:get", [id]
25
25
  end
26
+
27
+ it "invokes notify:mark" do
28
+ api_class.should_receive(:mark).with({'read'=>true}, format)
29
+ subject.invoke "notify:mark", [], :read => true
30
+ end
31
+
32
+ it "invokes notify:mark --id" do
33
+ api_class.should_receive(:mark).with({'thread_id'=>id,'read'=>true}, format)
34
+ subject.invoke "notify:mark", [], :id => id, :read => true
35
+ end
36
+
37
+ it "invokes notify:mark --user --repo" do
38
+ api_class.should_receive(:mark).with({'user'=>user,'repo'=>repo}, format)
39
+ subject.invoke "notify:mark", [], :user => user, :repo => repo
40
+ end
41
+
42
+ it "invokes notify:check" do
43
+ api_class.should_receive(:subscribed?).with(id, {}, format)
44
+ subject.invoke "notify:check", [id]
45
+ end
46
+
47
+ it "invokes notify:create" do
48
+ api_class.should_receive(:create).with(id, {}, format)
49
+ subject.invoke "notify:create", [id]
50
+ end
51
+
52
+ it "invokes notify:delete" do
53
+ api_class.should_receive(:delete).with(id, {}, format)
54
+ subject.invoke "notify:delete", [id]
55
+ end
56
+
26
57
  end
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe GithubCLI::Commands::Statuses do
6
+ let(:format) { 'table' }
7
+ let(:user) { 'peter-murach' }
8
+ let(:repo) { 'github_cli' }
9
+ let(:sha) { '7f86c1b73255d4409348d68eb75f7cbbc2aa5c74' }
10
+ let(:api_class) { GithubCLI::Status }
11
+
12
+ it "invokes status:list" do
13
+ api_class.should_receive(:all).with(user, repo, sha, {}, format)
14
+ subject.invoke "status:list", [user, repo, sha]
15
+ end
16
+
17
+ it "invokes status:create" do
18
+ api_class.should_receive(:create).with(user, repo, sha, {}, format)
19
+ subject.invoke "status:create", [user, repo, sha]
20
+ end
21
+
22
+ it "invokes status:create --state --target" do
23
+ api_class.should_receive(:create).with(user, repo, sha,
24
+ {'state' => 'pending', 'target_url' => 'http://ci.example.com'}, format)
25
+ subject.invoke "status:create", [user, repo, sha], :state => 'pending',
26
+ :target => "http://ci.example.com"
27
+ end
28
+ 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.5.7
4
+ version: 0.5.8
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: 2013-04-04 00:00:00.000000000Z
12
+ date: 2013-04-14 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: github_api
16
- requirement: &2156751040 !ruby/object:Gem::Requirement
16
+ requirement: &2153460920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156751040
24
+ version_requirements: *2153460920
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &2156750320 !ruby/object:Gem::Requirement
27
+ requirement: &2153460520 !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: :development
34
34
  prerelease: false
35
- version_requirements: *2156750320
35
+ version_requirements: *2153460520
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: aruba
38
- requirement: &2156749380 !ruby/object:Gem::Requirement
38
+ requirement: &2153459940 !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: *2156749380
46
+ version_requirements: *2153459940
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rake
49
- requirement: &2156748600 !ruby/object:Gem::Requirement
49
+ requirement: &2153459420 !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: *2156748600
57
+ version_requirements: *2153459420
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: communist
60
- requirement: &2156748040 !ruby/object:Gem::Requirement
60
+ requirement: &2153458960 !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: *2156748040
68
+ version_requirements: *2153458960
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: ronn
71
- requirement: &2156747420 !ruby/object:Gem::Requirement
71
+ requirement: &2153458380 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2156747420
79
+ version_requirements: *2153458380
80
80
  description: CLI-based access to GitHub API v3
81
81
  email:
82
82
  - ''
@@ -259,8 +259,10 @@ files:
259
259
  - lib/github_cli/vendor/thor/util.rb
260
260
  - lib/github_cli/vendor/thor/version.rb
261
261
  - lib/github_cli/version.rb
262
+ - man/gcli-authorize.1.ronn
262
263
  - man/gcli-config.1.ronn
263
264
  - man/gcli-repo.1.ronn
265
+ - man/gcli-whoami.1.ronn
264
266
  - man/gcli.1.ronn
265
267
  - screenshots/command.png
266
268
  - screenshots/interface.png
@@ -272,20 +274,24 @@ files:
272
274
  - spec/github_cli/commands/blobs_spec.rb
273
275
  - spec/github_cli/commands/collaborators_spec.rb
274
276
  - spec/github_cli/commands/commits_spec.rb
277
+ - spec/github_cli/commands/contents_spec.rb
275
278
  - spec/github_cli/commands/emails_spec.rb
276
279
  - spec/github_cli/commands/events_spec.rb
277
280
  - spec/github_cli/commands/followers_spec.rb
281
+ - spec/github_cli/commands/forks_spec.rb
278
282
  - spec/github_cli/commands/gists_spec.rb
279
283
  - spec/github_cli/commands/hooks_spec.rb
280
284
  - spec/github_cli/commands/issues_spec.rb
281
285
  - spec/github_cli/commands/keys_spec.rb
282
286
  - spec/github_cli/commands/labels_spec.rb
287
+ - spec/github_cli/commands/merging_spec.rb
283
288
  - spec/github_cli/commands/milestones_spec.rb
284
289
  - spec/github_cli/commands/notifications_spec.rb
285
290
  - spec/github_cli/commands/pull_requests_spec.rb
286
291
  - spec/github_cli/commands/references_spec.rb
287
292
  - spec/github_cli/commands/repositories_spec.rb
288
293
  - spec/github_cli/commands/starring_spec.rb
294
+ - spec/github_cli/commands/statuses_spec.rb
289
295
  - spec/github_cli/commands/tags_spec.rb
290
296
  - spec/github_cli/commands/teams_spec.rb
291
297
  - spec/github_cli/commands/trees_spec.rb
@@ -298,10 +304,16 @@ files:
298
304
  - spec/github_cli/util/convert_values_spec.rb
299
305
  - spec/github_cli/util_spec.rb
300
306
  - spec/spec_helper.rb
307
+ - lib/github_cli/man/gcli-adduser.1
308
+ - lib/github_cli/man/gcli-adduser.1.txt
309
+ - lib/github_cli/man/gcli-authorize.1
310
+ - lib/github_cli/man/gcli-authorize.1.txt
301
311
  - lib/github_cli/man/gcli-config.1
302
312
  - lib/github_cli/man/gcli-config.1.txt
303
313
  - lib/github_cli/man/gcli-repo.1
304
314
  - lib/github_cli/man/gcli-repo.1.txt
315
+ - lib/github_cli/man/gcli-whoami.1
316
+ - lib/github_cli/man/gcli-whoami.1.txt
305
317
  - lib/github_cli/man/gcli.1
306
318
  - lib/github_cli/man/gcli.1.txt
307
319
  homepage: http://github.com/peter-murach/github_cli
@@ -378,20 +390,24 @@ test_files:
378
390
  - spec/github_cli/commands/blobs_spec.rb
379
391
  - spec/github_cli/commands/collaborators_spec.rb
380
392
  - spec/github_cli/commands/commits_spec.rb
393
+ - spec/github_cli/commands/contents_spec.rb
381
394
  - spec/github_cli/commands/emails_spec.rb
382
395
  - spec/github_cli/commands/events_spec.rb
383
396
  - spec/github_cli/commands/followers_spec.rb
397
+ - spec/github_cli/commands/forks_spec.rb
384
398
  - spec/github_cli/commands/gists_spec.rb
385
399
  - spec/github_cli/commands/hooks_spec.rb
386
400
  - spec/github_cli/commands/issues_spec.rb
387
401
  - spec/github_cli/commands/keys_spec.rb
388
402
  - spec/github_cli/commands/labels_spec.rb
403
+ - spec/github_cli/commands/merging_spec.rb
389
404
  - spec/github_cli/commands/milestones_spec.rb
390
405
  - spec/github_cli/commands/notifications_spec.rb
391
406
  - spec/github_cli/commands/pull_requests_spec.rb
392
407
  - spec/github_cli/commands/references_spec.rb
393
408
  - spec/github_cli/commands/repositories_spec.rb
394
409
  - spec/github_cli/commands/starring_spec.rb
410
+ - spec/github_cli/commands/statuses_spec.rb
395
411
  - spec/github_cli/commands/tags_spec.rb
396
412
  - spec/github_cli/commands/teams_spec.rb
397
413
  - spec/github_cli/commands/trees_spec.rb