githubstats 0.2.15 → 0.2.16

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: d38f55901e2ca3214afcfdf9810a3d0254f035b2
4
- data.tar.gz: 4b527bfac9c2986d3856b430f3fde02684fcea8d
3
+ metadata.gz: e6489df0d1be5a9655b111007d55abdf990744ca
4
+ data.tar.gz: ac61b4865e20e58f133d37f64bf4059319ca50fa
5
5
  SHA512:
6
- metadata.gz: d4dea3e94cdedaf55af41ccf0604a8f98dbf0c6a17172af6d24115d96a8d6329a6b993a5fd4eb7f5130940b4dd174bb9c3c4e1f51ba7cfd71a14dc4908cdbbb1
7
- data.tar.gz: 479b6275aaf7ca35a23e627f0a6054db22cc68b43468b3dd107ebc70c37a637f4429775b64c85cb53dd05076b90619d69e6bf975a33f11042dadc194b8147d47
6
+ metadata.gz: a42a5eda72b94c007081e897300d8ca0fff9629a00d9d86650cf753f2bc65af6af10f1eccc8c70c4756e2867650e90aab223fdfa64776a499de8fdec90ae4788
7
+ data.tar.gz: 43fb14fd324353311cc3a2b2add396ad3882a3376ef09fd654ef2e05d3e6517cefe1b00eb181faee3dc255441bffab0c0f957e60a4dc6fe637e8ca93313e4264
@@ -5,6 +5,10 @@ require 'optparse'
5
5
 
6
6
  opt = OptionParser.new do |opts|
7
7
  opts.banner = 'Usage: githubstats [-h] [USER]'
8
+ opts.on_tail('-v', '--version', 'Show version') do
9
+ puts GithubStats::VERSION
10
+ exit
11
+ end
8
12
  end.parse!
9
13
 
10
14
  user = GithubStats.new ARGV.first
@@ -1,6 +1,9 @@
1
+ $:.unshift File.expand_path('../lib/', __FILE__)
2
+ require 'githubstats/version'
3
+
1
4
  Gem::Specification.new do |s|
2
5
  s.name = 'githubstats'
3
- s.version = '0.2.15'
6
+ s.version = GithubStats::VERSION
4
7
  s.date = Time.now.strftime("%Y-%m-%d")
5
8
 
6
9
  s.summary = 'Present Github contributions stats in a consumable format'
@@ -16,11 +19,12 @@ Gem::Specification.new do |s|
16
19
 
17
20
  s.add_runtime_dependency 'curb', '~> 0.8.6'
18
21
  s.add_runtime_dependency 'basiccache', '~> 0.2.2'
22
+ s.add_runtime_dependency 'nokogiri', '~> 1.6.3.1'
19
23
 
20
24
  s.add_development_dependency 'timecop', '~> 0.7.1'
21
25
  s.add_development_dependency 'rubocop', '~> 0.26.0'
22
26
  s.add_development_dependency 'rake', '~> 10.3.2'
23
27
  s.add_development_dependency 'coveralls', '~> 0.7.1'
24
- s.add_development_dependency 'rspec', '~> 3.0.0'
28
+ s.add_development_dependency 'rspec', '~> 3.1.0'
25
29
  s.add_development_dependency 'fuubar', '~> 2.0.0'
26
30
  end
@@ -1,5 +1,6 @@
1
1
  require 'curb'
2
2
  require 'json'
3
+ require 'nokogiri'
3
4
 
4
5
  ##
5
6
  # Rugged is used if available to look up the user's Github username
@@ -24,7 +25,7 @@ module GithubStats
24
25
  ##
25
26
  # Default URL for grabbing data
26
27
 
27
- DEFAULT_URL = 'https://github.com/users/%s/contributions.json'
28
+ DEFAULT_URL = 'https://github.com/users/%s/contributions'
28
29
 
29
30
  ##
30
31
  # User object
@@ -88,7 +89,11 @@ module GithubStats
88
89
  # Downloads new data from Github
89
90
 
90
91
  def download
91
- JSON.parse Curl::Easy.perform(@url).body_str
92
+ svg = Curl::Easy.perform(@url).body_str
93
+ html = Nokogiri::HTML(svg)
94
+ html.css('.day').map do |x|
95
+ x.attributes.values_at('data-date', 'data-count').map(&:value)
96
+ end
92
97
  rescue
93
98
  raise 'Unable to load data from Github'
94
99
  end
@@ -102,4 +107,5 @@ module GithubStats
102
107
  end
103
108
  end
104
109
 
110
+ require 'githubstats/version'
105
111
  require 'githubstats/data'
@@ -0,0 +1,5 @@
1
+ ##
2
+ # Define the version
3
+ module GithubStats
4
+ VERSION = '0.2.16'
5
+ end
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: 0.2.15
4
+ version: 0.2.16
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-09-05 00:00:00.000000000 Z
11
+ date: 2014-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.2.2
41
+ - !ruby/object:Gem::Dependency
42
+ name: nokogiri
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.6.3.1
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.6.3.1
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: timecop
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -100,14 +114,14 @@ dependencies:
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: 3.0.0
117
+ version: 3.1.0
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: 3.0.0
124
+ version: 3.1.0
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: fuubar
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -142,6 +156,7 @@ files:
142
156
  - githubstats.gemspec
143
157
  - lib/githubstats.rb
144
158
  - lib/githubstats/data.rb
159
+ - lib/githubstats/version.rb
145
160
  - spec/examples/akerl.user
146
161
  - spec/examples/fly.user
147
162
  - spec/examples/laker.user