github_streak_check 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/README.md +4 -0
- data/Rakefile +5 -0
- data/lib/github_streak_check/version.rb +1 -1
- data/lib/github_streak_check.rb +5 -9
- data/spec/github_streak_check_spec.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 211bb95c653fc218ff2df2b580498358a9e29e63
|
4
|
+
data.tar.gz: 742c3140e01e0fb1ee53c3a1d16916b64c354538
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d22c372291759035e239257240212842d3f3ca4cd118b786f924e909328b64f168bea2d6633bd1ab9093d9d6aa80f7308807d69991fcc19431c7e6884d3abcca
|
7
|
+
data.tar.gz: 93127b83905dd879be2c4ec36164639599eed9b090e99e1d4d73ecc6cd21332735ba17a0ab0fbaa0aa2a22143f84a7a712f010b69003537929b82e6944d43749
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -6,6 +6,8 @@ how many successive days the user is keep contributing.
|
|
6
6
|
This RubyGem provides a command to check if you have done today's
|
7
7
|
contribution and optionally send an email if not.
|
8
8
|
|
9
|
+
[![Build Status](https://travis-ci.org/yhara/github_streak_check.png?branch=master)](https://travis-ci.org/yhara/github_streak_check)
|
10
|
+
|
9
11
|
## Installation
|
10
12
|
|
11
13
|
$ gem i github_streak_check
|
@@ -31,6 +33,8 @@ way to send email; use /usr/sbin/sendmail if exists, then try to send with SMTP
|
|
31
33
|
|
32
34
|
## Limitations
|
33
35
|
|
36
|
+
IMPORTANT: this gem does not guarantee 100% accuracy!
|
37
|
+
|
34
38
|
- Private repos are not supported
|
35
39
|
- Commits to forked repo are not counted [unless it is merged to main repo](https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile), but github_streak_check returns OK for them, too
|
36
40
|
- Fetches only recent 300 events, so it may fail if you make over 300 commits a day.
|
data/Rakefile
CHANGED
data/lib/github_streak_check.rb
CHANGED
@@ -7,14 +7,16 @@ require 'pony'
|
|
7
7
|
class GithubStreakCheck
|
8
8
|
def initialize(opts)
|
9
9
|
@opts = opts
|
10
|
+
|
11
|
+
@pst = ActiveSupport::TimeZone["Pacific Time (US & Canada)"]
|
10
12
|
end
|
11
13
|
|
12
14
|
def run
|
13
15
|
if commited_today?
|
14
|
-
puts "Check OK: you've already done today(#{
|
16
|
+
puts "Check OK: you've already done today(#{@pst.today} PST)'s contribution."
|
15
17
|
exit 0
|
16
18
|
else
|
17
|
-
msg = "Check failed: You have not extended today(#{
|
19
|
+
msg = "Check failed: You have not extended today(#{@pst.today} PST)'s streak yet"
|
18
20
|
$stderr.puts msg
|
19
21
|
if (addr = @opts[:mail_to])
|
20
22
|
ret = Pony.mail(to: addr,
|
@@ -32,13 +34,7 @@ class GithubStreakCheck
|
|
32
34
|
return false if events.length == 0
|
33
35
|
|
34
36
|
return events.any?{|event|
|
35
|
-
Time.parse(event["created_at"]).to_date ==
|
37
|
+
Time.parse(event["created_at"]).in_time_zone(@pst).to_date == @pst.today
|
36
38
|
}
|
37
39
|
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def pst_today
|
42
|
-
@pst_today ||= ActiveSupport::TimeZone["Pacific Time (US & Canada)"].today
|
43
|
-
end
|
44
40
|
end
|
@@ -22,11 +22,11 @@ describe GithubStreakCheck do
|
|
22
22
|
it "<yesterday's event> : false" do
|
23
23
|
FakeWeb.register_uri(:get,
|
24
24
|
"https://api.github.com/users/#{@login}/events?per_page=300",
|
25
|
-
body: '[{"created_at":"2013-11-
|
26
|
-
# == "2013-11-
|
25
|
+
body: '[{"created_at":"2013-11-04T07:47:16Z"}]'
|
26
|
+
# == "2013-11-03T23:47:16-08:00"
|
27
27
|
|
28
28
|
)
|
29
|
-
Timecop.freeze(Time.parse("2013-11-
|
29
|
+
Timecop.freeze(Time.parse("2013-11-04T07:00:00-08:00")) do
|
30
30
|
expect(@checker.commited_today?).to be_false
|
31
31
|
end
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github_streak_check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yutaka HARA
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pony
|
@@ -117,6 +117,7 @@ extensions: []
|
|
117
117
|
extra_rdoc_files: []
|
118
118
|
files:
|
119
119
|
- .gitignore
|
120
|
+
- .travis.yml
|
120
121
|
- Gemfile
|
121
122
|
- README.md
|
122
123
|
- Rakefile
|