githubstats 3.1.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: 63d1760b40fbefddd2aa5c8fba01de7eb8b9d4924ba16c3e6e32030265d1a4a7
4
- data.tar.gz: b7c45953695c48422332f089338443e9d622d4c25991676a32e6ed28b9e7402d
3
+ metadata.gz: 92f3eb1f61af9163e2b683c942b25f08def1fda5abe252e6c62b87fc54678e88
4
+ data.tar.gz: 42b058fbc533b8da30ee503ef749379a9ea2d99beff3c8ea02334c1bc89f06d1
5
5
  SHA512:
6
- metadata.gz: ed67ab09a4247ed69c8a12d597010ca7dd1e7f76add17553834d54fa350a3bd93fc402575fdf202ee05bf486ca2c1c386d8f8800daff3b1c8bf17b3704fc6ab5
7
- data.tar.gz: 0154bdd9747143f0974313aff0a53b03d8252fab6e104af13ebade18d20057cbd8a62c0057032ccef9e9a60d3a441f66d1521a9cac1bd9efe700b87b3fe014f3
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,11 @@
1
+ # 3.3.0 / 2023-01-08
2
+
3
+ * [BUGFIX] Update to handle changes to GitHub contribution chart SVG naming
4
+
5
+ # 3.2.0 / 2021-02-06
6
+
7
+ * [BUGFIX] Update to handle GitHub changes to contribution data CSS
8
+
1
9
  # 3.1.0 / 2020-10-06
2
10
 
3
11
  * [FEATURE] Remove curb dependency, which allows githubstats to work on Windows systems. Thanks @ajmeese7!
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,27 +5,22 @@ 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')
8
+ s.required_ruby_version = '>= 2.6.0'
9
9
 
10
10
  s.summary = 'Present Github contributions stats in a consumable format'
11
- s.description = 'Pulls the statistics from Github\'s user contribution chart and provides an interface for analyzing that data' # rubocop:disable Metrics/LineLength
11
+ s.description = 'Pulls the statistics from Github\'s user contribution chart and provides an interface for analyzing that data' # rubocop:disable Layout/LineLength
12
12
  s.authors = ['Les Aker']
13
13
  s.email = 'me@lesaker.org'
14
14
  s.homepage = 'https://github.com/akerl/githubstats'
15
15
  s.license = 'MIT'
16
16
 
17
17
  s.files = `git ls-files`.split
18
- s.test_files = `git ls-files spec/*`.split
19
18
  s.executables = ['githubstats']
20
19
 
21
20
  s.add_runtime_dependency 'basiccache', '~> 1.0.0'
22
- s.add_runtime_dependency 'nokogiri', '~> 1.10.8'
21
+ s.add_runtime_dependency 'nokogiri', '~> 1.13.10'
23
22
 
24
- s.add_development_dependency 'codecov', '~> 0.1.1'
25
- s.add_development_dependency 'fuubar', '~> 2.5.0'
26
- s.add_development_dependency 'goodcop', '~> 0.8.0'
27
- s.add_development_dependency 'rake', '~> 13.0.0'
28
- s.add_development_dependency 'rspec', '~> 3.9.0'
29
- s.add_development_dependency 'rubocop', '~> 0.76.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
@@ -120,7 +120,7 @@ module GithubStats
120
120
  # The mean score
121
121
 
122
122
  def mean
123
- scores.reduce(:+) / @raw.size.to_f
123
+ scores.sum / @raw.size.to_f
124
124
  end
125
125
 
126
126
  ##
@@ -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,11 +195,9 @@ 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
- until data[index].date.wday == goal
201
- data.insert index, point.new(data[index].date + mod, fill_value)
202
- end
200
+ data.insert index, point.new(data[index].date + mod, fill_value) until data[index].date.wday == goal
203
201
  data
204
202
  end
205
203
  end
@@ -3,5 +3,5 @@
3
3
  ##
4
4
  # Define the version
5
5
  module GithubStats
6
- VERSION = '3.1.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
 
@@ -143,8 +143,9 @@ module GithubStats
143
143
  def download(to_date = nil)
144
144
  resp = request(to_date)
145
145
  html = Nokogiri::HTML(resp)
146
- html.css('.day').map do |x|
147
- x.attributes.values_at('data-date', 'data-count').map(&:value)
146
+ svg = html.at_css('svg.js-calendar-graph-svg')
147
+ svg.css('.ContributionCalendar-day').map do |x|
148
+ x.attributes.values_at('data-date', 'data-level').map(&:value)
148
149
  end
149
150
  end
150
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.1.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: 2020-10-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,112 +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.8.0
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.8.0
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
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.76.0
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.76.0
54
+ version: 0.9.7
125
55
  - !ruby/object:Gem::Dependency
126
56
  name: timecop
127
57
  requirement: !ruby/object:Gem::Requirement
128
58
  requirements:
129
59
  - - "~>"
130
60
  - !ruby/object:Gem::Version
131
- version: 0.9.0
61
+ version: 0.9.6
132
62
  type: :development
133
63
  prerelease: false
134
64
  version_requirements: !ruby/object:Gem::Requirement
135
65
  requirements:
136
66
  - - "~>"
137
67
  - !ruby/object:Gem::Version
138
- version: 0.9.0
68
+ version: 0.9.6
139
69
  description: Pulls the statistics from Github's user contribution chart and provides
140
70
  an interface for analyzing that data
141
71
  email: me@lesaker.org
@@ -145,11 +75,10 @@ extensions: []
145
75
  extra_rdoc_files: []
146
76
  files:
147
77
  - ".circle-ruby"
78
+ - ".github/workflows/build.yml"
148
79
  - ".gitignore"
149
- - ".prospectus"
150
80
  - ".rspec"
151
81
  - ".rubocop.yml"
152
- - ".travis.yml"
153
82
  - CHANGELOG.md
154
83
  - Gemfile
155
84
  - LICENSE
@@ -174,8 +103,9 @@ files:
174
103
  homepage: https://github.com/akerl/githubstats
175
104
  licenses:
176
105
  - MIT
177
- metadata: {}
178
- post_install_message:
106
+ metadata:
107
+ rubygems_mfa_required: 'true'
108
+ post_install_message:
179
109
  rdoc_options: []
180
110
  require_paths:
181
111
  - lib
@@ -183,26 +113,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
183
113
  requirements:
184
114
  - - ">="
185
115
  - !ruby/object:Gem::Version
186
- version: '0'
116
+ version: 2.6.0
187
117
  required_rubygems_version: !ruby/object:Gem::Requirement
188
118
  requirements:
189
119
  - - ">="
190
120
  - !ruby/object:Gem::Version
191
121
  version: '0'
192
122
  requirements: []
193
- rubygems_version: 3.1.2
194
- signing_key:
123
+ rubygems_version: 3.3.26
124
+ signing_key:
195
125
  specification_version: 4
196
126
  summary: Present Github contributions stats in a consumable format
197
- test_files:
198
- - spec/examples/akerl.user
199
- - spec/examples/fly.user
200
- - spec/examples/laker.user
201
- - spec/examples/leematos.user
202
- - spec/examples/lmatos.user
203
- - spec/examples/mikegrb.user
204
- - spec/examples/results
205
- - spec/examples/torvalds.user
206
- - spec/githubstats/data_spec.rb
207
- - spec/githubstats_spec.rb
208
- - 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=