githubchart 0.0.13 → 0.1.1

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
  SHA1:
3
- metadata.gz: 2d935efdbed784cabbe7dd8081ca640a350ca5a8
4
- data.tar.gz: a753a496736be43df859dc76ff37c6c92d9eb133
3
+ metadata.gz: 6ecd87617b3f21634b56adb1e6c14d51f94e9758
4
+ data.tar.gz: d72dd7dd0549cafb640d544904f124a87b4dae99
5
5
  SHA512:
6
- metadata.gz: 23501590e45cc4498ba6a1eff1ba9ecbb0714cd2d31bb216519f86d2e6b7788f6ba71c38a45b986c0f40cfc480ea2a21d08b40707be560c45213ac912c7052df
7
- data.tar.gz: 65ee24adaaf006cfcee6dffbd3d656b192f811df73aa23b329aa4a052dd10502512a6c3ed9ddb153886cfa72481da9c0b222a25c25a82562ef2da55b389059a2
6
+ metadata.gz: 2b44d82bb9fc2755ef2fd41e0441198b4201ee91f395d220705d1df337aef0f14f9d5994ee8b0b0a7ec88ee8df219a7a96e8ec7b48de80eedbeb952f4ac052bb
7
+ data.tar.gz: 83bc6d54cdad7cdb3c353eda70baa18fb29d0dc241d3430d04d4a176e638a8ed43cfb591ed4808ff10884ac03bc9afd0aaade90d047d1adb42c28d2ba96b2d1c
data/githubchart.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.executables = ['githubchart']
18
18
 
19
19
  s.add_runtime_dependency 'githubstats', '~> 0.2.16'
20
- s.add_runtime_dependency 'rasem', '~> 0.6.1'
20
+ s.add_runtime_dependency 'svgplot', '~> 0.0.3'
21
21
 
22
22
  s.add_development_dependency 'rubocop', '~> 0.28.0'
23
23
  s.add_development_dependency 'rake', '~> 10.4.0'
@@ -1,4 +1,4 @@
1
- require 'rasem'
1
+ require 'svgplot'
2
2
 
3
3
  ##
4
4
  # Add SVG support to GithubChart
@@ -13,13 +13,12 @@ module GithubChart
13
13
  class Chart
14
14
  def svg
15
15
  grid = matrix
16
- chart = Rasem::SVGImage.new(13 * grid.column_size + 13,
17
- 13 * grid.row_size + 13)
16
+ chart = SVGPlot.new(width: 13 * grid.column_size + 13,
17
+ height: 13 * grid.row_size + 13)
18
18
  svg_add_points grid, chart
19
19
  svg_add_weekdays chart
20
20
  svg_add_months chart
21
- chart.close
22
- chart.output
21
+ chart.to_s
23
22
  end
24
23
 
25
24
  private
@@ -53,19 +52,23 @@ module GithubChart
53
52
  chart.rectangle(
54
53
  (x * 13) + 14, (y * 13) + 14, 11, 11,
55
54
  fill: @colors[@stats.quartile(point.score)],
56
- :'shape-rendering' => 'crispedges'
55
+ :'shape-rendering' => 'crispedges',
56
+ :'data-score' => point.score,
57
+ :'data-data' => point.date
57
58
  )
58
59
  end
59
60
  end
60
61
 
62
+ def svg_add_weekday(chart, point)
63
+ index = point.date.wday
64
+ letter = point.date.strftime('%a')[0]
65
+ style = SVG_WEEKDAY_STYLE.clone
66
+ style[:display] = 'none' unless [1, 3, 5].include? index
67
+ chart.text(4, 13 * index + 23, style) { raw letter }
68
+ end
69
+
61
70
  def svg_add_weekdays(chart)
62
- @stats.raw.first(7).each do |point|
63
- index = point.date.wday
64
- letter = point.date.strftime('%a')[0]
65
- style = SVG_WEEKDAY_STYLE.clone
66
- style[:display] = 'none' unless [1, 3, 5].include? index
67
- chart.text(4, 13 * index + 23, letter, style)
68
- end
71
+ @stats.raw.first(7).each { |point| svg_add_weekday chart, point }
69
72
  end
70
73
 
71
74
  def svg_get_month_offsets # rubocop:disable Metrics/AbcSize
@@ -84,7 +87,7 @@ module GithubChart
84
87
  offsets.shift if offsets.take(2).map(&:last) == [0, 1]
85
88
  offsets.each do |month, offset|
86
89
  next if offset > 50
87
- chart.text(13 * offset + 14, 9, month, SVG_MONTH_STYLE)
90
+ chart.text(13 * offset + 14, 9, SVG_MONTH_STYLE) { raw month }
88
91
  end
89
92
  end
90
93
  end
@@ -1,5 +1,5 @@
1
1
  ##
2
2
  # Define the version
3
3
  module GithubChart
4
- VERSION = '0.0.13'
4
+ VERSION = '0.1.1'
5
5
  end
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.13
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2015-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: githubstats
@@ -25,19 +25,19 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.2.16
27
27
  - !ruby/object:Gem::Dependency
28
- name: rasem
28
+ name: svgplot
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.6.1
33
+ version: 0.0.3
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: 0.6.1
40
+ version: 0.0.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement