githubchart 0.0.5 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +6 -5
  4. data/LICENSE +1 -1
  5. data/README.md +9 -6
  6. data/Rakefile +2 -13
  7. data/bin/githubchart +33 -7
  8. data/githubchart.gemspec +11 -10
  9. data/lib/githubchart.rb +5 -7
  10. data/lib/githubchart/svg.rb +7 -11
  11. data/lib/githubchart/version.rb +5 -0
  12. data/spec/examples/input.json +1 -0
  13. data/spec/githubchart/svg_spec.rb +1 -1
  14. data/spec/githubchart_spec.rb +12 -8
  15. metadata +34 -92
  16. data/Gemfile.lock +0 -79
  17. data/vendor/cache/ast-1.1.0.gem +0 -0
  18. data/vendor/cache/basiccache-0.0.26.gem +0 -0
  19. data/vendor/cache/coveralls-0.7.0.gem +0 -0
  20. data/vendor/cache/curb-0.8.5.gem +0 -0
  21. data/vendor/cache/diff-lcs-1.2.5.gem +0 -0
  22. data/vendor/cache/docile-1.1.1.gem +0 -0
  23. data/vendor/cache/fuubar-1.3.2.gem +0 -0
  24. data/vendor/cache/githubstats-0.2.5.gem +0 -0
  25. data/vendor/cache/hashr-0.0.22.gem +0 -0
  26. data/vendor/cache/json-1.8.1.gem +0 -0
  27. data/vendor/cache/mime-types-2.0.gem +0 -0
  28. data/vendor/cache/multi_json-1.8.2.gem +0 -0
  29. data/vendor/cache/parser-2.1.1.gem +0 -0
  30. data/vendor/cache/powerpack-0.0.9.gem +0 -0
  31. data/vendor/cache/rainbow-1.1.4.gem +0 -0
  32. data/vendor/cache/rake-10.1.1.gem +0 -0
  33. data/vendor/cache/rasem-0.6.1.gem +0 -0
  34. data/vendor/cache/rest-client-1.6.7.gem +0 -0
  35. data/vendor/cache/rspec-2.14.1.gem +0 -0
  36. data/vendor/cache/rspec-core-2.14.7.gem +0 -0
  37. data/vendor/cache/rspec-expectations-2.14.4.gem +0 -0
  38. data/vendor/cache/rspec-mocks-2.14.4.gem +0 -0
  39. data/vendor/cache/rubocop-0.16.0.gem +0 -0
  40. data/vendor/cache/ruby-progressbar-1.3.2.gem +0 -0
  41. data/vendor/cache/simplecov-0.8.2.gem +0 -0
  42. data/vendor/cache/simplecov-html-0.8.0.gem +0 -0
  43. data/vendor/cache/slop-3.4.7.gem +0 -0
  44. data/vendor/cache/term-ansicolor-1.2.2.gem +0 -0
  45. data/vendor/cache/thor-0.18.1.gem +0 -0
  46. data/vendor/cache/tins-0.13.1.gem +0 -0
  47. data/vendor/cache/travis-lint-1.7.0.gem +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b0b4acb9c99bd3d2114742101ccf8891a0183754
4
- data.tar.gz: a78455803cf4ca8a3f3f9f9624858a6750a93807
3
+ metadata.gz: 5ed8c5a0b1b7aacb84b1ccaa16d2424cd8695ceb
4
+ data.tar.gz: ff431484f1bf98b862aa125122da4f549bb28e79
5
5
  SHA512:
6
- metadata.gz: 13bcc0b1e98b456c527680cd234a184bcd7a5780da4dc82188ea2ede5961b8ec7f33e094bdafa73bd14e08b089a6427c61efdb420ba20cf4442a2e2b418f378a
7
- data.tar.gz: 22b4fc2ff8ea121c5cd4d50e2889fbd9b4f3bb2add321331d9d379aec244c68e6e1d0913c255381ec6bf534abb2459d1f49e53b654e5b808e3cf5691dd3f5563
6
+ metadata.gz: 911fcd89c2f3e4f4f89a7d038eaf8ad536c14c6318d968e1847ae3254b8940732d81063afbc9c9b18870e641b74b023f90dc553f35137aa9b9106312b8a5931c
7
+ data.tar.gz: a4ba22508c1c31dcf1e56f54c396b60e90417d3b6b864582a75b3568f6b42126f6da74158d4e7eeb6557d9a739439eda99f5d52687b7329ac6f6a24ac9e77329
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  pkg/*.gem
2
2
  coverage/
3
3
  .coveralls.yml
4
+ .bundle
5
+ Gemfile.lock
data/.travis.yml CHANGED
@@ -1,14 +1,15 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  rvm:
4
- - ruby-head
4
+ - 2.1.2
5
+ - 2.1.1
6
+ - 2.1.0
5
7
  - 2.0.0
6
8
  - 1.9.3
7
9
  notifications:
8
10
  email: false
9
11
  irc:
10
- channels:
11
- - ircs://irc.oftc.net:6697#akerl
12
- channel_key: sekrit
13
12
  template:
14
- - '%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}'
13
+ - "%{repository}/%{branch}/%{build_number}: %{message} -- %{build_url}"
14
+ channels:
15
+ - secure: dAnGdlErIXwcMIH0duRVahvVoVHwXHsF2I/SUhtu2ON4bibBqWV3hO0cqBl10Nt1+yjsEtp7J25GROGC1cokMaAdwSid4JH6IS3eAwgE/UjHrbp0ROsT+OfL/OUjNoCgC1HkGWnLk1qE0VKZkkhmMgTCqprIvpAXgVYelKL9/Q4=
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2013 Les Aker
3
+ Copyright (c) 2014 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
@@ -1,11 +1,12 @@
1
1
  GithubChart
2
2
  ============
3
3
 
4
- [![Gem Version](https://badge.fury.io/rb/githubchart.png)](http://badge.fury.io/rb/githubchart)
5
- [![Dependency Status](https://gemnasium.com/akerl/githubchart.png)](https://gemnasium.com/akerl/githubchart)
6
- [![Code Climate](https://codeclimate.com/github/akerl/githubchart.png)](https://codeclimate.com/github/akerl/githubchart)
7
- [![Coverage Status](https://coveralls.io/repos/akerl/githubchart/badge.png?branch=master)](https://coveralls.io/r/akerl/githubchart?branch=master)
8
- [![Build Status](https://travis-ci.org/akerl/githubchart.png?branch=master)](https://travis-ci.org/akerl/githubchart)
4
+ [![Gem Version](https://img.shields.io/gem/v/githubchart.svg)](https://rubygems.org/gems/githubchart)
5
+ [![Dependency Status](https://img.shields.io/gemnasium/akerl/githubchart.svg)](https://gemnasium.com/akerl/githubchart)
6
+ [![Code Climate](https://img.shields.io/codeclimate/github/akerl/githubchart.svg)](https://codeclimate.com/github/akerl/githubchart)
7
+ [![Coverage Status](https://img.shields.io/coveralls/akerl/githubchart.svg)](https://coveralls.io/r/akerl/githubchart)
8
+ [![Build Status](https://img.shields.io/travis/akerl/githubchart.svg)](https://travis-ci.org/akerl/githubchart)
9
+ [![MIT Licensed](https://img.shields.io/badge/license-MIT-green.svg)](https://tldrlegal.com/license/mit-license)
9
10
 
10
11
  Generates an SVG of your Github contributions:
11
12
 
@@ -15,7 +16,9 @@ Generates an SVG of your Github contributions:
15
16
 
16
17
  ## Usage
17
18
 
18
- Run `githubchart path/to/svg` to generate an SVG. To override the default username (pulled from your local shell or .gitconfig), use `github_chart -u username path/to/svg`
19
+ Run `githubchart path/to/svg` to generate an SVG. To override the default username (pulled from your local shell or .gitconfig), use `githubchart -u username path/to/svg`
20
+
21
+ GithubChart also allows you to provide input from a file instead of pulling data from Github. You can pass JSON to GithubChart by using `githubchart -i /path/to/file /path/to/svg`, or use '-' to use STDIN. See spec/examples/input.json for example data.
19
22
 
20
23
  ## Installation
21
24
 
data/Rakefile CHANGED
@@ -2,24 +2,13 @@ require 'bundler/gem_tasks'
2
2
  require 'rspec/core/rake_task'
3
3
  require 'rubocop/rake_task'
4
4
 
5
- desc 'Update bundle'
6
- task :bundle do
7
- `bundle update`
8
- end
9
-
10
5
  desc 'Run tests'
11
6
  RSpec::Core::RakeTask.new(:spec)
12
7
 
13
8
  desc 'Run Rubocop on the gem'
14
- Rubocop::RakeTask.new(:rubocop) do |task|
9
+ RuboCop::RakeTask.new(:rubocop) do |task|
15
10
  task.patterns = ['lib/**/*.rb', 'spec/**/*.rb', 'bin/**/*']
16
11
  task.fail_on_error = true
17
12
  end
18
13
 
19
- desc 'Run travis-lint on .travis.yml'
20
- task :travislint do
21
- fail 'There is an issue with your .travis.yml' unless system('travis-lint')
22
- end
23
-
24
- task default: [:spec, :travislint, :rubocop, :build, :install]
25
- task release: [:bundle]
14
+ task default: [:spec, :rubocop, :build, :install]
data/bin/githubchart CHANGED
@@ -8,16 +8,42 @@ OptionParser.new do |opts|
8
8
  opts.banner =
9
9
  "Usage: githubchart (-u username) (-t type) path/for/new/image\n"
10
10
  opts.banner << 'Supported types: ' + GithubChart.supported.join(' ')
11
- opts.on('-uUSER', '--user=USER') { |user| options[:user] = user }
11
+ opts.on('-uUSER', '--user=USER', 'Specify GitHub user to graph') do |user|
12
+ if options.include? :input
13
+ fail 'The --user and --input flags are incompatible with each other.'
14
+ end
15
+ options[:user] = user
16
+ end
17
+ opts.on('-iFILE', '--input=FILE', 'Specify JSON file, - for stdin') do |input|
18
+ if options.include? :user
19
+ fail 'The --user and --input flags are incompatible with each other.'
20
+ end
21
+
22
+ if input.eql? '-'
23
+ fail 'No data provided on stdin' if STDIN.tty?
24
+ contents = STDIN.read
25
+ else
26
+ fail 'File does not exist' unless File.exist? input
27
+ contents = File.read input
28
+ end
29
+
30
+ begin
31
+ parsed = JSON.parse(contents)
32
+ rescue => e
33
+ raise "Unable to parse JSON data provided: #{e}"
34
+ end
35
+
36
+ options[:data] = GithubStats::Data.new(parsed)
37
+ end
38
+ opts.on_tail('-v', '--version', 'Show version') do
39
+ puts GithubChart::VERSION
40
+ exit
41
+ end
12
42
  end.parse!
13
43
 
14
44
  SVG_Path = ARGV.shift
45
+ fail 'Please provide the target location for the SVG' if SVG_Path.nil?
15
46
 
16
- if SVG_Path.nil?
17
- puts 'Please provide the target location for the SVG'
18
- exit 1
19
- end
20
-
21
- Chart = GithubChart.new(options[:user]).svg
47
+ Chart = GithubChart.new(options).svg
22
48
 
23
49
  File.open(SVG_Path, 'w') { |file| file << Chart }
data/githubchart.gemspec CHANGED
@@ -1,6 +1,9 @@
1
+ $:.unshift File.expand_path('../lib/', __FILE__)
2
+ require 'githubchart/version'
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = 'githubchart'
3
- s.version = '0.0.5'
6
+ s.version = GithubChart::VERSION
4
7
  s.date = Time.now.strftime("%Y-%m-%d")
5
8
  s.summary = 'Generate an SVG of Github contributions data'
6
9
  s.description = "Uses GithubStats to grab Github contributions scores and converts that into an SVG"
@@ -13,15 +16,13 @@ Gem::Specification.new do |s|
13
16
  s.test_files = `git ls-files spec/*`.split
14
17
  s.executables = ['githubchart']
15
18
 
16
- s.add_runtime_dependency 'githubstats'
17
- s.add_runtime_dependency 'rasem'
19
+ s.add_runtime_dependency 'githubstats', '~> 0.2.14'
20
+ s.add_runtime_dependency 'rasem', '~> 0.6.1'
18
21
 
19
- s.add_development_dependency 'rubocop'
20
- s.add_development_dependency 'travis-lint'
21
- s.add_development_dependency 'rake'
22
- s.add_development_dependency 'coveralls'
23
- s.add_development_dependency 'rspec'
24
- s.add_development_dependency 'fuubar'
25
- s.add_development_dependency 'parser'
22
+ s.add_development_dependency 'rubocop', '~> 0.25.0'
23
+ s.add_development_dependency 'rake', '~> 10.3.2'
24
+ s.add_development_dependency 'coveralls', '~> 0.7.1'
25
+ s.add_development_dependency 'rspec', '~> 3.0.0'
26
+ s.add_development_dependency 'fuubar', '~> 2.0.0'
26
27
  end
27
28
 
data/lib/githubchart.rb CHANGED
@@ -3,7 +3,6 @@ require 'matrix'
3
3
 
4
4
  ##
5
5
  # Graphing tool for creating Github-style contribution charts
6
-
7
6
  module GithubChart
8
7
  class << self
9
8
  ##
@@ -45,7 +44,6 @@ module GithubChart
45
44
 
46
45
  ##
47
46
  # Object for parsing and outputing Github stats data
48
-
49
47
  class Chart
50
48
  attr_reader :stats
51
49
  attr_accessor :colors
@@ -56,8 +54,8 @@ module GithubChart
56
54
  # Uses colors rather than default, if provided
57
55
 
58
56
  def initialize(params = {})
59
- params = { username: params } unless params.is_a? Hash
60
- @stats = GithubStats.new(params[:username])
57
+ params = { user: params } unless params.is_a? Hash
58
+ @stats = params.fetch(:data) { GithubStats.new(params[:user]).data }
61
59
  @colors = params[:colors] || GithubChart::COLORS
62
60
  end
63
61
 
@@ -75,13 +73,12 @@ end
75
73
 
76
74
  ##
77
75
  # Add helper methods to Integer
78
-
79
- class ::Integer
76
+ class Integer
80
77
  ##
81
78
  # Add ordinalize to simplify converting to spoken string
82
79
 
83
80
  def ordinalize
84
- return to_s if self == 0
81
+ return to_s if self.zero?
85
82
  return "#{self}th" if (11..13).include?(abs % 100)
86
83
  case abs % 10
87
84
  when 1 then "#{self}st"
@@ -92,4 +89,5 @@ class ::Integer
92
89
  end
93
90
  end
94
91
 
92
+ require 'githubchart/version'
95
93
  require 'githubchart/svg'
@@ -2,7 +2,6 @@ require 'rasem'
2
2
 
3
3
  ##
4
4
  # Add SVG support to GithubChart
5
-
6
5
  module GithubChart
7
6
  ##
8
7
  # Declare SVG support
@@ -11,7 +10,6 @@ module GithubChart
11
10
 
12
11
  ##
13
12
  # Convert stats into SVG
14
-
15
13
  class Chart
16
14
  def svg
17
15
  grid = matrix
@@ -26,8 +24,6 @@ module GithubChart
26
24
 
27
25
  private
28
26
 
29
- # rubocop:disable SymbolName
30
-
31
27
  ##
32
28
  # Define style for weekday labels
33
29
 
@@ -37,7 +33,7 @@ module GithubChart
37
33
  :'text-align' => 'center',
38
34
  :font => '9px Helvetica, arial, freesans, clean, sans-serif',
39
35
  :'white-space' => 'nowrap',
40
- :display => 'display',
36
+ :display => 'display'
41
37
  }
42
38
 
43
39
  ##
@@ -48,17 +44,16 @@ module GithubChart
48
44
  :'text-align' => 'center',
49
45
  :font => '10px Helvetica, arial, freesans, clean, sans-serif',
50
46
  :'white-space' => 'nowrap',
51
- :display => 'block',
47
+ :display => 'block'
52
48
  }
53
49
 
54
- # rubocop:enable SymbolName
55
-
56
50
  def svg_add_points(grid, chart)
57
51
  grid.each_with_index do |point, y, x|
58
52
  next if point.score == -1
59
53
  chart.rectangle(
60
54
  (x * 13) + 14, (y * 13) + 14, 11, 11,
61
- fill: @colors[@stats.quartile(point.score)]
55
+ fill: @colors[@stats.quartile(point.score)],
56
+ :'shape-rendering' => 'crispedges'
62
57
  )
63
58
  end
64
59
  end
@@ -75,8 +70,9 @@ module GithubChart
75
70
 
76
71
  def svg_get_month_offsets
77
72
  list = @stats.raw.group_by { |x| x.date.strftime('%Y%U').split('-') }
73
+ list = list.map { |_, v| v.first.date.strftime('%b') }
74
+ list.shift if list[0] == list[1]
78
75
  acc = 0
79
- list = list.map { |k, v| v.first.date.strftime('%b') }
80
76
  list.chunk { |x| x }.map do |month, offset|
81
77
  acc += offset.size
82
78
  [month, acc - offset.size]
@@ -85,7 +81,7 @@ module GithubChart
85
81
 
86
82
  def svg_add_months(chart)
87
83
  svg_get_month_offsets.each do |month, offset|
88
- next if offset > 52
84
+ next if offset > 51 || offset < 1
89
85
  chart.text(13 * offset + 14, 9, month, SVG_MONTH_STYLE)
90
86
  end
91
87
  end
@@ -0,0 +1,5 @@
1
+ ##
2
+ # Define the version
3
+ module GithubChart
4
+ VERSION = '0.0.8'
5
+ end
@@ -0,0 +1 @@
1
+ [["2013/08/30",0],["2013/08/31",2],["2013/09/01",0],["2013/09/02",0],["2013/09/03",0],["2013/09/04",0],["2013/09/05",0],["2013/09/06",0],["2013/09/07",0],["2013/09/08",0],["2013/09/09",0],["2013/09/10",0],["2013/09/11",0],["2013/09/12",0],["2013/09/13",0],["2013/09/14",0],["2013/09/15",0],["2013/09/16",0],["2013/09/17",0],["2013/09/18",0],["2013/09/19",0],["2013/09/20",0],["2013/09/21",8],["2013/09/22",0],["2013/09/23",0],["2013/09/24",0],["2013/09/25",0],["2013/09/26",0],["2013/09/27",0],["2013/09/28",0],["2013/09/29",0],["2013/09/30",8],["2013/10/01",0],["2013/10/02",1],["2013/10/03",0],["2013/10/04",0],["2013/10/05",1],["2013/10/06",0],["2013/10/07",7],["2013/10/08",10],["2013/10/09",0],["2013/10/10",2],["2013/10/11",0],["2013/10/12",0],["2013/10/13",0],["2013/10/14",0],["2013/10/15",0],["2013/10/16",0],["2013/10/17",0],["2013/10/18",0],["2013/10/19",0],["2013/10/20",0],["2013/10/21",1],["2013/10/22",0],["2013/10/23",0],["2013/10/24",0],["2013/10/25",0],["2013/10/26",0],["2013/10/27",0],["2013/10/28",0],["2013/10/29",0],["2013/10/30",0],["2013/10/31",0],["2013/11/01",0],["2013/11/02",5],["2013/11/03",0],["2013/11/04",0],["2013/11/05",0],["2013/11/06",0],["2013/11/07",0],["2013/11/08",0],["2013/11/09",0],["2013/11/10",0],["2013/11/11",0],["2013/11/12",0],["2013/11/13",0],["2013/11/14",0],["2013/11/15",0],["2013/11/16",1],["2013/11/17",0],["2013/11/18",0],["2013/11/19",0],["2013/11/20",0],["2013/11/21",0],["2013/11/22",0],["2013/11/23",0],["2013/11/24",1],["2013/11/25",9],["2013/11/26",1],["2013/11/27",0],["2013/11/28",0],["2013/11/29",4],["2013/11/30",0],["2013/12/01",17],["2013/12/02",0],["2013/12/03",1],["2013/12/04",9],["2013/12/05",3],["2013/12/06",7],["2013/12/07",1],["2013/12/08",6],["2013/12/09",6],["2013/12/10",1],["2013/12/11",2],["2013/12/12",2],["2013/12/13",1],["2013/12/14",13],["2013/12/15",1],["2013/12/16",3],["2013/12/17",1],["2013/12/18",0],["2013/12/19",1],["2013/12/20",1],["2013/12/21",0],["2013/12/22",4],["2013/12/23",0],["2013/12/24",0],["2013/12/25",0],["2013/12/26",1],["2013/12/27",0],["2013/12/28",0],["2013/12/29",0],["2013/12/30",0],["2013/12/31",0],["2014/01/01",0],["2014/01/02",0],["2014/01/03",0],["2014/01/04",0],["2014/01/05",0],["2014/01/06",0],["2014/01/07",0],["2014/01/08",0],["2014/01/09",0],["2014/01/10",0],["2014/01/11",0],["2014/01/12",0],["2014/01/13",0],["2014/01/14",0],["2014/01/15",0],["2014/01/16",0],["2014/01/17",0],["2014/01/18",0],["2014/01/19",0],["2014/01/20",0],["2014/01/21",0],["2014/01/22",0],["2014/01/23",0],["2014/01/24",0],["2014/01/25",0],["2014/01/26",0],["2014/01/27",0],["2014/01/28",0],["2014/01/29",0],["2014/01/30",0],["2014/01/31",0],["2014/02/01",0],["2014/02/02",0],["2014/02/03",0],["2014/02/04",0],["2014/02/05",0],["2014/02/06",0],["2014/02/07",0],["2014/02/08",0],["2014/02/09",0],["2014/02/10",0],["2014/02/11",0],["2014/02/12",0],["2014/02/13",0],["2014/02/14",0],["2014/02/15",0],["2014/02/16",3],["2014/02/17",0],["2014/02/18",0],["2014/02/19",0],["2014/02/20",0],["2014/02/21",0],["2014/02/22",0],["2014/02/23",0],["2014/02/24",0],["2014/02/25",0],["2014/02/26",0],["2014/02/27",0],["2014/02/28",0],["2014/03/01",0],["2014/03/02",0],["2014/03/03",0],["2014/03/04",1],["2014/03/05",0],["2014/03/06",0],["2014/03/07",0],["2014/03/08",0],["2014/03/09",0],["2014/03/10",1],["2014/03/11",0],["2014/03/12",1],["2014/03/13",0],["2014/03/14",0],["2014/03/15",3],["2014/03/16",4],["2014/03/17",1],["2014/03/18",0],["2014/03/19",0],["2014/03/20",0],["2014/03/21",0],["2014/03/22",3],["2014/03/23",1],["2014/03/24",0],["2014/03/25",0],["2014/03/26",0],["2014/03/27",3],["2014/03/28",3],["2014/03/29",0],["2014/03/30",0],["2014/03/31",0],["2014/04/01",0],["2014/04/02",0],["2014/04/03",0],["2014/04/04",0],["2014/04/05",0],["2014/04/06",0],["2014/04/07",0],["2014/04/08",1],["2014/04/09",0],["2014/04/10",0],["2014/04/11",0],["2014/04/12",0],["2014/04/13",0],["2014/04/14",0],["2014/04/15",0],["2014/04/16",0],["2014/04/17",0],["2014/04/18",0],["2014/04/19",4],["2014/04/20",1],["2014/04/21",0],["2014/04/22",2],["2014/04/23",0],["2014/04/24",0],["2014/04/25",0],["2014/04/26",0],["2014/04/27",0],["2014/04/28",0],["2014/04/29",0],["2014/04/30",1],["2014/05/01",0],["2014/05/02",0],["2014/05/03",2],["2014/05/04",1],["2014/05/05",0],["2014/05/06",0],["2014/05/07",0],["2014/05/08",0],["2014/05/09",2],["2014/05/10",0],["2014/05/11",0],["2014/05/12",2],["2014/05/13",0],["2014/05/14",0],["2014/05/15",0],["2014/05/16",1],["2014/05/17",0],["2014/05/18",0],["2014/05/19",2],["2014/05/20",0],["2014/05/21",0],["2014/05/22",0],["2014/05/23",0],["2014/05/24",0],["2014/05/25",0],["2014/05/26",0],["2014/05/27",0],["2014/05/28",2],["2014/05/29",0],["2014/05/30",0],["2014/05/31",0],["2014/06/01",0],["2014/06/02",0],["2014/06/03",0],["2014/06/04",0],["2014/06/05",0],["2014/06/06",0],["2014/06/07",0],["2014/06/08",2],["2014/06/09",0],["2014/06/10",2],["2014/06/11",0],["2014/06/12",0],["2014/06/13",2],["2014/06/14",0],["2014/06/15",1],["2014/06/16",0],["2014/06/17",1],["2014/06/18",0],["2014/06/19",0],["2014/06/20",0],["2014/06/21",0],["2014/06/22",0],["2014/06/23",0],["2014/06/24",0],["2014/06/25",1],["2014/06/26",0],["2014/06/27",5],["2014/06/28",0],["2014/06/29",7],["2014/06/30",0],["2014/07/01",2],["2014/07/02",1],["2014/07/03",0],["2014/07/04",0],["2014/07/05",1],["2014/07/06",2],["2014/07/07",3],["2014/07/08",5],["2014/07/09",5],["2014/07/10",0],["2014/07/11",0],["2014/07/12",0],["2014/07/13",0],["2014/07/14",0],["2014/07/15",0],["2014/07/16",0],["2014/07/17",3],["2014/07/18",0],["2014/07/19",0],["2014/07/20",0],["2014/07/21",0],["2014/07/22",0],["2014/07/23",0],["2014/07/24",0],["2014/07/25",0],["2014/07/26",0],["2014/07/27",0],["2014/07/28",0],["2014/07/29",0],["2014/07/30",0],["2014/07/31",0],["2014/08/01",0],["2014/08/02",0],["2014/08/03",0],["2014/08/04",0],["2014/08/05",0],["2014/08/06",0],["2014/08/07",0],["2014/08/08",0],["2014/08/09",0],["2014/08/10",2],["2014/08/11",0],["2014/08/12",0],["2014/08/13",0],["2014/08/14",0],["2014/08/15",0],["2014/08/16",4],["2014/08/17",0],["2014/08/18",0],["2014/08/19",1],["2014/08/20",0],["2014/08/21",0],["2014/08/22",0],["2014/08/23",0],["2014/08/24",0],["2014/08/25",2],["2014/08/26",0],["2014/08/27",0],["2014/08/28",0],["2014/08/29",0],["2014/08/30",0],["2014/08/31",8]]
@@ -13,7 +13,7 @@ describe GithubChart::Chart do
13
13
 
14
14
  after(:all) { @file.unlink }
15
15
 
16
- describe '.svg' do
16
+ describe '#svg' do
17
17
  it 'makes an SVG' do
18
18
  expect(`file #{@path}`).to include('Scalable Vector Graphic')
19
19
  end
@@ -1,22 +1,22 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe GithubChart do
4
- describe '.new' do
4
+ describe '#new' do
5
5
  it 'creates a new Chart object' do
6
6
  expect(GithubChart.new).to be_an_instance_of GithubChart::Chart
7
7
  end
8
8
  end
9
9
 
10
- describe '.supported' do
10
+ describe '#supported' do
11
11
  it 'lists supported types' do
12
12
  expect(GithubChart.supported).to include(:svg)
13
13
  end
14
14
  end
15
15
 
16
- describe '.supports?' do
16
+ describe '#supports?' do
17
17
  it 'checks for type support' do
18
- expect(GithubChart.supports? :svg).to be_true
19
- expect(GithubChart.supports? :fish).to be_false
18
+ expect(GithubChart.supports? :svg).to be_truthy
19
+ expect(GithubChart.supports? :fish).to be_falsey
20
20
  end
21
21
  end
22
22
 
@@ -27,14 +27,18 @@ describe GithubChart do
27
27
  it 'lets you override the colors' do
28
28
  expect(GithubChart.new(colors: [1, 2, 3, 4, 5]).colors.last).to eql 5
29
29
  end
30
- it 'lets you override the username' do
31
- expect(GithubChart.new(username: 'fly').stats.name).to eql 'fly'
30
+ it 'lets you pass external data' do
31
+ data = JSON.parse(File.read 'spec/examples/input.json')
32
+ expect(GithubChart.new(data: data).stats).to eql data
33
+ end
34
+ it 'creates a data object when not provided' do
35
+ expect(GithubChart.new(username: 'fly').stats).to be_an_instance_of GithubStats::Data
32
36
  end
33
37
  end
34
38
  end
35
39
 
36
40
  describe ::Integer do
37
- describe '.ordinalize' do
41
+ describe '#ordinalize' do
38
42
  it 'returns a spoken string for a number' do
39
43
  [
40
44
  [0, '0'],
metadata CHANGED
@@ -1,141 +1,113 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githubchart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
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-25 00:00:00.000000000 Z
11
+ date: 2014-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: githubstats
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.2.14
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.2.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rasem
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.6.1
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'
40
+ version: 0.6.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 0.25.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: travis-lint
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: 0.25.0
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ">="
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: 10.3.2
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ">="
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: 10.3.2
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: coveralls
85
71
  requirement: !ruby/object:Gem::Requirement
86
72
  requirements:
87
- - - ">="
73
+ - - "~>"
88
74
  - !ruby/object:Gem::Version
89
- version: '0'
75
+ version: 0.7.1
90
76
  type: :development
91
77
  prerelease: false
92
78
  version_requirements: !ruby/object:Gem::Requirement
93
79
  requirements:
94
- - - ">="
80
+ - - "~>"
95
81
  - !ruby/object:Gem::Version
96
- version: '0'
82
+ version: 0.7.1
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rspec
99
85
  requirement: !ruby/object:Gem::Requirement
100
86
  requirements:
101
- - - ">="
87
+ - - "~>"
102
88
  - !ruby/object:Gem::Version
103
- version: '0'
89
+ version: 3.0.0
104
90
  type: :development
105
91
  prerelease: false
106
92
  version_requirements: !ruby/object:Gem::Requirement
107
93
  requirements:
108
- - - ">="
94
+ - - "~>"
109
95
  - !ruby/object:Gem::Version
110
- version: '0'
96
+ version: 3.0.0
111
97
  - !ruby/object:Gem::Dependency
112
98
  name: fuubar
113
99
  requirement: !ruby/object:Gem::Requirement
114
100
  requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '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'
125
- - !ruby/object:Gem::Dependency
126
- name: parser
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
101
+ - - "~>"
130
102
  - !ruby/object:Gem::Version
131
- version: '0'
103
+ version: 2.0.0
132
104
  type: :development
133
105
  prerelease: false
134
106
  version_requirements: !ruby/object:Gem::Requirement
135
107
  requirements:
136
- - - ">="
108
+ - - "~>"
137
109
  - !ruby/object:Gem::Version
138
- version: '0'
110
+ version: 2.0.0
139
111
  description: Uses GithubStats to grab Github contributions scores and converts that
140
112
  into an SVG
141
113
  email: me@lesaker.org
@@ -149,7 +121,6 @@ files:
149
121
  - ".rubocop.yml"
150
122
  - ".travis.yml"
151
123
  - Gemfile
152
- - Gemfile.lock
153
124
  - LICENSE
154
125
  - README.md
155
126
  - Rakefile
@@ -159,40 +130,11 @@ files:
159
130
  - githubchart.gemspec
160
131
  - lib/githubchart.rb
161
132
  - lib/githubchart/svg.rb
133
+ - lib/githubchart/version.rb
134
+ - spec/examples/input.json
162
135
  - spec/githubchart/svg_spec.rb
163
136
  - spec/githubchart_spec.rb
164
137
  - spec/spec_helper.rb
165
- - vendor/cache/ast-1.1.0.gem
166
- - vendor/cache/basiccache-0.0.26.gem
167
- - vendor/cache/coveralls-0.7.0.gem
168
- - vendor/cache/curb-0.8.5.gem
169
- - vendor/cache/diff-lcs-1.2.5.gem
170
- - vendor/cache/docile-1.1.1.gem
171
- - vendor/cache/fuubar-1.3.2.gem
172
- - vendor/cache/githubstats-0.2.5.gem
173
- - vendor/cache/hashr-0.0.22.gem
174
- - vendor/cache/json-1.8.1.gem
175
- - vendor/cache/mime-types-2.0.gem
176
- - vendor/cache/multi_json-1.8.2.gem
177
- - vendor/cache/parser-2.1.1.gem
178
- - vendor/cache/powerpack-0.0.9.gem
179
- - vendor/cache/rainbow-1.1.4.gem
180
- - vendor/cache/rake-10.1.1.gem
181
- - vendor/cache/rasem-0.6.1.gem
182
- - vendor/cache/rest-client-1.6.7.gem
183
- - vendor/cache/rspec-2.14.1.gem
184
- - vendor/cache/rspec-core-2.14.7.gem
185
- - vendor/cache/rspec-expectations-2.14.4.gem
186
- - vendor/cache/rspec-mocks-2.14.4.gem
187
- - vendor/cache/rubocop-0.16.0.gem
188
- - vendor/cache/ruby-progressbar-1.3.2.gem
189
- - vendor/cache/simplecov-0.8.2.gem
190
- - vendor/cache/simplecov-html-0.8.0.gem
191
- - vendor/cache/slop-3.4.7.gem
192
- - vendor/cache/term-ansicolor-1.2.2.gem
193
- - vendor/cache/thor-0.18.1.gem
194
- - vendor/cache/tins-0.13.1.gem
195
- - vendor/cache/travis-lint-1.7.0.gem
196
138
  homepage: https://github.com/akerl/githubchart
197
139
  licenses:
198
140
  - MIT
@@ -213,12 +155,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
155
  version: '0'
214
156
  requirements: []
215
157
  rubyforge_project:
216
- rubygems_version: 2.0.3
158
+ rubygems_version: 2.2.2
217
159
  signing_key:
218
160
  specification_version: 4
219
161
  summary: Generate an SVG of Github contributions data
220
162
  test_files:
163
+ - spec/examples/input.json
221
164
  - spec/githubchart/svg_spec.rb
222
165
  - spec/githubchart_spec.rb
223
166
  - spec/spec_helper.rb
224
- has_rdoc:
data/Gemfile.lock DELETED
@@ -1,79 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- githubchart (0.0.5)
5
- githubstats
6
- rasem
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- ast (1.1.0)
12
- basiccache (0.0.26)
13
- coveralls (0.7.0)
14
- multi_json (~> 1.3)
15
- rest-client
16
- simplecov (>= 0.7)
17
- term-ansicolor
18
- thor
19
- curb (0.8.5)
20
- diff-lcs (1.2.5)
21
- docile (1.1.1)
22
- fuubar (1.3.2)
23
- rspec (>= 2.14.0, < 3.1.0)
24
- ruby-progressbar (~> 1.3)
25
- githubstats (0.2.5)
26
- basiccache (< 2)
27
- curb
28
- json
29
- hashr (0.0.22)
30
- json (1.8.1)
31
- mime-types (2.0)
32
- multi_json (1.8.2)
33
- parser (2.1.1)
34
- ast (~> 1.1)
35
- slop (~> 3.4, >= 3.4.5)
36
- powerpack (0.0.9)
37
- rainbow (1.1.4)
38
- rake (10.1.1)
39
- rasem (0.6.1)
40
- rest-client (1.6.7)
41
- mime-types (>= 1.16)
42
- rspec (2.14.1)
43
- rspec-core (~> 2.14.0)
44
- rspec-expectations (~> 2.14.0)
45
- rspec-mocks (~> 2.14.0)
46
- rspec-core (2.14.7)
47
- rspec-expectations (2.14.4)
48
- diff-lcs (>= 1.1.3, < 2.0)
49
- rspec-mocks (2.14.4)
50
- rubocop (0.16.0)
51
- parser (~> 2.1)
52
- powerpack (~> 0.0.6)
53
- rainbow (>= 1.1.4)
54
- ruby-progressbar (1.3.2)
55
- simplecov (0.8.2)
56
- docile (~> 1.1.0)
57
- multi_json
58
- simplecov-html (~> 0.8.0)
59
- simplecov-html (0.8.0)
60
- slop (3.4.7)
61
- term-ansicolor (1.2.2)
62
- tins (~> 0.8)
63
- thor (0.18.1)
64
- tins (0.13.1)
65
- travis-lint (1.7.0)
66
- hashr (~> 0.0.22)
67
-
68
- PLATFORMS
69
- ruby
70
-
71
- DEPENDENCIES
72
- coveralls
73
- fuubar
74
- githubchart!
75
- parser
76
- rake
77
- rspec
78
- rubocop
79
- travis-lint
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file