githubstats 3.2.0 → 3.3.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
  SHA256:
3
- metadata.gz: aa26d02c85e58b01ee8553a90a628aed98fa010b89142b056187d28467eb710a
4
- data.tar.gz: b6671f2fa390ad49016cee0bc816a28d7063f7d2fc48a8b60aff5a6c4ebccdc0
3
+ metadata.gz: 92f3eb1f61af9163e2b683c942b25f08def1fda5abe252e6c62b87fc54678e88
4
+ data.tar.gz: 42b058fbc533b8da30ee503ef749379a9ea2d99beff3c8ea02334c1bc89f06d1
5
5
  SHA512:
6
- metadata.gz: 4de055321d31ac225c4b519866a6a475268e20117daa8ba5f93164bfb00531d79722efadfe9bb655d81dc1cda91bb20d809f3d8c61657e1290b94e53f7c33f06
7
- data.tar.gz: 7dd16f5fcb857c6f312123969f469080247886463d708fb270770bd169b35e1f192ae26e1dbc5b879d91a4c843bccabd7be72521b1f08b27f727e5c45647683f
6
+ metadata.gz: 88ffca14f54e80e5293385b4215876ea3daf6cb0675b3c7de35377cf0b766bbb7f0a248021c569a6aaa9b1ffe5b3a12aa06521886fe7882d919b5ccb3deda464
7
+ data.tar.gz: 67b31d0fd88a57f8874621fb5edc50faa600a996a5985c9348586b7ecc6b9f83fab42621044a581a5a40e884586fbd3e1625f273273f48a34d9ef9654dbe1a59
@@ -0,0 +1,46 @@
1
+ name: Build
2
+ on:
3
+ pull_request:
4
+ push:
5
+ jobs:
6
+ build:
7
+ name: Build
8
+ runs-on: ubuntu-22.04
9
+ permissions:
10
+ contents: write
11
+ steps:
12
+ - name: Checkout
13
+ uses: actions/checkout@v3
14
+ with:
15
+ submodules: recursive
16
+ - uses: ruby/setup-ruby@v1
17
+ with:
18
+ ruby-version: '3.1'
19
+ bundler-cache: true
20
+ - name: Build
21
+ run: bundle exec rake
22
+ - name: Release
23
+ if: github.ref_type == 'tag'
24
+ run: bundle exec rake release
25
+ env:
26
+ GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
27
+ - name: Post to a Slack channel
28
+ if: ${{ failure() }}
29
+ uses: slackapi/slack-github-action@v1.23.0
30
+ env:
31
+ SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
32
+ SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
33
+ with:
34
+ payload: |
35
+ {
36
+ "text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
37
+ "blocks": [
38
+ {
39
+ "type": "section",
40
+ "text": {
41
+ "type": "mrkdwn",
42
+ "text": "*${{ github.repository }}*\nBuild failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
43
+ }
44
+ }
45
+ ]
46
+ }
data/.rubocop.yml CHANGED
@@ -1,5 +1,2 @@
1
1
  inherit_gem:
2
2
  goodcop: .rubocop.yml
3
- Metrics/BlockLength:
4
- Exclude:
5
- - 'spec/**/*'
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 3.3.0 / 2023-01-08
2
+
3
+ * [BUGFIX] Update to handle changes to GitHub contribution chart SVG naming
4
+
1
5
  # 3.2.0 / 2021-02-06
2
6
 
3
7
  * [BUGFIX] Update to handle GitHub changes to contribution data CSS
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Les Aker
3
+ Copyright (c) 2023 Les Aker
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -2,8 +2,7 @@ GithubStats
2
2
  =========
3
3
 
4
4
  [![Gem Version](https://img.shields.io/gem/v/githubstats.svg)](https://rubygems.org/gems/githubstats)
5
- [![Build Status](https://img.shields.io/travis/com/akerl/githubstats.svg)](https://travis-ci.com/akerl/githubstats)
6
- [![Coverage Status](https://img.shields.io/codecov/c/github/akerl/githubstats.svg)](https://codecov.io/github/akerl/githubstats)
5
+ [![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/akerl/githubstats/build.yml?branch=main)](https://github.com/akerl/githubstats/actions)
7
6
  [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
8
7
 
9
8
  Grabs Github contribution statistics and presents it in an easily consumable format.
data/githubstats.gemspec CHANGED
@@ -5,8 +5,7 @@ require 'githubstats/version'
5
5
  Gem::Specification.new do |s|
6
6
  s.name = 'githubstats'
7
7
  s.version = GithubStats::VERSION
8
- s.date = Time.now.strftime('%Y-%m-%d')
9
- s.required_ruby_version = '>= 2.5.0'
8
+ s.required_ruby_version = '>= 2.6.0'
10
9
 
11
10
  s.summary = 'Present Github contributions stats in a consumable format'
12
11
  s.description = 'Pulls the statistics from Github\'s user contribution chart and provides an interface for analyzing that data' # rubocop:disable Layout/LineLength
@@ -16,16 +15,12 @@ Gem::Specification.new do |s|
16
15
  s.license = 'MIT'
17
16
 
18
17
  s.files = `git ls-files`.split
19
- s.test_files = `git ls-files spec/*`.split
20
18
  s.executables = ['githubstats']
21
19
 
22
20
  s.add_runtime_dependency 'basiccache', '~> 1.0.0'
23
- s.add_runtime_dependency 'nokogiri', '~> 1.10.8'
21
+ s.add_runtime_dependency 'nokogiri', '~> 1.13.10'
24
22
 
25
- s.add_development_dependency 'codecov', '~> 0.1.1'
26
- s.add_development_dependency 'fuubar', '~> 2.5.0'
27
- s.add_development_dependency 'goodcop', '~> 0.9.3'
28
- s.add_development_dependency 'rake', '~> 13.0.0'
29
- s.add_development_dependency 'rspec', '~> 3.9.0'
30
- s.add_development_dependency 'timecop', '~> 0.9.0'
23
+ s.add_development_dependency 'goodcop', '~> 0.9.7'
24
+ s.add_development_dependency 'timecop', '~> 0.9.6'
25
+ s.metadata['rubygems_mfa_required'] = 'true'
31
26
  end
@@ -128,7 +128,7 @@ module GithubStats
128
128
 
129
129
  def std_var
130
130
  first_pass = @raw.reduce(0) do |acc, elem|
131
- (elem.score.to_f - mean)**2 + acc
131
+ ((elem.score.to_f - mean)**2) + acc
132
132
  end
133
133
  Math.sqrt(first_pass / (@raw.size - 1))
134
134
  end
@@ -159,11 +159,11 @@ module GithubStats
159
159
  range = (1..top).to_a
160
160
  range = [0] * 3 if range.empty?
161
161
  mids = (1..3).map do |q|
162
- index = q * range.size / 4 - 1
162
+ index = (q * range.size / 4) - 1
163
163
  range[index]
164
164
  end
165
165
  bounds = (mids + [max.score]).uniq.sort
166
- [0] * (5 - bounds.size) + bounds
166
+ ([0] * (5 - bounds.size)) + bounds
167
167
  end
168
168
 
169
169
  ##
@@ -195,7 +195,7 @@ module GithubStats
195
195
  private
196
196
 
197
197
  def _pad(data, index, fill_value, goal)
198
- mod = index * -2 - 1 # 0 index moves -1 in time, -1 move +1 in time
198
+ mod = (index * -2) - 1 # 0 index moves -1 in time, -1 move +1 in time
199
199
  point = GithubStats::Datapoint
200
200
  data.insert index, point.new(data[index].date + mod, fill_value) until data[index].date.wday == goal
201
201
  data
@@ -3,5 +3,5 @@
3
3
  ##
4
4
  # Define the version
5
5
  module GithubStats
6
- VERSION = '3.2.0'
6
+ VERSION = '3.3.0'
7
7
  end
data/lib/githubstats.rb CHANGED
@@ -108,7 +108,7 @@ module GithubStats
108
108
 
109
109
  def guess_user(names = [])
110
110
  names << Rugged::Config.global['github.user'] if USE_RUGGED
111
- names << ENV['USER']
111
+ names << ENV.fetch('USER', nil)
112
112
  names.find { |name| name } || (raise 'Failed to guess username')
113
113
  end
114
114
 
@@ -145,7 +145,7 @@ module GithubStats
145
145
  html = Nokogiri::HTML(resp)
146
146
  svg = html.at_css('svg.js-calendar-graph-svg')
147
147
  svg.css('.ContributionCalendar-day').map do |x|
148
- x.attributes.values_at('data-date', 'data-count').map(&:value)
148
+ x.attributes.values_at('data-date', 'data-level').map(&:value)
149
149
  end
150
150
  end
151
151
 
data/spec/spec_helper.rb CHANGED
@@ -1,11 +1,2 @@
1
- if ENV['CI'] == 'true'
2
- require 'simplecov'
3
- require 'codecov'
4
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
5
- SimpleCov.start do
6
- add_filter '/spec/'
7
- end
8
- end
9
-
10
1
  require 'rspec'
11
2
  require 'githubstats'
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: 3.2.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-06 00:00:00.000000000 Z
11
+ date: 2023-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: basiccache
@@ -30,98 +30,42 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.10.8
33
+ version: 1.13.10
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.10.8
41
- - !ruby/object:Gem::Dependency
42
- name: codecov
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: 0.1.1
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: 0.1.1
55
- - !ruby/object:Gem::Dependency
56
- name: fuubar
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.5.0
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 2.5.0
40
+ version: 1.13.10
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: goodcop
71
43
  requirement: !ruby/object:Gem::Requirement
72
44
  requirements:
73
45
  - - "~>"
74
46
  - !ruby/object:Gem::Version
75
- version: 0.9.3
47
+ version: 0.9.7
76
48
  type: :development
77
49
  prerelease: false
78
50
  version_requirements: !ruby/object:Gem::Requirement
79
51
  requirements:
80
52
  - - "~>"
81
53
  - !ruby/object:Gem::Version
82
- version: 0.9.3
83
- - !ruby/object:Gem::Dependency
84
- name: rake
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 13.0.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 13.0.0
97
- - !ruby/object:Gem::Dependency
98
- name: rspec
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: 3.9.0
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: 3.9.0
54
+ version: 0.9.7
111
55
  - !ruby/object:Gem::Dependency
112
56
  name: timecop
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
59
  - - "~>"
116
60
  - !ruby/object:Gem::Version
117
- version: 0.9.0
61
+ version: 0.9.6
118
62
  type: :development
119
63
  prerelease: false
120
64
  version_requirements: !ruby/object:Gem::Requirement
121
65
  requirements:
122
66
  - - "~>"
123
67
  - !ruby/object:Gem::Version
124
- version: 0.9.0
68
+ version: 0.9.6
125
69
  description: Pulls the statistics from Github's user contribution chart and provides
126
70
  an interface for analyzing that data
127
71
  email: me@lesaker.org
@@ -131,11 +75,10 @@ extensions: []
131
75
  extra_rdoc_files: []
132
76
  files:
133
77
  - ".circle-ruby"
78
+ - ".github/workflows/build.yml"
134
79
  - ".gitignore"
135
- - ".prospectus"
136
80
  - ".rspec"
137
81
  - ".rubocop.yml"
138
- - ".travis.yml"
139
82
  - CHANGELOG.md
140
83
  - Gemfile
141
84
  - LICENSE
@@ -160,8 +103,9 @@ files:
160
103
  homepage: https://github.com/akerl/githubstats
161
104
  licenses:
162
105
  - MIT
163
- metadata: {}
164
- post_install_message:
106
+ metadata:
107
+ rubygems_mfa_required: 'true'
108
+ post_install_message:
165
109
  rdoc_options: []
166
110
  require_paths:
167
111
  - lib
@@ -169,26 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
113
  requirements:
170
114
  - - ">="
171
115
  - !ruby/object:Gem::Version
172
- version: 2.5.0
116
+ version: 2.6.0
173
117
  required_rubygems_version: !ruby/object:Gem::Requirement
174
118
  requirements:
175
119
  - - ">="
176
120
  - !ruby/object:Gem::Version
177
121
  version: '0'
178
122
  requirements: []
179
- rubygems_version: 3.1.2
180
- signing_key:
123
+ rubygems_version: 3.3.26
124
+ signing_key:
181
125
  specification_version: 4
182
126
  summary: Present Github contributions stats in a consumable format
183
- test_files:
184
- - spec/examples/akerl.user
185
- - spec/examples/fly.user
186
- - spec/examples/laker.user
187
- - spec/examples/leematos.user
188
- - spec/examples/lmatos.user
189
- - spec/examples/mikegrb.user
190
- - spec/examples/results
191
- - spec/examples/torvalds.user
192
- - spec/githubstats/data_spec.rb
193
- - spec/githubstats_spec.rb
194
- - spec/spec_helper.rb
127
+ test_files: []
data/.prospectus DELETED
@@ -1,11 +0,0 @@
1
- my_slug = 'akerl/githubstats'
2
-
3
- Prospectus.extra_dep('file', 'prospectus_travis')
4
- Prospectus.extra_dep('file', 'prospectus_gems')
5
-
6
- item do
7
- noop
8
-
9
- extend ProspectusGems::Gemspec.new
10
- extend ProspectusTravis::Build.new(my_slug)
11
- end
data/.travis.yml DELETED
@@ -1,10 +0,0 @@
1
- dist: xenial
2
- install:
3
- - for i in $(cat .circle-ruby) ; do rvm install $i || exit 1 ; done
4
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle install || exit 1 ; done
5
- script:
6
- - for i in $(cat .circle-ruby) ; do rvm-exec $i bundle exec rake || exit 1 ; done
7
- notifications:
8
- email: false
9
- slack:
10
- secure: PQOCIfuacnmF9MMGmZseYwGn8HfxmL1m7qqftoWhDkkp8oKLKVaSfoMPGAADWQsWLBl4JQC+z/lRH8I2gXChQjZhKZBz15bFH6mwFBI82DXidVNVxt27g/uR3RMT8GfGw8CkgW8DsSpNF+E4pBPOKONFLhj9Y0xdpAID7slrPwd6wDdpi4oDXvnfTO4ZfUZbB3OGT0nnzcH4gCiKXKijv4MRzHTVpvbwe+P3TOKkTY0V21B++YSBpX1tIYt6cLOHaDFQT4DScwFajtvynpwWf3PCRMCATganpyEqEpkiUp+dSg1h2WjYilAwVHkLnNaESUFKeTLQGIXpKMj4+3yHlIPPG6M2MawgwhSDuYy1IAE/81+Y06V9Sn9PPnICsjV1+W0LxnCms13t1JcVWrzVOtlzyCInKr8ENAX6Ku6SSQaouuqYghm1maG8ZtNhqyByqGctov7noLUH6T+lHS8ODr22cLg6f0lzVn5d13/aha9OvTZV7DN6uVCfwpbAL9S+u1TNtjrDhJQFohSe7X+jb+KxN7sLZR5Z5RKwM8sx6Tadf3rrvVRF5+jQxpb2IgjakV2QgxmVDrZDu3XXWbRUYMlGbmR4EEwDaKPJsjKh8KIu6GS6rhrQHiwvwDH6FQcXdeQsieLaVTBoKnE1slYvRMVTMZxFkAbI2dIt+H06c7c=