git_heat 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -0
- data/Gemfile.lock +12 -1
- data/bin/git-heat +64 -11
- data/git_heat.gemspec +1 -0
- data/lib/git_heat/calculator.rb +1 -0
- data/lib/git_heat/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19c32b72702bccd51da7217e4cf6426781163791
|
4
|
+
data.tar.gz: 44fb1cfae2db909563cc2aaba5e971c8e8bd23eb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3eb46c59231275601a7a1d4773c17ca3292f12798c88ab9b5cdd0aff31cf365940fc372f4c648eb819bdbdc6ac42272c909a297b512fe39b10cfea641e5b6e80
|
7
|
+
data.tar.gz: fab2edf1b613ed23be35691f9f3c391fcd52224c8e020f6d5eedab94ccc1bbe9586685ca6a8f24014da6dd726657bee5d818b3abffdf5e65d433190c3d4c06a7
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
git_heat (0.0
|
4
|
+
git_heat (0.1.0)
|
5
|
+
topchart
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
10
|
+
coderay (1.1.0)
|
9
11
|
diff-lcs (1.2.5)
|
12
|
+
method_source (0.8.2)
|
13
|
+
pry (0.9.12.4)
|
14
|
+
coderay (~> 1.0)
|
15
|
+
method_source (~> 0.8)
|
16
|
+
slop (~> 3.4)
|
10
17
|
rake (10.3.1)
|
11
18
|
rspec (2.14.1)
|
12
19
|
rspec-core (~> 2.14.0)
|
@@ -16,6 +23,8 @@ GEM
|
|
16
23
|
rspec-expectations (2.14.5)
|
17
24
|
diff-lcs (>= 1.1.3, < 2.0)
|
18
25
|
rspec-mocks (2.14.6)
|
26
|
+
slop (3.4.7)
|
27
|
+
topchart (0.0.1)
|
19
28
|
|
20
29
|
PLATFORMS
|
21
30
|
ruby
|
@@ -23,5 +32,7 @@ PLATFORMS
|
|
23
32
|
DEPENDENCIES
|
24
33
|
bundler (~> 1.3)
|
25
34
|
git_heat!
|
35
|
+
pry
|
26
36
|
rake
|
27
37
|
rspec
|
38
|
+
topchart
|
data/bin/git-heat
CHANGED
@@ -3,16 +3,69 @@
|
|
3
3
|
require_relative '../lib/git_heat/git_stat'
|
4
4
|
require_relative '../lib/git_heat/git_client'
|
5
5
|
require_relative '../lib/git_heat/calculator'
|
6
|
+
require 'topchart'
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
class Object
|
9
|
+
def pat(&blk)
|
10
|
+
!self.nil? && blk.call(self)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
|
15
|
+
class Runner
|
16
|
+
def initialize(time)
|
17
|
+
@time = time
|
18
|
+
end
|
19
|
+
|
20
|
+
def go(args,opts)
|
21
|
+
args = Array(args)
|
22
|
+
opts = Array(opts)
|
23
|
+
dir = args[0] || Dir.pwd
|
24
|
+
|
25
|
+
begin
|
26
|
+
Calculator.new(@time).go(
|
27
|
+
GitStat.new(
|
28
|
+
GitClient.new(dir)
|
29
|
+
).stats
|
30
|
+
).map do |a|
|
31
|
+
if opts.include? '--no-scores'
|
32
|
+
a[0]
|
33
|
+
else
|
34
|
+
a[0].to_s.ljust(80) + a[1].to_s
|
35
|
+
end
|
36
|
+
end.to_a
|
37
|
+
rescue Errno::EPIPE
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
opt = ->(a){ a[/^-/] }
|
43
|
+
opts = ARGV.select(&opt)
|
44
|
+
args = ARGV.reject(&opt)
|
45
|
+
|
46
|
+
time_opt = opts.detect{|o| o[/--time=(.*)/, 1] }.pat(&Time.method(:parse))
|
47
|
+
time = time_opt || Time.now
|
48
|
+
a_day = 60*60*24
|
49
|
+
chart_opt = opts.map{|o| o[/--chart(.*)$/, 1] }.compact.last.pat do |dur_str|
|
50
|
+
dur_str = dur_str.gsub("=","")
|
51
|
+
case dur_str
|
52
|
+
when "day"
|
53
|
+
a_day
|
54
|
+
when "week"
|
55
|
+
a_day*7
|
56
|
+
when "30day"
|
57
|
+
a_day*30
|
58
|
+
else
|
59
|
+
dur_str.to_i*a_day
|
60
|
+
end
|
61
|
+
end
|
62
|
+
chart_duration = chart_opt || a_day
|
63
|
+
|
64
|
+
if chart_opt
|
65
|
+
puts Topchart.new.chart(
|
66
|
+
Runner.new(time-chart_duration).go(args, ["--no-scores"]),
|
67
|
+
Runner.new(time).go(args, ["--no-scores"])
|
68
|
+
).map{|l| l.join(" ")}
|
69
|
+
else
|
70
|
+
puts Runner.new(time).go(args, opts)
|
18
71
|
end
|
data/git_heat.gemspec
CHANGED
data/lib/git_heat/calculator.rb
CHANGED
data/lib/git_heat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_heat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serguei Filimonov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: topchart
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
description: 'Reports a measure of activity in each file of a git repo '
|
70
84
|
email:
|
71
85
|
- serguei.filimonov@gmail.com
|