githubchart 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/githubchart.gemspec +1 -1
- data/lib/githubchart/svg.rb +13 -19
- data/vendor/cache/{githubstats-0.2.3.gem → githubstats-0.2.4.gem} +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1804c1a1b3b18c94f410703a8f541b8e60c95e93
|
4
|
+
data.tar.gz: 2dfc34c2e0da6cf3538cb6f5b120f20deacde2ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 66029000faa0e132939387b9f7472a7897b195c6ddeba64dbf5e21a9dfec4b96b84f66b3be7f026d18138df8829eaed0c3ba5f64081ddc2e9385f2f4182d3cc9
|
7
|
+
data.tar.gz: b9f9cac1c594679fcc0eaced8c51c3ce7dc0fcb8088bcff05e110349683b5fddebbac1a931c0f6397802960cc208da3ecb411d30e345374af52aaa37e802e50c
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
githubchart (0.0.
|
4
|
+
githubchart (0.0.2)
|
5
5
|
githubstats
|
6
6
|
rasem
|
7
7
|
|
@@ -23,7 +23,7 @@ GEM
|
|
23
23
|
rspec (~> 2.0)
|
24
24
|
rspec-instafail (~> 0.2.0)
|
25
25
|
ruby-progressbar (~> 1.0)
|
26
|
-
githubstats (0.2.
|
26
|
+
githubstats (0.2.4)
|
27
27
|
basiccache (< 2)
|
28
28
|
curb
|
29
29
|
json
|
data/githubchart.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'githubchart'
|
3
|
-
s.version = '0.0.
|
3
|
+
s.version = '0.0.2'
|
4
4
|
s.date = Time.now.strftime("%Y-%m-%d")
|
5
5
|
s.summary = 'Generate an SVG of Github contributions data'
|
6
6
|
s.description = "Uses GithubStats to grab Github contributions scores and converts that into an SVG"
|
data/lib/githubchart/svg.rb
CHANGED
@@ -18,8 +18,8 @@ module GithubChart
|
|
18
18
|
chart = Rasem::SVGImage.new(13 * grid.column_size + 13,
|
19
19
|
13 * grid.row_size + 13)
|
20
20
|
svg_add_points grid, chart
|
21
|
-
svg_add_weekdays
|
22
|
-
svg_add_months
|
21
|
+
svg_add_weekdays chart
|
22
|
+
svg_add_months chart
|
23
23
|
chart.close
|
24
24
|
chart.output
|
25
25
|
end
|
@@ -63,8 +63,8 @@ module GithubChart
|
|
63
63
|
end
|
64
64
|
end
|
65
65
|
|
66
|
-
def svg_add_weekdays(
|
67
|
-
|
66
|
+
def svg_add_weekdays(chart)
|
67
|
+
@stats.raw.first(7).each do |point|
|
68
68
|
index = point.date.wday
|
69
69
|
letter = point.date.strftime('%a')[0]
|
70
70
|
style = SVG_WEEKDAY_STYLE.clone
|
@@ -73,24 +73,18 @@ module GithubChart
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
-
def svg_get_month_offsets
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
acc
|
82
|
-
acc.
|
83
|
-
acc
|
76
|
+
def svg_get_month_offsets
|
77
|
+
list = @stats.raw.group_by { |x| x.date.strftime('%Y%U').split('-') }
|
78
|
+
acc = 0
|
79
|
+
list = list.map { |k, v| v.first.date.strftime('%b') }
|
80
|
+
list.chunk { |x| x }.map do |month, offset|
|
81
|
+
acc += offset.size
|
82
|
+
[month, acc - offset.size]
|
84
83
|
end
|
85
|
-
offsets.each_index do |i|
|
86
|
-
offsets[-1 - i][1] = (offsets[-2 - i] || [0, 0])[1]
|
87
|
-
end
|
88
|
-
offsets
|
89
84
|
end
|
90
85
|
|
91
|
-
def svg_add_months(
|
92
|
-
svg_get_month_offsets
|
93
|
-
next if offset == 0
|
86
|
+
def svg_add_months(chart)
|
87
|
+
svg_get_month_offsets.each do |month, offset|
|
94
88
|
chart.text(13 * offset + 14, 9, month, SVG_MONTH_STYLE)
|
95
89
|
end
|
96
90
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: githubchart
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Les Aker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: githubstats
|
@@ -167,7 +167,7 @@ files:
|
|
167
167
|
- vendor/cache/diff-lcs-1.2.5.gem
|
168
168
|
- vendor/cache/docile-1.1.1.gem
|
169
169
|
- vendor/cache/fuubar-1.2.1.gem
|
170
|
-
- vendor/cache/githubstats-0.2.
|
170
|
+
- vendor/cache/githubstats-0.2.4.gem
|
171
171
|
- vendor/cache/hashr-0.0.22.gem
|
172
172
|
- vendor/cache/json-1.8.1.gem
|
173
173
|
- vendor/cache/mime-types-2.0.gem
|