githubstats 1.3.1 → 1.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circle-ruby +3 -3
- data/.prospectus +21 -7
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +5 -0
- data/README.md +1 -1
- data/bin/githubstats +1 -1
- data/circle.yml +1 -0
- data/githubstats.gemspec +4 -4
- data/lib/githubstats.rb +3 -2
- data/lib/githubstats/data.rb +14 -8
- data/lib/githubstats/version.rb +2 -1
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3c307d3a81b095f9d6770eadfb18993ce55c93cf
|
4
|
+
data.tar.gz: c8ed40abb6f5172280d4beb99b0dc51d1b45cb99
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c6efa12319ea49fe4b8f979325d76caa829949ed625e39e672440f23bf8112ba22848216c5c94a4557b01f6918c4b1064dfeaefd21f0fd6f26a37cf6759ff38
|
7
|
+
data.tar.gz: 5c04f745c7b7e0f10e46831dcad1b1792863e6cf3c0c08b570dcaae718c38bfbdf96a6e78e67a7bdc15cb26ca7895ebb5857dd0ff3d843160bbca0ac2b4bb72c
|
data/.circle-ruby
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
2.
|
2
|
-
2.
|
3
|
-
2.
|
1
|
+
2.4.1
|
2
|
+
2.3.4
|
3
|
+
2.2.7
|
data/.prospectus
CHANGED
@@ -1,11 +1,25 @@
|
|
1
|
+
Prospectus.extra_dep('file', 'prospectus_circleci')
|
2
|
+
|
3
|
+
my_slug = 'akerl/githubstats'
|
4
|
+
|
1
5
|
item do
|
2
|
-
|
3
|
-
static
|
4
|
-
set 'green'
|
5
|
-
end
|
6
|
+
noop
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
deps do
|
9
|
+
item do
|
10
|
+
name 'gems'
|
11
|
+
|
12
|
+
expected do
|
13
|
+
static
|
14
|
+
set 'green'
|
15
|
+
end
|
16
|
+
|
17
|
+
actual do
|
18
|
+
gemnasium
|
19
|
+
slug my_slug
|
20
|
+
end
|
21
|
+
end
|
10
22
|
end
|
23
|
+
|
24
|
+
extend ProspectusCircleci::Build.new(my_slug)
|
11
25
|
end
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# 1.4.0 / 2017-06-09
|
2
|
+
|
3
|
+
* [ENHANCEMENT] Cache more data methods
|
4
|
+
* [ENHANCEMENT] Upgrade to latest Nokogiri minor release
|
5
|
+
|
1
6
|
# 1.3.0 / 2016-09-14
|
2
7
|
|
3
8
|
* [FEATURE] Re-adds support for streak lookups longer than 366 days from GitHub, now that they've brought back older commit info
|
data/README.md
CHANGED
@@ -3,7 +3,7 @@ GithubStats
|
|
3
3
|
|
4
4
|
[![Gem Version](https://img.shields.io/gem/v/githubstats.svg)](https://rubygems.org/gems/githubstats)
|
5
5
|
[![Dependency Status](https://img.shields.io/gemnasium/akerl/githubstats.svg)](https://gemnasium.com/akerl/githubstats)
|
6
|
-
[![Build Status](https://img.shields.io/circleci/project/akerl/githubstats.svg)](https://circleci.com/gh/akerl/githubstats)
|
6
|
+
[![Build Status](https://img.shields.io/circleci/project/akerl/githubstats/master.svg)](https://circleci.com/gh/akerl/githubstats)
|
7
7
|
[![Coverage Status](https://img.shields.io/codecov/c/github/akerl/githubstats.svg)](https://codecov.io/github/akerl/githubstats)
|
8
8
|
[![Code Quality](https://img.shields.io/codacy/d25d2521df3f4a6b8369edd419438d97.svg)](https://www.codacy.com/app/akerl/githubstats)
|
9
9
|
[![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
|
data/bin/githubstats
CHANGED
data/circle.yml
CHANGED
data/githubstats.gemspec
CHANGED
@@ -19,12 +19,12 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.add_runtime_dependency 'curb', '~> 0.9.0'
|
21
21
|
s.add_runtime_dependency 'basiccache', '~> 1.0.0'
|
22
|
-
s.add_runtime_dependency 'nokogiri', '~> 1.
|
22
|
+
s.add_runtime_dependency 'nokogiri', '~> 1.8.0'
|
23
23
|
|
24
24
|
s.add_development_dependency 'timecop', '~> 0.8.0'
|
25
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
26
|
-
s.add_development_dependency 'rake', '~>
|
25
|
+
s.add_development_dependency 'rubocop', '~> 0.49.0'
|
26
|
+
s.add_development_dependency 'rake', '~> 12.0.0'
|
27
27
|
s.add_development_dependency 'codecov', '~> 0.1.1'
|
28
|
-
s.add_development_dependency 'rspec', '~> 3.
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.6.0'
|
29
29
|
s.add_development_dependency 'fuubar', '~> 2.2.0'
|
30
30
|
end
|
data/lib/githubstats.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
+
|
2
3
|
require 'curb'
|
3
4
|
require 'json'
|
4
5
|
require 'nokogiri'
|
@@ -50,8 +51,8 @@ module GithubStats
|
|
50
51
|
@name = params[:name] || guess_user
|
51
52
|
@url = (params[:url] || DEFAULT_URL) % @name
|
52
53
|
@last_updated = nil
|
53
|
-
enable_caching [
|
54
|
-
|
54
|
+
enable_caching %i[streak longest_streak streaks real_streak
|
55
|
+
real_streak_start]
|
55
56
|
end
|
56
57
|
|
57
58
|
##
|
data/lib/githubstats/data.rb
CHANGED
@@ -30,15 +30,17 @@ module GithubStats
|
|
30
30
|
|
31
31
|
def initialize(data)
|
32
32
|
@raw = data.map { |d, s| Datapoint.new(Date.parse(d), s.to_i) }
|
33
|
-
enable_caching [
|
34
|
-
|
33
|
+
enable_caching %i[to_h today streaks longest_streak streak max mean
|
34
|
+
std_var quartile_boundaries quartiles]
|
35
35
|
end
|
36
36
|
|
37
37
|
##
|
38
38
|
# The data as a hash where the keys are dates and values are scores
|
39
39
|
|
40
40
|
def to_h
|
41
|
-
@raw.reduce(Hash.new(0))
|
41
|
+
@raw.reduce(Hash.new(0)) do |acc, elem|
|
42
|
+
acc.merge(elem.date => elem.score)
|
43
|
+
end
|
42
44
|
end
|
43
45
|
|
44
46
|
##
|
@@ -78,7 +80,7 @@ module GithubStats
|
|
78
80
|
|
79
81
|
def longest_streak
|
80
82
|
return [] if streaks.empty?
|
81
|
-
streaks.
|
83
|
+
streaks.max_by(&:length)
|
82
84
|
end
|
83
85
|
|
84
86
|
##
|
@@ -93,7 +95,7 @@ module GithubStats
|
|
93
95
|
# The highest scoring day
|
94
96
|
|
95
97
|
def max
|
96
|
-
@raw.
|
98
|
+
@raw.max_by(&:score)
|
97
99
|
end
|
98
100
|
|
99
101
|
##
|
@@ -107,7 +109,9 @@ module GithubStats
|
|
107
109
|
# The standard variance (two pass)
|
108
110
|
|
109
111
|
def std_var
|
110
|
-
first_pass = @raw.reduce(0)
|
112
|
+
first_pass = @raw.reduce(0) do |acc, elem|
|
113
|
+
(elem.score.to_f - mean)**2 + acc
|
114
|
+
end
|
111
115
|
Math.sqrt(first_pass / (@raw.size - 1))
|
112
116
|
end
|
113
117
|
|
@@ -124,7 +128,7 @@ module GithubStats
|
|
124
128
|
# They only consider the first 3 or 1, based on the mean and max of the set
|
125
129
|
|
126
130
|
def gh_outliers
|
127
|
-
outliers.take(
|
131
|
+
outliers.take(max.score - mean < 6 || max.score < 15 ? 1 : 3)
|
128
132
|
end
|
129
133
|
|
130
134
|
##
|
@@ -149,7 +153,9 @@ module GithubStats
|
|
149
153
|
|
150
154
|
def quartiles
|
151
155
|
quartiles = Array.new(5) { [] }
|
152
|
-
@raw.
|
156
|
+
@raw.each_with_object(quartiles) do |elem, acc|
|
157
|
+
acc[quartile(elem.score)] << elem
|
158
|
+
end
|
153
159
|
end
|
154
160
|
|
155
161
|
##
|
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.
|
4
|
+
version: 1.4.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:
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.8.0
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.8.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: timecop
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,28 +72,28 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.49.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.49.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rake
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 12.0.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 12.0.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: codecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.
|
117
|
+
version: 3.6.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 3.
|
124
|
+
version: 3.6.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fuubar
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
193
|
rubyforge_project:
|
194
|
-
rubygems_version: 2.
|
194
|
+
rubygems_version: 2.6.11
|
195
195
|
signing_key:
|
196
196
|
specification_version: 4
|
197
197
|
summary: Present Github contributions stats in a consumable format
|