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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2766078e04e0d81fd9017e362c86f3a8a9f5fef6
4
- data.tar.gz: 0752b9c0baa666bfaad9dda3023695196ee11886
3
+ metadata.gz: ef5e18a4802efc6489e237ca91d8f658babe17ec
4
+ data.tar.gz: f55674b137c243f48cfdf53e5ec7d34cc2cd08ce
5
5
  SHA512:
6
- metadata.gz: 82426a60cdfaed678185ad17f07e5e5fc76fc8c5d0cfeab1127dd8e30758aec78acabb76a5afa75889fe1dee032008fe571d4981d42446d2fb8349bd1b55ad07
7
- data.tar.gz: e5c1f836bbb0153debf140fee05ff6929eb6728c0b23e14dbc9391a8482f940ef467764413e432dc23ff6b4d0be164a5acf45079e6acca0d488dcec9acca7fd6
6
+ metadata.gz: a96917b41359f944b2e382689fc1f4790390206a84f9e8b696f1d4ab308cb85008ebd9dceff178bb06c8371416d2f19d3c790420236f592d7f3c51e845d95a03
7
+ data.tar.gz: bda57e4def1b0070e3c846c934adfe5d23a34d6ff59e603241bd0ddbdf228593d0442a8435746a6740305f18cd17e7e10b32b201874aad52100657d9da26bd43
data/.rubocop.yml CHANGED
@@ -6,7 +6,7 @@ Metrics/MethodLength:
6
6
  Metrics/ClassLength:
7
7
  Max: 150
8
8
  Metrics/AbcSize:
9
- Max: 100
9
+ Max: 200
10
10
  Style/MultilineMethodCallIndentation:
11
11
  Enabled: false
12
12
  Style/IndentationWidth:
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('git log "--pretty=format:%H %cI" --reverse', path)
49
- .stdout.split(/\n/).map { |c| c.split(' ') }
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 |sha, date|
53
- Exec.new("git checkout --quiet #{sha}", path).stdout
54
- {
55
- date: 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[sha],
61
- sha: 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 = Tempfile.new('tdx')
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
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2017 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module TDX
28
- VERSION = '0.2.4'.freeze
28
+ VERSION = '0.2.5'.freeze
29
29
  end
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
- File.write(
59
- '/tmp/a.svg',
58
+ assert(
60
59
  TDX::Base.new(
61
- 'https://github.com/yegor256/jare.git',
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', argument: :required
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
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-15 00:00:00.000000000 Z
11
+ date: 2017-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop