git-age 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/README.md +4 -0
- data/graph-cli.png +0 -0
- data/lib/git/age/graph_cli.rb +1 -2
- data/lib/git/age/main.rb +17 -1
- data/lib/git/age/stats.rb +32 -0
- data/lib/git/age/version.rb +1 -1
- data/lib/git/age.rb +1 -0
- data.tar.gz.sig +0 -0
- metadata +3 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4085ff2fcbb2716f679f72390a9f896892a2623fea3635ae234539471cf154a7
|
4
|
+
data.tar.gz: 4666d870907b6aecf5490eb01ddbcb6dfe6957705616ea697d935bc98b2ee6b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f8636eddb349efa34d91d05cfbf49d165834bf3d22d188bf1160276eb4ff1dfea73761283cac50b49638a158a44582478d09284e626e0843430c6d935489c12
|
7
|
+
data.tar.gz: e9c065d66218683e39b6a3b719e8ae95abfd89163d14505f4221fc0856a9749ae5f4409c6f3cc4e0e255c72c5227136fcdf74a0b153277a0f1033c1d4369bfd0
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/README.md
CHANGED
data/graph-cli.png
ADDED
Binary file
|
data/lib/git/age/graph_cli.rb
CHANGED
@@ -11,11 +11,10 @@ module Git
|
|
11
11
|
options = Git::Age::Options.instance
|
12
12
|
STDOUT.puts "Creating image #{options.image} ..."
|
13
13
|
|
14
|
-
cmd = "graph #{input} --bar -o #{options.image} --title '#{options.title}' --xlabel='#{options.xtitle}' --ylabel='#{options.ytitle}' --xtick-fontsize 5 --time-format-output '%Y-%m-%d' --legend=''"
|
14
|
+
cmd = "graph #{input} --bar -o #{options.image} --title '#{options.title}' --xlabel='#{options.xtitle}' --ylabel='#{options.ytitle}' --xtick-fontsize 5 --time-format-output '%Y-%m-%d' --legend='' 2> /dev/null"
|
15
15
|
rst = IO.popen(cmd) do |io|
|
16
16
|
io.read
|
17
17
|
end
|
18
|
-
STDOUT.puts rst
|
19
18
|
end
|
20
19
|
end
|
21
20
|
end
|
data/lib/git/age/main.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
+
require 'date'
|
1
2
|
require 'io/console'
|
2
3
|
|
3
4
|
module Git
|
4
5
|
module Age
|
5
6
|
class Main
|
7
|
+
attr_reader :dates, :files
|
8
|
+
|
6
9
|
def initialize
|
7
10
|
STDOUT.puts "Waiting, analysing your repository ..."
|
8
11
|
|
@@ -16,6 +19,7 @@ module Git
|
|
16
19
|
sort_dates
|
17
20
|
create_csv
|
18
21
|
create_image
|
22
|
+
show_stats
|
19
23
|
rescue => e
|
20
24
|
STDERR.puts "Error: #{e}"
|
21
25
|
end
|
@@ -27,7 +31,6 @@ module Git
|
|
27
31
|
total = @files.size
|
28
32
|
mapfile = Git::Age::Options.instance.map ? File.open("/tmp/git-age.map", 'w') : nil
|
29
33
|
|
30
|
-
|
31
34
|
@files.each do |file|
|
32
35
|
cnt += 1
|
33
36
|
next unless text?(file)
|
@@ -109,6 +112,19 @@ module Git
|
|
109
112
|
io.read
|
110
113
|
end.match?(/\Atext/)
|
111
114
|
end
|
115
|
+
|
116
|
+
def show_stats
|
117
|
+
stats = Git::Age::Stats.new(self)
|
118
|
+
first = Date.parse(stats.first_commit)
|
119
|
+
last = Date.parse(stats.last_commit)
|
120
|
+
diff = (last - first).to_i
|
121
|
+
ustats = stats.unchanged_stats
|
122
|
+
|
123
|
+
puts "First commit in: #{first}"
|
124
|
+
puts "Last commit in: #{last}"
|
125
|
+
puts "Repository is #{diff} days old"
|
126
|
+
puts "Month with more lines unchanged: #{ustats[:bigger][:date]} (#{ustats[:bigger][:lines]} lines)"
|
127
|
+
end
|
112
128
|
end
|
113
129
|
end
|
114
130
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Git
|
2
|
+
module Age
|
3
|
+
class Stats
|
4
|
+
def initialize(data)
|
5
|
+
@data = data
|
6
|
+
end
|
7
|
+
|
8
|
+
def first_commit
|
9
|
+
commit_date('--reverse')
|
10
|
+
end
|
11
|
+
|
12
|
+
def last_commit
|
13
|
+
commit_date
|
14
|
+
end
|
15
|
+
|
16
|
+
def unchanged_stats
|
17
|
+
max = @data.dates.max_by { |key, value| value }
|
18
|
+
{ bigger: { date: max[0], lines: max[1] } }
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def commit_date(order = nil)
|
24
|
+
cmd = "git log #{order} --pretty=format:%ad --date=short | head -n1"
|
25
|
+
|
26
|
+
IO.popen(cmd) do |io|
|
27
|
+
io.read.chomp.strip
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/git/age/version.rb
CHANGED
data/lib/git/age.rb
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-age
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eustaquio Rangel
|
@@ -58,10 +58,12 @@ files:
|
|
58
58
|
- bin/setup
|
59
59
|
- gem-public_cert.pem
|
60
60
|
- git-age.gemspec
|
61
|
+
- graph-cli.png
|
61
62
|
- lib/git/age.rb
|
62
63
|
- lib/git/age/graph_cli.rb
|
63
64
|
- lib/git/age/main.rb
|
64
65
|
- lib/git/age/options.rb
|
66
|
+
- lib/git/age/stats.rb
|
65
67
|
- lib/git/age/version.rb
|
66
68
|
homepage: https://github.com/taq/git-age
|
67
69
|
licenses: []
|
metadata.gz.sig
CHANGED
Binary file
|