githubstats 0.2.3 → 0.2.4

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: a41f496b849808b8b3914d30dfdcc9573aa874d4
4
- data.tar.gz: 494012cdbff7ae1ca2fd03f0e8b6e67b395f7dd4
3
+ metadata.gz: fb88ee5beaeff5df29bcfac891df839e313af322
4
+ data.tar.gz: 4dce81c985ec3596c5d3113559e582670af3925d
5
5
  SHA512:
6
- metadata.gz: b96e26ed60dd2774323870b0027c59a3801402b21653939f8fdb1c73081d1290c3291897b5a1ca790b16369a710d0319609ba05ee0c78ef8dbfbcbab9ea1d8bf
7
- data.tar.gz: e22c680b4814cf2f6acf8b506df5af9c5372adaa1840647a55e0dcca31e644a46ce15a7bf2588a4c51f04747c104b9bc7b43dabd72506e3b070e20489c26c2f5
6
+ metadata.gz: f768130d5d3b6856e5f4a0e0cce61ca79d2d947df01919964764931f55b32a382c8dc3c0e17d2e66591d8217f9d23c220d36107e745e78614e9638daa54068a0
7
+ data.tar.gz: 715bcd10f1e9349e61d97a527a101b5dea8f288c95adf774269496a7b9538db174511ecec736426b03e27af2b8a904094e698b65881c46763a2b864cc33932df
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- githubstats (0.2.3)
4
+ githubstats (0.2.4)
5
5
  basiccache (< 2)
6
6
  curb
7
7
  json
@@ -59,7 +59,7 @@ GEM
59
59
  term-ansicolor (1.2.2)
60
60
  tins (~> 0.8)
61
61
  thor (0.18.1)
62
- timecop (0.6.3)
62
+ timecop (0.7.0)
63
63
  tins (0.13.1)
64
64
  travis-lint (1.7.0)
65
65
  hashr (~> 0.0.22)
data/bin/githubstats CHANGED
@@ -6,8 +6,8 @@ user = GithubStats.new ARGV.first
6
6
 
7
7
  puts "Contribution data for #{user.name}:
8
8
  Today's score: #{user.today}
9
- Current streak: #{user.streak.length}
10
- Longest streak: #{user.longest_streak.length}
9
+ Current streak: #{(user.streak || []).length}
10
+ Longest streak: #{(user.longest_streak || []).length}
11
11
  High score: #{user.max.score} on #{user.max.date}
12
12
  Quartile boundaries: #{user.quartile_boundaries.inspect}"
13
13
 
data/githubstats.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'githubstats'
3
- s.version = '0.2.3'
3
+ s.version = '0.2.4'
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
 
6
6
  s.summary = 'Present Github contributions stats in a consumable format'
data/lib/githubstats.rb CHANGED
@@ -1,13 +1,14 @@
1
1
  require 'curb'
2
2
  require 'json'
3
- autoload :Rugged, 'rugged'
3
+
4
4
  ##
5
5
  # Rugged is used if available to look up the user's Github username
6
6
 
7
7
  begin
8
- RUGGED_USER = Rugged::Config.global['github.user']
8
+ require 'rugged'
9
+ USE_RUGGED = true
9
10
  rescue LoadError
10
- RUGGED_USER = nil
11
+ USE_RUGGED = false
11
12
  end
12
13
 
13
14
  ##
@@ -72,7 +73,7 @@ module GithubStats
72
73
  # Guesses the user's name based on system environment
73
74
 
74
75
  def guess_user(names = [])
75
- names << RUGGED_USER
76
+ names << Rugged::Config.global['github.user'] if USE_RUGGED
76
77
  names << ENV['USER']
77
78
  names.find { |name| !name.nil? } || (fail 'Failed to guess username')
78
79
  end
@@ -73,13 +73,14 @@ module GithubStats
73
73
  acc
74
74
  end
75
75
  streaks.reject! { |s| s.empty? }
76
- streaks.first.empty? ? streaks[1..-1] : streaks
76
+ streaks
77
77
  end
78
78
 
79
79
  ##
80
80
  # The longest streak
81
81
 
82
82
  def longest_streak
83
+ return nil if streaks.empty?
83
84
  streaks.max { |a, b| a.length <=> b.length }
84
85
  end
85
86
 
@@ -87,6 +88,7 @@ module GithubStats
87
88
  # The current streak, or nil
88
89
 
89
90
  def streak
91
+ return nil if streaks.empty?
90
92
  streaks.last.last.date >= Date.today - 1 ? streaks.last : []
91
93
  end
92
94
 
Binary file
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.3
4
+ version: 0.2.4
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-01 00:00:00.000000000 Z
11
+ date: 2013-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb
@@ -222,7 +222,7 @@ files:
222
222
  - vendor/cache/slop-3.4.7.gem
223
223
  - vendor/cache/term-ansicolor-1.2.2.gem
224
224
  - vendor/cache/thor-0.18.1.gem
225
- - vendor/cache/timecop-0.6.3.gem
225
+ - vendor/cache/timecop-0.7.0.gem
226
226
  - vendor/cache/tins-0.13.1.gem
227
227
  - vendor/cache/travis-lint-1.7.0.gem
228
228
  homepage: https://github.com/akerl/githubstats
Binary file