github_contribs 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data/.autotest +26 -0
- data/History.rdoc +5 -0
- data/Manifest.txt +8 -0
- data/README.rdoc +57 -0
- data/Rakefile +25 -0
- data/bin/github_contribs +18 -0
- data/lib/github_contribs.rb +77 -0
- data/test/test_github_contribs.rb +24 -0
- data.tar.gz.sig +0 -0
- metadata +130 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '08e0e43a97f55f9a06e5dadb7cd30fb5744cee79acff1b8a0c8f1000e663ddd7'
|
4
|
+
data.tar.gz: ef5db7d36c652b2e7b995eab7cceabb98110424357a37c7abff510a178e34526
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 57aebaadfaeb71598070f6fbd7289b6540f7713345b9bb7f6b06ca4a591cc9bc50040f70ddb3145c8ec4d9f3dfe9ba666e1c7eaf81b1437e86de2924be45fcfc
|
7
|
+
data.tar.gz: e274e2f64bba8b4af46f1ccbe3dd1c7a0bfa1a69826536f6414a0c279de0f5b7d7da418fca901433137024784fc97f0b41104e57e118fffdb9faff352d9e43f7
|
checksums.yaml.gz.sig
ADDED
data/.autotest
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "autotest/restart"
|
4
|
+
|
5
|
+
Autotest.add_hook :initialize do |at|
|
6
|
+
at.testlib = "minitest/autorun"
|
7
|
+
at.add_exception "tmp"
|
8
|
+
|
9
|
+
# at.extra_files << "../some/external/dependency.rb"
|
10
|
+
#
|
11
|
+
# at.libs << ":../some/external"
|
12
|
+
#
|
13
|
+
# at.add_exception "vendor"
|
14
|
+
#
|
15
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
16
|
+
# at.files_matching(/test_.*rb$/)
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# %w(TestA TestB).each do |klass|
|
20
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
21
|
+
# end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Autotest.add_hook :run_command do |at|
|
25
|
+
# system "rake build"
|
26
|
+
# end
|
data/History.rdoc
ADDED
data/Manifest.txt
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
= github_contribs
|
2
|
+
|
3
|
+
home :: https://github.com/seattlerb/github_contribs
|
4
|
+
rdoc :: http://docs.seattlerb.org/github_contribs
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
A simple commandline tool that downloads yearly contribution graphs
|
9
|
+
from github and assembles them into a unified view.
|
10
|
+
|
11
|
+
== FEATURES/PROBLEMS:
|
12
|
+
|
13
|
+
* Helps visualize patterns across the years.
|
14
|
+
* See the effects of major life events (eg marriage, baby, depression).
|
15
|
+
* Uses ~/.config/gh/hosts.yml for authentication (generate via `gh auth login`).
|
16
|
+
* Caches all previous years (current year is always generated).
|
17
|
+
* Defaults to 10 years, but takes an optional year.
|
18
|
+
|
19
|
+
== SYNOPSIS:
|
20
|
+
|
21
|
+
usage: github_contribs <username> [year]
|
22
|
+
|
23
|
+
% github_contribs zenspider
|
24
|
+
% open zenspider.html
|
25
|
+
|
26
|
+
== REQUIREMENTS:
|
27
|
+
|
28
|
+
* nokogiri
|
29
|
+
|
30
|
+
== INSTALL:
|
31
|
+
|
32
|
+
* [sudo] gem install github_contribs
|
33
|
+
|
34
|
+
== LICENSE:
|
35
|
+
|
36
|
+
(The MIT License)
|
37
|
+
|
38
|
+
Copyright (c) Ryan Davis, seattle.rb
|
39
|
+
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
41
|
+
a copy of this software and associated documentation files (the
|
42
|
+
'Software'), to deal in the Software without restriction, including
|
43
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
44
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
45
|
+
permit persons to whom the Software is furnished to do so, subject to
|
46
|
+
the following conditions:
|
47
|
+
|
48
|
+
The above copyright notice and this permission notice shall be
|
49
|
+
included in all copies or substantial portions of the Software.
|
50
|
+
|
51
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
52
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
53
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
54
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
55
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
56
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
57
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "hoe"
|
5
|
+
|
6
|
+
Hoe.plugin :isolate
|
7
|
+
Hoe.plugin :seattlerb
|
8
|
+
Hoe.plugin :rdoc
|
9
|
+
|
10
|
+
Hoe.spec "github_contribs" do
|
11
|
+
developer "Ryan Davis", "ryand-ruby@zenspider.com"
|
12
|
+
|
13
|
+
dependency "nokogiri", "~> 1.12"
|
14
|
+
|
15
|
+
self.isolate_multiruby = true # for nokogiri
|
16
|
+
|
17
|
+
license "MIT"
|
18
|
+
end
|
19
|
+
|
20
|
+
task :run => :isolate do
|
21
|
+
WHO = ENV["U"] || "zenspider 1998"
|
22
|
+
ruby "-Ilib bin/github_contribs #{WHO}"
|
23
|
+
end
|
24
|
+
|
25
|
+
# vim: syntax=ruby
|
data/bin/github_contribs
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby -ws
|
2
|
+
|
3
|
+
$v ||= false
|
4
|
+
|
5
|
+
require "github_contribs"
|
6
|
+
|
7
|
+
if ARGV.empty? then
|
8
|
+
abort "usage: github_contribs <username> [year]"
|
9
|
+
end
|
10
|
+
|
11
|
+
name = ARGV.shift
|
12
|
+
last = (ARGV.shift || (Time.now.year - 10)).to_i
|
13
|
+
|
14
|
+
gh = GithubContribs.new
|
15
|
+
|
16
|
+
File.open "#{name}.html", "w" do |io|
|
17
|
+
gh.generate name, last, io
|
18
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
require "pp"
|
2
|
+
require "nokogiri"
|
3
|
+
require "fileutils"
|
4
|
+
require "open-uri"
|
5
|
+
require "yaml"
|
6
|
+
|
7
|
+
class GithubContribs
|
8
|
+
VERSION = "1.0.0"
|
9
|
+
|
10
|
+
def oauth_token
|
11
|
+
@token ||= begin
|
12
|
+
data = YAML.load_file File.expand_path "~/.config/gh/hosts.yml"
|
13
|
+
data && data.dig("github.com", "oauth_token")
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def get name, year
|
18
|
+
base_url = "https://github.com/#{name}?"
|
19
|
+
path = ".#{name}.#{year}.html"
|
20
|
+
|
21
|
+
unless File.exist? path then
|
22
|
+
warn "#{name} #{year}" if $v
|
23
|
+
|
24
|
+
uri = URI.parse "#{base_url}from=%4d-01-01&to=%4d-12-31" % [year, year]
|
25
|
+
|
26
|
+
File.open path, "w" do |f|
|
27
|
+
f.puts uri.read("authorization" => "Bearer #{oauth_token}")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Nokogiri::HTML File.read path
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate name, last, io = $stdout, testing = false
|
35
|
+
io.puts <<~EOM
|
36
|
+
<!DOCTYPE html>
|
37
|
+
<html lang="en">
|
38
|
+
EOM
|
39
|
+
|
40
|
+
unless testing then
|
41
|
+
FileUtils.rm_f ".#{name}.#{Time.now.year}.html" # always fetch this fresh
|
42
|
+
end
|
43
|
+
html = get name, Time.now.year
|
44
|
+
|
45
|
+
io.puts html.at_css("head").to_html
|
46
|
+
io.puts %( <body>)
|
47
|
+
io.puts html.css("script").to_html
|
48
|
+
|
49
|
+
Time.now.year.downto(last).each do |year|
|
50
|
+
graph = get(name, year)
|
51
|
+
.at_css("div.graph-before-activity-overview")
|
52
|
+
|
53
|
+
graph.css("div.float-right").remove # NEW!...
|
54
|
+
|
55
|
+
graph.css("div.float-left").first # Learn how we count...
|
56
|
+
.content = graph.previous.previous.content.strip.gsub(/\s+/, " ")
|
57
|
+
|
58
|
+
graph.at_css("div.js-calendar-graph")
|
59
|
+
.remove_class("d-flex")
|
60
|
+
.remove_class("text-center")
|
61
|
+
.remove_class("flex-xl-items-center")
|
62
|
+
|
63
|
+
io.puts graph.to_html
|
64
|
+
end # years
|
65
|
+
|
66
|
+
io.puts <<~EOM
|
67
|
+
<div class="Popover js-hovercard-content position-absolute" style="display: none; outline: none;" tabindex="0">
|
68
|
+
<div class="Popover-message Popover-message--bottom-left Popover-message--large Box box-shadow-large" style="width:360px;"></div>
|
69
|
+
</div>
|
70
|
+
EOM
|
71
|
+
|
72
|
+
io.puts <<~EOM
|
73
|
+
</body>
|
74
|
+
</html>
|
75
|
+
EOM
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "minitest/autorun"
|
2
|
+
require "github_contribs"
|
3
|
+
|
4
|
+
class TestGithubContribs < Minitest::Test
|
5
|
+
def test_oauth_token
|
6
|
+
gh = GithubContribs.new
|
7
|
+
assert_match(/^gho_\w{36}/, gh.oauth_token, "if this fails, they all fail")
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_generate
|
11
|
+
name = "zenspider"
|
12
|
+
last = Time.now.year
|
13
|
+
|
14
|
+
gh = GithubContribs.new
|
15
|
+
|
16
|
+
str = ""
|
17
|
+
io = StringIO.new str
|
18
|
+
|
19
|
+
gh.generate name, last, io, :testing
|
20
|
+
|
21
|
+
assert_includes str, "<title>zenspider (Ryan Davis) · GitHub</title>"
|
22
|
+
assert_match(/<svg width="\d+" height="\d+" class="js-calendar-graph-svg">/, str)
|
23
|
+
end
|
24
|
+
end
|
data.tar.gz.sig
ADDED
Binary file
|
metadata
ADDED
@@ -0,0 +1,130 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: github_contribs
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ryan Davis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDPjCCAiagAwIBAgIBBjANBgkqhkiG9w0BAQsFADBFMRMwEQYDVQQDDApyeWFu
|
14
|
+
ZC1ydWJ5MRkwFwYKCZImiZPyLGQBGRYJemVuc3BpZGVyMRMwEQYKCZImiZPyLGQB
|
15
|
+
GRYDY29tMB4XDTIxMTIyMzIzMTkwNFoXDTIyMTIyMzIzMTkwNFowRTETMBEGA1UE
|
16
|
+
AwwKcnlhbmQtcnVieTEZMBcGCgmSJomT8ixkARkWCXplbnNwaWRlcjETMBEGCgmS
|
17
|
+
JomT8ixkARkWA2NvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALda
|
18
|
+
b9DCgK+627gPJkB6XfjZ1itoOQvpqH1EXScSaba9/S2VF22VYQbXU1xQXL/WzCkx
|
19
|
+
taCPaLmfYIaFcHHCSY4hYDJijRQkLxPeB3xbOfzfLoBDbjvx5JxgJxUjmGa7xhcT
|
20
|
+
oOvjtt5P8+GSK9zLzxQP0gVLS/D0FmoE44XuDr3iQkVS2ujU5zZL84mMNqNB1znh
|
21
|
+
GiadM9GHRaDiaxuX0cIUBj19T01mVE2iymf9I6bEsiayK/n6QujtyCbTWsAS9Rqt
|
22
|
+
qhtV7HJxNKuPj/JFH0D2cswvzznE/a5FOYO68g+YCuFi5L8wZuuM8zzdwjrWHqSV
|
23
|
+
gBEfoTEGr7Zii72cx+sCAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAw
|
24
|
+
HQYDVR0OBBYEFEfFe9md/r/tj/Wmwpy+MI8d9k/hMA0GCSqGSIb3DQEBCwUAA4IB
|
25
|
+
AQCKB5jfsuSnKb+t/Wrh3UpdkmX7TrEsjVmERC0pPqzQ5GQJgmEXDD7oMgaKXaAq
|
26
|
+
x2m+KSZDrqk7c8uho5OX6YMqg4KdxehfSLqqTZGoeV78qwf/jpPQZKTf+W9gUSJh
|
27
|
+
zsWpo4K50MP+QtdSbKXZwjAafpQ8hK0MnnZ/aeCsW9ov5vdXpYbf3dpg6ADXRGE7
|
28
|
+
lQY2y1tJ5/chqu6h7dQmnm2ABUqx9O+JcN9hbCYoA5i/EeubUEtFIh2w3SpO6YfB
|
29
|
+
JFmxn4h9YO/pVdB962BdBNNDia0kgIjI3ENnkLq0dKpYU3+F3KhEuTksLO0L6X/V
|
30
|
+
YsuyUzsMz6GQA4khyaMgKNSD
|
31
|
+
-----END CERTIFICATE-----
|
32
|
+
date: 2022-09-17 00:00:00.000000000 Z
|
33
|
+
dependencies:
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: nokogiri
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
type: :runtime
|
42
|
+
prerelease: false
|
43
|
+
version_requirements: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.12'
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: rdoc
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '4.0'
|
55
|
+
- - "<"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '7'
|
58
|
+
type: :development
|
59
|
+
prerelease: false
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '4.0'
|
65
|
+
- - "<"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '7'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: hoe
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.25'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.25'
|
82
|
+
description: |-
|
83
|
+
A simple commandline tool that downloads yearly contribution graphs
|
84
|
+
from github and assembles them into a unified view.
|
85
|
+
email:
|
86
|
+
- ryand-ruby@zenspider.com
|
87
|
+
executables:
|
88
|
+
- github_contribs
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files:
|
91
|
+
- History.rdoc
|
92
|
+
- Manifest.txt
|
93
|
+
- README.rdoc
|
94
|
+
files:
|
95
|
+
- ".autotest"
|
96
|
+
- History.rdoc
|
97
|
+
- Manifest.txt
|
98
|
+
- README.rdoc
|
99
|
+
- Rakefile
|
100
|
+
- bin/github_contribs
|
101
|
+
- lib/github_contribs.rb
|
102
|
+
- test/test_github_contribs.rb
|
103
|
+
homepage: https://github.com/seattlerb/github_contribs
|
104
|
+
licenses:
|
105
|
+
- MIT
|
106
|
+
metadata:
|
107
|
+
homepage_uri: https://github.com/seattlerb/github_contribs
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options:
|
110
|
+
- "--main"
|
111
|
+
- README.rdoc
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubygems_version: 3.3.12
|
126
|
+
signing_key:
|
127
|
+
specification_version: 4
|
128
|
+
summary: A simple commandline tool that downloads yearly contribution graphs from
|
129
|
+
github and assembles them into a unified view.
|
130
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|