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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 334ee21ca7fb6938f1db4dee0c756a4271bb95e8
4
- data.tar.gz: 34c665d0aae762ea44fd9226aef25f66880aaeda
3
+ metadata.gz: 3c307d3a81b095f9d6770eadfb18993ce55c93cf
4
+ data.tar.gz: c8ed40abb6f5172280d4beb99b0dc51d1b45cb99
5
5
  SHA512:
6
- metadata.gz: 19935983f0ab101ff208d2e0f1be1979368ccf83020c38292f03ecd4aff695901d719073a775638564a2b218c2f858b722d0913a67e73cb4510d7a282cb7e14d
7
- data.tar.gz: 10f8db4278cf6c2836c8544727ff780f9788a760dad1b01f7f9b1b7921611269c163f90bd9e5c2b8e59384f5c8d66eb935c6b5959b359c6e945499569e28db90
6
+ metadata.gz: 8c6efa12319ea49fe4b8f979325d76caa829949ed625e39e672440f23bf8112ba22848216c5c94a4557b01f6918c4b1064dfeaefd21f0fd6f26a37cf6759ff38
7
+ data.tar.gz: 5c04f745c7b7e0f10e46831dcad1b1792863e6cf3c0c08b570dcaae718c38bfbdf96a6e78e67a7bdc15cb26ca7895ebb5857dd0ff3d843160bbca0ac2b4bb72c
@@ -1,3 +1,3 @@
1
- 2.3.1
2
- 2.2.5
3
- 2.1.10
1
+ 2.4.1
2
+ 2.3.4
3
+ 2.2.7
@@ -1,11 +1,25 @@
1
+ Prospectus.extra_dep('file', 'prospectus_circleci')
2
+
3
+ my_slug = 'akerl/githubstats'
4
+
1
5
  item do
2
- expected do
3
- static
4
- set 'green'
5
- end
6
+ noop
6
7
 
7
- actual do
8
- gemnasium
9
- slug 'akerl/githubstats'
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
@@ -1,2 +1,4 @@
1
1
  Encoding:
2
2
  Enabled: false
3
+ Metrics/BlockLength:
4
+ Enabled: false
@@ -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)
@@ -3,7 +3,7 @@
3
3
  require 'githubstats'
4
4
  require 'optparse'
5
5
 
6
- opt = OptionParser.new do |opts|
6
+ OptionParser.new do |opts|
7
7
  opts.banner = 'Usage: githubstats [-h] [USER]'
8
8
  opts.on_tail('-v', '--version', 'Show version') do
9
9
  puts GithubStats::VERSION
data/circle.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  dependencies:
2
2
  override:
3
+ - 'for i in $(cat .circle-ruby) ; do rvm-exec $i gem update --system --no-doc || exit 1 ; done'
3
4
  - 'for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done'
4
5
  test:
5
6
  override:
@@ -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.6.5'
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.42.0'
26
- s.add_development_dependency 'rake', '~> 11.2.0'
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.5.0'
28
+ s.add_development_dependency 'rspec', '~> 3.6.0'
29
29
  s.add_development_dependency 'fuubar', '~> 2.2.0'
30
30
  end
@@ -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 [:streak, :longest_streak, :streaks, :real_streak,
54
- :real_streak_start]
54
+ enable_caching %i[streak longest_streak streaks real_streak
55
+ real_streak_start]
55
56
  end
56
57
 
57
58
  ##
@@ -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 [:to_h, :today, :streaks, :longest_streak, :streak, :max,
34
- :mean, :std_var, :quartile_boundaries, :quartiles]
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)) { |a, e| a.merge(e.date => e.score) }
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.max { |a, b| a.length <=> b.length }
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.max { |a, b| a.score <=> b.score }
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) { |a, e| (e.score.to_f - mean)**2 + a }
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(6 > max.score - mean || 15 > max.score ? 1 : 3)
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.reduce(quartiles) { |a, e| a[quartile(e.score)] << e && a }
156
+ @raw.each_with_object(quartiles) do |elem, acc|
157
+ acc[quartile(elem.score)] << elem
158
+ end
153
159
  end
154
160
 
155
161
  ##
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  ##
3
4
  # Define the version
4
5
  module GithubStats
5
- VERSION = '1.3.1'.freeze
6
+ VERSION = '1.4.0'.freeze
6
7
  end
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.3.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: 2016-09-16 00:00:00.000000000 Z
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.6.5
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.6.5
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.42.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.42.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: 11.2.0
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: 11.2.0
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.5.0
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.5.0
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.5.1
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