github-nippou 2.0.0.beta1 → 2.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f0f13ef8692fd47c64b7406283ad0aa0fc38591
4
- data.tar.gz: 567ff11a390184d4e85e1c7ca04f02d74d25a7d7
3
+ metadata.gz: 9226aa472c621921b5a31036c2c7df5fc78911d9
4
+ data.tar.gz: f0e559b4e138f8d3c789792d90278caa5bd574a2
5
5
  SHA512:
6
- metadata.gz: 7173ae0ab09b35cff1bc6529f231fc1d6ddff2605134d591409493fef445d231932ee2b5ceb3b0fd50acbf792e2353040d216860ceac7ae733f2c9fa4816549a
7
- data.tar.gz: 4e234ec0584549fb6eaa188f73acbf8037db618730d845a66e4cac520c48cf6acad5b98467c9599e0111fa604ed560c49733136ef80c690d63ee732b83b0c056
6
+ metadata.gz: 1403f8e1db52980bd63ec5b0a2d55a5f65a43492c7467227be79c7aee80694bedf922e33420c52cd0107dab18f02e208c38cfa75be71ac3754e8023dd8d71f51
7
+ data.tar.gz: dea8ac039f0e9e499cebf089fc74621fcc301f0512cf6fc47d97c531c71fb849f6d999d6cdd6d60a8e7619c4876285d47d5ee465f3e3c4fe27a997f2ce45d43a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- github-nippou (2.0.0.beta1)
4
+ github-nippou (2.0.0.beta2)
5
5
  activesupport
6
6
  octokit
7
7
  thor
data/README.md CHANGED
@@ -35,9 +35,22 @@ Commands:
35
35
  github-nippou list # Displays today's GitHub events formatted for Nippou
36
36
 
37
37
  Options:
38
- a, [--all], [--no-all] # Also displays GitHub events before today
39
- n, [--num=N] # GitHub event numbers that retrieve from GitHub
40
- # Default: 50
38
+ s, [--since-date=SINCE_DATE] # Retrieves GitHub user_events since the date
39
+ # Default: 20160326
40
+ u, [--until-date=UNTIL_DATE] # Retrieves GitHub user_events until the date
41
+ # Default: 20160326
42
+ ```
43
+
44
+ You can get your GitHub Nippou on today.
45
+
46
+ ```
47
+ $ github-nippou list
48
+ * [Bundle Update on 2016-03-24 - masutaka/awesome-github-feed](https://github.com/masutaka/awesome-github-feed/pull/38) by deppbot **merged!**
49
+ * [Fix performance - masutaka/github-nippou](https://github.com/masutaka/github-nippou/pull/44) by masutaka **merged!**
50
+ * [Bundle Update on 2016-03-24 - masutaka/masutaka-29hours](https://github.com/masutaka/masutaka-29hours/pull/19) by deppbot **merged!**
51
+ * [Bundle Update on 2016-03-24 - masutaka/masutaka-metrics](https://github.com/masutaka/masutaka-metrics/pull/34) by deppbot **merged!**
52
+ * [bundle update at 2016-03-25 18:32:43 JST - masutaka/masutaka.net](https://github.com/masutaka/masutaka.net/pull/52) by masutaka **merged!**
53
+ * [bundle update at 2016-03-25 10:02:02 UTC - masutaka/server-masutaka.net](https://github.com/masutaka/server-masutaka.net/pull/211) by masutaka **merged!**
41
54
  ```
42
55
 
43
56
  You can omit the sub command `list`.
@@ -17,6 +17,9 @@ module Github
17
17
  class_option :since_date, type: :string,
18
18
  default: Time.now.strftime('%Y%m%d'),
19
19
  aliases: :s, desc: 'Retrieves GitHub user_events since the date'
20
+ class_option :until_date, type: :string,
21
+ default: Time.now.strftime('%Y%m%d'),
22
+ aliases: :u, desc: 'Retrieves GitHub user_events until the date'
20
23
 
21
24
  desc 'list', "Displays today's GitHub events formatted for Nippou"
22
25
  def list
@@ -52,7 +55,7 @@ module Github
52
55
 
53
56
  def user_events
54
57
  @user_events ||= UserEvents.new(
55
- client, user, options[:since_date]
58
+ client, user, options[:since_date], options[:until_date]
56
59
  ).retrieve
57
60
  end
58
61
 
@@ -106,7 +109,7 @@ MESSAGE
106
109
  title: issue.title.markdown_escape,
107
110
  repo_basename: repo_name,
108
111
  username: issue.user.login,
109
- merged: client.pull_merged?(repo_name, issue.number),
112
+ merged: issue.merged,
110
113
  state: issue.state,
111
114
  }
112
115
  end
@@ -118,7 +121,7 @@ MESSAGE
118
121
  title: pr.title.markdown_escape,
119
122
  repo_basename: repo_name,
120
123
  username: pr.user.login,
121
- merged: client.pull_merged?(repo_name, pr.number),
124
+ merged: pr.merged,
122
125
  state: pr.state,
123
126
  }
124
127
  end
@@ -4,17 +4,18 @@ require 'octokit'
4
4
  module Github
5
5
  module Nippou
6
6
  class UserEvents
7
- def initialize(client, user, since_date)
7
+ def initialize(client, user, since_date, until_date)
8
8
  @client = client
9
9
  @user = user
10
- @range = Time.parse(since_date)..Time.now.end_of_day
10
+ @since_date = Time.parse(since_date).beginning_of_day
11
+ @until_date = Time.parse(until_date).end_of_day
11
12
  end
12
13
 
13
14
  def retrieve
14
- user_events = @client.user_events(@user)
15
+ user_events = @client.user_events(@user, per_page: 100)
15
16
  last_response = @client.last_response
16
17
 
17
- while last_response.rels[:next] && in_range?(user_events.last)
18
+ while continue?(last_response, user_events)
18
19
  last_response = last_response.rels[:next].get
19
20
  user_events.concat(last_response.data)
20
21
  end
@@ -24,8 +25,13 @@ module Github
24
25
 
25
26
  private
26
27
 
28
+ def continue?(last_response, user_events)
29
+ last_response.rels[:next] &&
30
+ user_events.last.created_at.getlocal >= @since_date
31
+ end
32
+
27
33
  def in_range?(user_event)
28
- @range.include?(user_event.created_at.getlocal)
34
+ (@since_date..@until_date).include?(user_event.created_at.getlocal)
29
35
  end
30
36
  end
31
37
  end
@@ -1,5 +1,5 @@
1
1
  module Github
2
2
  module Nippou
3
- VERSION = '2.0.0.beta1'
3
+ VERSION = '2.0.0.beta2'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-nippou
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta1
4
+ version: 2.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Masuda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-24 00:00:00.000000000 Z
11
+ date: 2016-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport