tdx 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/bin/tdx +3 -1
- data/lib/tdx/base.rb +19 -13
- data/lib/tdx/version.rb +1 -1
- data/test/test_tdx.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef5e18a4802efc6489e237ca91d8f658babe17ec
|
4
|
+
data.tar.gz: f55674b137c243f48cfdf53e5ec7d34cc2cd08ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96917b41359f944b2e382689fc1f4790390206a84f9e8b696f1d4ab308cb85008ebd9dceff178bb06c8371416d2f19d3c790420236f592d7f3c51e845d95a03
|
7
|
+
data.tar.gz: bda57e4def1b0070e3c846c934adfe5d23a34d6ff59e603241bd0ddbdf228593d0442a8435746a6740305f18cd17e7e10b32b201874aad52100657d9da26bd43
|
data/.rubocop.yml
CHANGED
data/bin/tdx
CHANGED
@@ -33,10 +33,12 @@ opts = Slop.parse(args, strict: true, help: true) do |o|
|
|
33
33
|
o.bool '-h', '--help', 'Show usage summary'
|
34
34
|
o.bool '-v', '--version', 'Show current version'
|
35
35
|
o.array(
|
36
|
-
'--tests',
|
36
|
+
'-t', '--tests',
|
37
37
|
'Comma-separated list of glob masks with test-related files',
|
38
38
|
delimiter: ','
|
39
39
|
)
|
40
|
+
o.string '-d', '--data', 'Path of .dat file for Gnuplot'
|
41
|
+
o.string '--sha', 'The SHA to start from'
|
40
42
|
o.string '--login', 'GitHub login'
|
41
43
|
o.string '--password', 'GitHub password'
|
42
44
|
end
|
data/lib/tdx/base.rb
CHANGED
@@ -45,25 +45,27 @@ module TDX
|
|
45
45
|
raise "git version #{version} is too old, upgrade it to 2.0+" unless
|
46
46
|
Gem::Version.new(version) >= Gem::Version.new('2.0')
|
47
47
|
path = checkout
|
48
|
-
commits = Exec.new(
|
49
|
-
|
48
|
+
commits = Exec.new(
|
49
|
+
'git log "--pretty=format:%H %cI" ' +
|
50
|
+
(@opts[:sha] ? @opts[:sha] : 'HEAD'),
|
51
|
+
path
|
52
|
+
).stdout.split(/\n/).map { |c| c.split(' ') }
|
50
53
|
issues = issues(commits)
|
51
|
-
puts "Date\t\t\tTest\tHoC\tFiles\tLoC\tIssues\tSHA"
|
52
|
-
metrics = commits.map do |
|
53
|
-
Exec.new("git checkout --quiet #{
|
54
|
-
{
|
55
|
-
date:
|
54
|
+
puts "Date\t\t\tTest\tHoC\tFiles\tLoC\tIssues\tSHA\tIdx"
|
55
|
+
metrics = commits.each_with_index.map do |c, i|
|
56
|
+
Exec.new("git checkout --quiet #{c[0]}", path).stdout
|
57
|
+
m = {
|
58
|
+
date: c[1],
|
56
59
|
pure: pure(path),
|
57
60
|
hoc: hoc(path),
|
58
61
|
files: files(path),
|
59
62
|
loc: loc(path),
|
60
|
-
issues: issues[
|
61
|
-
sha:
|
63
|
+
issues: issues[c[0]],
|
64
|
+
sha: c[0]
|
62
65
|
}
|
63
|
-
end
|
64
|
-
metrics.each do |m|
|
65
66
|
puts "#{m[:date][0, 16]}\t#{m[:pure]}\t#{m[:hoc]}\t#{m[:files]}\t\
|
66
|
-
#{m[:loc]}\t#{m[:issues]}\t#{m[:sha][0, 7]}"
|
67
|
+
#{m[:loc]}\t#{m[:issues]}\t#{m[:sha][0, 7]}\t#{i}/#{commits.size}"
|
68
|
+
m
|
67
69
|
end
|
68
70
|
max = { pure: 0, hoc: 0, files: 0, loc: 0, issues: 0 }
|
69
71
|
max = metrics.inject(max) do |m, t|
|
@@ -75,7 +77,11 @@ module TDX
|
|
75
77
|
issues: [m[:issues], t[:issues], 1].max
|
76
78
|
}
|
77
79
|
end
|
78
|
-
dat =
|
80
|
+
dat = if @opts[:data]
|
81
|
+
File.new(@opts[:data], 'w+')
|
82
|
+
else
|
83
|
+
Tempfile.new('tdx')
|
84
|
+
end
|
79
85
|
metrics.each do |m|
|
80
86
|
dat << [
|
81
87
|
m[:date],
|
data/lib/tdx/version.rb
CHANGED
data/test/test_tdx.rb
CHANGED
@@ -55,12 +55,11 @@ class TestPDD < Minitest::Test
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def test_real_github_repo
|
58
|
-
|
59
|
-
'/tmp/a.svg',
|
58
|
+
assert(
|
60
59
|
TDX::Base.new(
|
61
|
-
'https://github.com/yegor256/
|
62
|
-
opts(['--tests', 'src/test/**/*'])
|
63
|
-
).svg
|
60
|
+
'https://github.com/yegor256/empty.git',
|
61
|
+
opts(['--tests', 'src/test/**/*', '--sha', '7c7000d'])
|
62
|
+
).svg.include?('<path ')
|
64
63
|
)
|
65
64
|
end
|
66
65
|
|
@@ -68,7 +67,8 @@ class TestPDD < Minitest::Test
|
|
68
67
|
|
69
68
|
def opts(args)
|
70
69
|
Slop.parse args do |o|
|
71
|
-
o.array '-t', '--tests'
|
70
|
+
o.array '-t', '--tests'
|
71
|
+
o.string '--sha'
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tdx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|