hoc 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- data/features/support/env.rb +1 -2
- data/lib/hoc/git.rb +10 -3
- data/lib/hoc/version.rb +1 -1
- data/test/{test_helper.rb → test__helper.rb} +1 -2
- data/test/test_git.rb +14 -0
- data/test/test_svn.rb +16 -0
- metadata +4 -4
data/features/support/env.rb
CHANGED
data/lib/hoc/git.rb
CHANGED
@@ -35,13 +35,20 @@ module HOC
|
|
35
35
|
version = `git --version`.split(/ /)[2]
|
36
36
|
fail "git version #{version} is too old, upgrade it to 2.0+" unless
|
37
37
|
Gem::Version.new(version) >= Gem::Version.new('2.0')
|
38
|
-
|
38
|
+
cmd = [
|
39
|
+
'git',
|
40
|
+
"'--git-dir=#{@dir}/.git'",
|
41
|
+
'log', '--pretty=tformat:', '--numstat',
|
42
|
+
'--ignore-space-change', '--ignore-all-space',
|
43
|
+
'--ignore-submodules', '--no-color',
|
44
|
+
'--find-copies-harder', '-M', '--diff-filter=ACDM'
|
45
|
+
].join(' ')
|
39
46
|
[
|
40
47
|
Hits.new(
|
41
48
|
Time.now,
|
42
|
-
|
49
|
+
`#{cmd}`.split(/\n/).delete_if(&:empty?).map do |t|
|
43
50
|
t.split(/\t/).take(2).map { |s| s.to_i }.inject(:+)
|
44
|
-
end.inject(:+)
|
51
|
+
end.inject(:+) || 0
|
45
52
|
)
|
46
53
|
]
|
47
54
|
end
|
data/lib/hoc/version.rb
CHANGED
data/test/test_git.rb
CHANGED
@@ -51,4 +51,18 @@ class TestGit < Minitest::Test
|
|
51
51
|
assert_equal 4, hits[0].total
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
def test_parsing_with_empty_git
|
56
|
+
skip('fails now')
|
57
|
+
Dir.mktmpdir 'test' do |dir|
|
58
|
+
fail unless system("
|
59
|
+
set -e
|
60
|
+
cd '#{dir}'
|
61
|
+
git init .
|
62
|
+
")
|
63
|
+
hits = HOC::Git.new(dir).hits
|
64
|
+
assert_equal 1, hits.size
|
65
|
+
assert_equal 0, hits[0].total
|
66
|
+
end
|
67
|
+
end
|
54
68
|
end
|
data/test/test_svn.rb
CHANGED
@@ -52,4 +52,20 @@ class TestSvn < Minitest::Test
|
|
52
52
|
assert_equal 4, hits[0].total
|
53
53
|
end
|
54
54
|
end
|
55
|
+
|
56
|
+
def test_parsing_empty_repo
|
57
|
+
skip('fails now')
|
58
|
+
Dir.mktmpdir 'test' do |dir|
|
59
|
+
fail unless system("
|
60
|
+
set -e
|
61
|
+
cd '#{dir}'
|
62
|
+
svnadmin create base
|
63
|
+
svn co file://#{dir}/base repo
|
64
|
+
cd repo
|
65
|
+
")
|
66
|
+
hits = HOC::Svn.new(File.join(dir, 'repo')).hits
|
67
|
+
assert_equal 1, hits.size
|
68
|
+
assert_equal 0, hits[0].total
|
69
|
+
end
|
70
|
+
end
|
55
71
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: slop
|
@@ -186,8 +186,8 @@ files:
|
|
186
186
|
- lib/hoc/hits.rb
|
187
187
|
- lib/hoc/svn.rb
|
188
188
|
- lib/hoc/version.rb
|
189
|
+
- test/test__helper.rb
|
189
190
|
- test/test_git.rb
|
190
|
-
- test/test_helper.rb
|
191
191
|
- test/test_hoc.rb
|
192
192
|
- test/test_svn.rb
|
193
193
|
homepage: http://github.com/teamed/hoc
|
@@ -221,7 +221,7 @@ test_files:
|
|
221
221
|
- features/gem_package.feature
|
222
222
|
- features/step_definitions/steps.rb
|
223
223
|
- features/support/env.rb
|
224
|
+
- test/test__helper.rb
|
224
225
|
- test/test_git.rb
|
225
|
-
- test/test_helper.rb
|
226
226
|
- test/test_hoc.rb
|
227
227
|
- test/test_svn.rb
|