githubstats 1.0.1 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/githubstats.gemspec +2 -2
- data/lib/githubstats.rb +28 -0
- data/lib/githubstats/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50f60efff64d0f16cb368e3964c32fca414f84f4
|
4
|
+
data.tar.gz: 761f7a06d141a84de7e452cf1069d9f41fcb4cf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11a06438ac2277e0074adab955fac78dd0a6519b991576e449a743a0e55275e5b20e7fc645401075ca336446139fd597d76701b9f38bc5965fc383bebe9b0afa
|
7
|
+
data.tar.gz: 398ddcd18a824f90b415a202b51d60ad4862a3861c5c7b8f1a98560a8facfae43ee5e5ba44874664676e2c2f791c1936031478f01974fe0ac48b1fe678f3b956
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 1.1.0 / 2015-08-19
|
2
|
+
|
3
|
+
* [FEATURE] For GitHub streaks longer than 1 year, GithubStats::User#streak and #longest_streak poll GitHub for the accurate streak size. The resulting array is left-padded with -1 entries for days with no known score
|
4
|
+
|
1
5
|
# 1.0.1 / 2015-07-16
|
2
6
|
|
3
7
|
* [ENHANCEMENT] Replace instance_eval with define_singleton_method for dynamic method passing
|
data/githubstats.gemspec
CHANGED
@@ -21,8 +21,8 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_runtime_dependency 'basiccache', '~> 1.0.0'
|
22
22
|
s.add_runtime_dependency 'nokogiri', '~> 1.6.5'
|
23
23
|
|
24
|
-
s.add_development_dependency 'timecop', '~> 0.
|
25
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
24
|
+
s.add_development_dependency 'timecop', '~> 0.8.0'
|
25
|
+
s.add_development_dependency 'rubocop', '~> 0.33.0'
|
26
26
|
s.add_development_dependency 'rake', '~> 10.4.0'
|
27
27
|
s.add_development_dependency 'coveralls', '~> 0.8.0'
|
28
28
|
s.add_development_dependency 'rspec', '~> 3.3.0'
|
data/lib/githubstats.rb
CHANGED
@@ -55,6 +55,24 @@ module GithubStats
|
|
55
55
|
end
|
56
56
|
alias_method :inspect, :to_s
|
57
57
|
|
58
|
+
##
|
59
|
+
# Set a custom streak that takes into account GitHub,
|
60
|
+
# which reports full length but only gives data for a year
|
61
|
+
|
62
|
+
def streak
|
63
|
+
naive = data.streak
|
64
|
+
return naive if naive.size < 365
|
65
|
+
[-1] * (real_streak_length - naive.size) + naive
|
66
|
+
end
|
67
|
+
|
68
|
+
##
|
69
|
+
# Set a custom longest_streak to account for the overriden streak
|
70
|
+
|
71
|
+
def longest_streak
|
72
|
+
return data.longest_streak if data.longest_streak.size < 365
|
73
|
+
streak
|
74
|
+
end
|
75
|
+
|
58
76
|
##
|
59
77
|
# Lazy loader for data
|
60
78
|
|
@@ -90,6 +108,16 @@ module GithubStats
|
|
90
108
|
@last_updated = DateTime.now
|
91
109
|
end
|
92
110
|
|
111
|
+
##
|
112
|
+
# Set a custom longest_streak that takes into account GitHub,
|
113
|
+
# which reports full length but only gives data for a year
|
114
|
+
|
115
|
+
def real_streak_length
|
116
|
+
url = @url.split('/users/').first + '/' + @name
|
117
|
+
data = Curl::Easy.perform(url).body_str
|
118
|
+
Nokogiri::HTML(data).css('.contrib-number').last.text.split.first.to_i
|
119
|
+
end
|
120
|
+
|
93
121
|
##
|
94
122
|
# Downloads new data from Github
|
95
123
|
|
data/lib/githubstats/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githubstats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.8.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.8.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.33.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.33.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|