githubstats 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.prospectus +11 -0
- data/CHANGELOG.md +4 -0
- data/README.md +3 -3
- data/circle.yml +12 -0
- data/githubstats.gemspec +5 -5
- data/lib/githubstats.rb +5 -32
- data/lib/githubstats/data.rb +1 -1
- data/lib/githubstats/version.rb +2 -1
- data/spec/githubstats/data_spec.rb +3 -3
- data/spec/githubstats_spec.rb +3 -3
- data/spec/spec_helper.rb +7 -6
- metadata +16 -15
- data/.travis.yml +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73a4589f2413428f9fc4f99a83b71f384d044c87
|
4
|
+
data.tar.gz: 8e6227b109a3661f9660e3e61dd1b42470ce39f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a885d8710bdb00b7cdc23236f9e2cee904d80d979408b2e254019b1d3aaaca83b591e083ef0fac9ed38c14c423d86c45cc6e3747563b0d6f4a6bc55ec94af9cd
|
7
|
+
data.tar.gz: 765be9c077cbca2218213bd922138371b802dd827d3d71f7ee9fd47fef8026e4fa1e153dcc41c87be4658beab2b2c75b8b6616ce448cc6b3b64a74c1f4b1ce30
|
data/.prospectus
ADDED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# 1.2.0 / 2016-05-19
|
2
|
+
|
3
|
+
* [BUGFIX] Remove support for streak lookup longer than 366 days from GitHub, since they removed display of longer streaks. :(
|
4
|
+
|
1
5
|
# 1.1.0 / 2015-08-19
|
2
6
|
|
3
7
|
* [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
|
data/README.md
CHANGED
@@ -3,9 +3,9 @@ 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
|
-
[![
|
7
|
-
[![Coverage Status](https://img.shields.io/
|
8
|
-
[![
|
6
|
+
[![Build Status](https://img.shields.io/circleci/project/akerl/githubstats.svg)](https://circleci.com/gh/akerl/githubstats)
|
7
|
+
[![Coverage Status](https://img.shields.io/codecov/c/github/akerl/githubstats.svg)](https://codecov.io/github/akerl/githubstats)
|
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)
|
10
10
|
|
11
11
|
Grabs Github contribution statistics and presents it in an easily consumable format.
|
data/circle.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
dependencies:
|
2
|
+
override:
|
3
|
+
- 'rvm-exec 1.9.3-p551 bundle install'
|
4
|
+
- 'rvm-exec 2.0.0-p645 bundle install'
|
5
|
+
- 'rvm-exec 2.1.6 bundle install'
|
6
|
+
- 'rvm-exec 2.2.2 bundle install'
|
7
|
+
test:
|
8
|
+
override:
|
9
|
+
- 'rvm-exec 1.9.3-p551 bundle exec rake'
|
10
|
+
- 'rvm-exec 2.0.0-p645 bundle exec rake'
|
11
|
+
- 'rvm-exec 2.1.6 bundle exec rake'
|
12
|
+
- 'rvm-exec 2.2.2 bundle exec rake'
|
data/githubstats.gemspec
CHANGED
@@ -17,14 +17,14 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.test_files = `git ls-files spec/*`.split
|
18
18
|
s.executables = ['githubstats']
|
19
19
|
|
20
|
-
s.add_runtime_dependency 'curb', '~> 0.
|
20
|
+
s.add_runtime_dependency 'curb', '~> 0.9.0'
|
21
21
|
s.add_runtime_dependency 'basiccache', '~> 1.0.0'
|
22
22
|
s.add_runtime_dependency 'nokogiri', '~> 1.6.5'
|
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', '~>
|
27
|
-
s.add_development_dependency '
|
28
|
-
s.add_development_dependency 'rspec', '~> 3.
|
25
|
+
s.add_development_dependency 'rubocop', '~> 0.40.0'
|
26
|
+
s.add_development_dependency 'rake', '~> 11.1.0'
|
27
|
+
s.add_development_dependency 'codecov', '~> 0.1.1'
|
28
|
+
s.add_development_dependency 'rspec', '~> 3.4.0'
|
29
29
|
s.add_development_dependency 'fuubar', '~> 2.0.0'
|
30
30
|
end
|
data/lib/githubstats.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'curb'
|
2
3
|
require 'json'
|
3
4
|
require 'nokogiri'
|
@@ -25,12 +26,12 @@ module GithubStats
|
|
25
26
|
##
|
26
27
|
# Default host for grabbing data
|
27
28
|
|
28
|
-
DEFAULT_HOST = ENV['GITHUB_URL'] || 'https://github.com'
|
29
|
+
DEFAULT_HOST = (ENV['GITHUB_URL'] || 'https://github.com').freeze
|
29
30
|
|
30
31
|
##
|
31
32
|
# Default URL for grabbing data
|
32
33
|
|
33
|
-
DEFAULT_URL = "#{DEFAULT_HOST}/users/%s/contributions"
|
34
|
+
DEFAULT_URL = "#{DEFAULT_HOST}/users/%s/contributions".freeze
|
34
35
|
|
35
36
|
##
|
36
37
|
# User object
|
@@ -53,25 +54,7 @@ module GithubStats
|
|
53
54
|
def to_s
|
54
55
|
"Contributions from #{@name}"
|
55
56
|
end
|
56
|
-
|
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
|
57
|
+
alias inspect to_s
|
75
58
|
|
76
59
|
##
|
77
60
|
# Lazy loader for data
|
@@ -97,7 +80,7 @@ module GithubStats
|
|
97
80
|
def guess_user(names = [])
|
98
81
|
names << Rugged::Config.global['github.user'] if USE_RUGGED
|
99
82
|
names << ENV['USER']
|
100
|
-
names.find { |name| name } || (
|
83
|
+
names.find { |name| name } || (raise 'Failed to guess username')
|
101
84
|
end
|
102
85
|
|
103
86
|
##
|
@@ -108,16 +91,6 @@ module GithubStats
|
|
108
91
|
@last_updated = DateTime.now
|
109
92
|
end
|
110
93
|
|
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
|
-
|
121
94
|
##
|
122
95
|
# Downloads new data from Github
|
123
96
|
|
data/lib/githubstats/data.rb
CHANGED
data/lib/githubstats/version.rb
CHANGED
@@ -18,7 +18,7 @@ describe GithubStats do
|
|
18
18
|
open('spec/examples/results') { |f| JSON.parse f.read }[subject]
|
19
19
|
end
|
20
20
|
let(:data) do
|
21
|
-
file = open("spec/examples/#{subject}.user"
|
21
|
+
file = open("spec/examples/#{subject}.user", &:read)
|
22
22
|
GithubStats::Data.new JSON.parse(file)
|
23
23
|
end
|
24
24
|
|
@@ -76,13 +76,13 @@ describe GithubStats do
|
|
76
76
|
|
77
77
|
describe '#mean' do
|
78
78
|
it 'returns the mean score of the set' do
|
79
|
-
expect(data.mean.round
|
79
|
+
expect(data.mean.round(4)).to eql results['mean']
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
83
|
describe '#std_var' do
|
84
84
|
it 'returns the standard variance of the set' do
|
85
|
-
expect(data.std_var.round
|
85
|
+
expect(data.std_var.round(4)).to eql results['std_var']
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
data/spec/githubstats_spec.rb
CHANGED
@@ -60,9 +60,9 @@ describe GithubStats do
|
|
60
60
|
end
|
61
61
|
|
62
62
|
it 'truthfully handles respond_to? queries' do
|
63
|
-
expect(named_user.respond_to?
|
64
|
-
expect(named_user.respond_to?
|
65
|
-
expect(named_user.respond_to?
|
63
|
+
expect(named_user.respond_to?(:to_s)).to be_truthy
|
64
|
+
expect(named_user.respond_to?(:today)).to be_truthy
|
65
|
+
expect(named_user.respond_to?(:abcd)).to be_falsey
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
|
-
|
2
|
-
require '
|
3
|
-
|
4
|
-
SimpleCov.formatter =
|
5
|
-
SimpleCov.start do
|
6
|
-
|
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
|
7
8
|
end
|
8
9
|
|
9
10
|
require 'rspec'
|
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.2.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: 2016-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.9.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.9.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: basiccache
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,56 +72,56 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.40.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.40.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: 11.1.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: 11.1.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: codecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.1.1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.1.1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 3.
|
117
|
+
version: 3.4.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.4.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: fuubar
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -145,15 +145,16 @@ extensions: []
|
|
145
145
|
extra_rdoc_files: []
|
146
146
|
files:
|
147
147
|
- ".gitignore"
|
148
|
+
- ".prospectus"
|
148
149
|
- ".rspec"
|
149
150
|
- ".rubocop.yml"
|
150
|
-
- ".travis.yml"
|
151
151
|
- CHANGELOG.md
|
152
152
|
- Gemfile
|
153
153
|
- LICENSE
|
154
154
|
- README.md
|
155
155
|
- Rakefile
|
156
156
|
- bin/githubstats
|
157
|
+
- circle.yml
|
157
158
|
- githubstats.gemspec
|
158
159
|
- lib/githubstats.rb
|
159
160
|
- lib/githubstats/data.rb
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
version: '0'
|
190
191
|
requirements: []
|
191
192
|
rubyforge_project:
|
192
|
-
rubygems_version: 2.
|
193
|
+
rubygems_version: 2.5.1
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: Present Github contributions stats in a consumable format
|
data/.travis.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
sudo: false
|
4
|
-
rvm:
|
5
|
-
- 2.2.2
|
6
|
-
- 2.2.1
|
7
|
-
- 2.2.0
|
8
|
-
- 2.1.6
|
9
|
-
- 2.0.0-p598
|
10
|
-
- 1.9.3-p551
|
11
|
-
env:
|
12
|
-
- WITH_RUGGED=no
|
13
|
-
- WITH_RUGGED=yes
|
14
|
-
before_script:
|
15
|
-
- '[[ "$WITH_RUGGED" == "no" ]] || gem install rugged'
|
16
|
-
notifications:
|
17
|
-
email: false
|
18
|
-
irc:
|
19
|
-
channels:
|
20
|
-
- irc.oftc.net#akerl
|
21
|
-
template:
|
22
|
-
- "%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}"
|