ghn 2.0.0 → 2.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a6a09393357c647c2c627461f53b357102c1f596
4
- data.tar.gz: 5dab77d48c3c86373fc24cb468844584efd4bb15
3
+ metadata.gz: bd7dc86da789c42cd537f64004c0a5e644094b73
4
+ data.tar.gz: d466cb5126eed061a205204f9eadb1508108d4d3
5
5
  SHA512:
6
- metadata.gz: 30b8ff9f8df0f64d6c3acdfe2e8de3d77d777c2b33de616ff20f86da90f493979ce344bafd8cc328f8975ef2591658e9d0db598213b061cb08271a8c6484897f
7
- data.tar.gz: 67ab8cbe8665db22ff685d9bf014589e37d5a38159bb26d62f26610d4edea09190a80b24b4d2436d926e7f6eef563a1a41c545fdced422a324138b841ed7f1bf
6
+ metadata.gz: baa4ec0020c19f9bd464b4f5bd7b487497baa4f434f40eaec27b4033afbd679b12c3594cedcb68055a8c6f9f8afeb9a64e491eca5e915ab3216db46d40520a04
7
+ data.tar.gz: 158384d2303d32765708bc144ae4902e3d193de1e822b30b029034eed55228d980a833fd59b8a3d9cfc3c9de8b3ab4df2c8b904d56510933df384bbecf335113
data/README.md CHANGED
@@ -20,7 +20,9 @@ Commands:
20
20
  ghn open NAME # Open unread notifications in browser
21
21
 
22
22
  Options:
23
- -a, [--all], [--no-all] # List/Open all unread notifications
23
+ -a, [--all], [--no-all] # List/Open all unread notifications
24
+ -p, [--participating], [--no-participating] # List/Open notifications your are participating
25
+ [--follow-issuecomment], [--no-follow-issuecomment] # Follow issuecomment anchor URL
24
26
  ```
25
27
 
26
28
  NAME should be a username/reponame of repository.
@@ -31,6 +33,8 @@ NAME should be a username/reponame of repository.
31
33
 
32
34
  `$ ghn open -a` opens all unread notifications in your browser.
33
35
 
36
+ `$ ghn open -p` opens notifications your are participating only.
37
+
34
38
  ## Aliases
35
39
 
36
40
  You can set aliases as a shortcut of NAME.
@@ -1,18 +1,19 @@
1
1
  class Ghn
2
2
  class Collector
3
- attr_reader :client, :repo_full_name, :follow_issuecomment
3
+ attr_reader :client, :repo_full_name, :follow_issuecomment, :participating
4
4
 
5
- def initialize(client, repo_full_name = nil, follow_issuecomment = false)
5
+ def initialize(client, repo_full_name = nil, options = {})
6
6
  @client = client
7
7
  @repo_full_name = repo_full_name
8
- @follow_issuecomment = follow_issuecomment
8
+ @follow_issuecomment = options[:follow_issuecomment] || false
9
+ @participating = options[:participating] || false
9
10
  end
10
11
 
11
12
  def collect(page = 1)
12
13
  notifications = if repo_full_name
13
- client.repo_notifications(repo_full_name, page: page)
14
+ client.repo_notifications(repo_full_name, page: page, participating: participating)
14
15
  else
15
- client.notifications(page: page)
16
+ client.notifications(page: page, participating: participating)
16
17
  end
17
18
  @count = notifications.count
18
19
  notifications.map { |notification|
@@ -1,6 +1,7 @@
1
1
  class Ghn
2
2
  class Commands < Thor
3
3
  class_option :all, type: :boolean, aliases: '-a', desc: 'List/Open all unread notifications'
4
+ class_option :participating, type: :boolean, aliases: '-p', desc: 'List/Open notifications your are participating'
4
5
  class_option :follow_issuecomment, type: :boolean, desc: 'Follow issuecomment anchor URL'
5
6
 
6
7
  desc 'list NAME', 'List unread notifications'
@@ -21,7 +22,7 @@ class Ghn
21
22
 
22
23
  def collect(repo_full_name = nil)
23
24
  threads = []
24
- collector = Collector.new(client, repo_full_name, follow_issuecomment?)
25
+ collector = Collector.new(client, repo_full_name, follow_issuecomment: follow_issuecomment?, participating: options['participating'])
25
26
  # Unfortunately, GitHub v3 Notifications API doesn't accept octokit's auto_paginate option
26
27
  # because this API doesn't return Link header so far.
27
28
  loop.with_index(1) do |_, page|
@@ -1,3 +1,3 @@
1
1
  class Ghn
2
- VERSION = "2.0.0"
2
+ VERSION = "2.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ghn
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kensuke Nagae
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-09-07 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor