tdx 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.0pdd.yml +5 -0
- data/.coveralls.yml +2 -0
- data/.gitattributes +7 -0
- data/.gitignore +7 -0
- data/.pdd +9 -0
- data/.rubocop.yml +9 -0
- data/.rultor.yml +26 -0
- data/.simplecov +43 -0
- data/.travis.yml +12 -0
- data/Gemfile +24 -0
- data/LICENSE.txt +21 -0
- data/README.md +63 -0
- data/Rakefile +78 -0
- data/bin/tdx +90 -0
- data/cucumber.yml +3 -0
- data/features/cli.feature +20 -0
- data/features/step_definitions/steps.rb +93 -0
- data/features/support/env.rb +24 -0
- data/lib/tdx.rb +24 -0
- data/lib/tdx/base.rb +114 -0
- data/lib/tdx/version.rb +29 -0
- data/tdx.gemspec +55 -0
- data/test/test__helper.rb +25 -0
- data/test/test_tdx.rb +68 -0
- metadata +188 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: '094427fce2f4adf7f7771fddcd9e743e8be40e7a'
|
4
|
+
data.tar.gz: 8da46abf56734d823cfd518bba1d7a19ff0a745e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ea8b250773f7ae8b0e53a69d8e35ef928be212b6a82767d00baecc2989b4d39fd87cce3ad1764f9309ad82d798116013448629ae84cd34339cbefb0e0b4bea31
|
7
|
+
data.tar.gz: 425317f013b2af729caec57079b05489c92e5af8fccee1c722d6b1327cba5c4269b98971452eeb13e102d5307fb2097480add320909c939c17a9140ec73bd032
|
data/.0pdd.yml
ADDED
data/.coveralls.yml
ADDED
data/.gitattributes
ADDED
data/.gitignore
ADDED
data/.pdd
ADDED
data/.rubocop.yml
ADDED
data/.rultor.yml
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
assets:
|
2
|
+
rubygems.yml: zerocracy/home#assets/rubygems.yml
|
3
|
+
install: |-
|
4
|
+
sudo gem install hoc
|
5
|
+
sudo apt-get update -y
|
6
|
+
sudo apt-get install -y cloc
|
7
|
+
sudo apt-get install -y gnuplot
|
8
|
+
release:
|
9
|
+
script: |-
|
10
|
+
sudo bundle install
|
11
|
+
rake
|
12
|
+
rm -rf *.gem
|
13
|
+
sed -i "s/1\.0\.snapshot/${tag}/g" lib/tdx/version.rb
|
14
|
+
git add lib/tdx/version.rb
|
15
|
+
git commit -m "version set to ${tag}"
|
16
|
+
gem build tdx.gemspec
|
17
|
+
chmod 0600 ../rubygems.yml
|
18
|
+
gem push *.gem --config-file ../rubygems.yml
|
19
|
+
commanders:
|
20
|
+
- yegor256
|
21
|
+
architect:
|
22
|
+
- yegor256
|
23
|
+
- davvd
|
24
|
+
merge:
|
25
|
+
commanders: []
|
26
|
+
deploy: {}
|
data/.simplecov
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'coveralls'
|
24
|
+
|
25
|
+
if Gem.win_platform? then
|
26
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
27
|
+
SimpleCov::Formatter::HTMLFormatter
|
28
|
+
]
|
29
|
+
SimpleCov.start do
|
30
|
+
add_filter "/test/"
|
31
|
+
add_filter "/features/"
|
32
|
+
end
|
33
|
+
else
|
34
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
35
|
+
SimpleCov::Formatter::HTMLFormatter,
|
36
|
+
Coveralls::SimpleCov::Formatter
|
37
|
+
]
|
38
|
+
SimpleCov.start do
|
39
|
+
add_filter "/test/"
|
40
|
+
add_filter "/features/"
|
41
|
+
minimum_coverage 80
|
42
|
+
end
|
43
|
+
end
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
source 'https://rubygems.org'
|
24
|
+
gemspec
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
(The MIT License)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
[![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/tdx)](http://www.rultor.com/p/yegor256/tdx)
|
2
|
+
[![We recommend RubyMine](http://img.teamed.io/rubymine-recommend.svg)](https://www.jetbrains.com/ruby/)
|
3
|
+
|
4
|
+
[![Build Status](https://travis-ci.org/yegor256/tdx.svg)](https://travis-ci.org/yegor256/tdx)
|
5
|
+
[![PDD status](http://www.0pdd.com/svg?name=yegor256/tdx)](http://www.0pdd.com/p?name=yegor256/tdx)
|
6
|
+
[![Gem Version](https://badge.fury.io/rb/tdx.svg)](http://badge.fury.io/rb/tdx)
|
7
|
+
[![Dependency Status](https://gemnasium.com/yegor256/tdx.svg)](https://gemnasium.com/yegor256/tdx)
|
8
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/yegor256/tdx.svg)](https://codeclimate.com/github/yegor256/tdx)
|
9
|
+
[![Coverage Status](https://img.shields.io/coveralls/yegor256/tdx.svg)](https://coveralls.io/r/yegor256/tdx)
|
10
|
+
|
11
|
+
## What This is for?
|
12
|
+
|
13
|
+
I will tell you later...
|
14
|
+
|
15
|
+
## How to Install?
|
16
|
+
|
17
|
+
First, install
|
18
|
+
[gnuplot](http://www.gnuplot.info/),
|
19
|
+
[cloc](http://cloc.sourceforge.net/),
|
20
|
+
and
|
21
|
+
[hoc](https://github.com/yegor256/hoc).
|
22
|
+
|
23
|
+
Install it first:
|
24
|
+
|
25
|
+
```bash
|
26
|
+
$ gem install tdx
|
27
|
+
```
|
28
|
+
|
29
|
+
## How to Run?
|
30
|
+
|
31
|
+
Run it locally and read its output:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
$ tdx --help
|
35
|
+
```
|
36
|
+
|
37
|
+
## How to contribute
|
38
|
+
|
39
|
+
Just fork it and submit a pull request. Make sure `rake` passes.
|
40
|
+
|
41
|
+
## LICENSE
|
42
|
+
|
43
|
+
(The MIT License)
|
44
|
+
|
45
|
+
Copyright (c) 2017 Yegor Bugayenko
|
46
|
+
|
47
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
48
|
+
of this software and associated documentation files (the 'Software'), to deal
|
49
|
+
in the Software without restriction, including without limitation the rights
|
50
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
51
|
+
copies of the Software, and to permit persons to whom the Software is
|
52
|
+
furnished to do so, subject to the following conditions:
|
53
|
+
|
54
|
+
The above copyright notice and this permission notice shall be included in all
|
55
|
+
copies or substantial portions of the Software.
|
56
|
+
|
57
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
58
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
59
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
60
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
61
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
62
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
63
|
+
SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'rubygems'
|
24
|
+
require 'rake'
|
25
|
+
require 'rdoc'
|
26
|
+
require 'rake/clean'
|
27
|
+
|
28
|
+
def name
|
29
|
+
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
30
|
+
end
|
31
|
+
|
32
|
+
def version
|
33
|
+
Gem::Specification.load(Dir['*.gemspec'].first).version
|
34
|
+
end
|
35
|
+
|
36
|
+
task default: [:clean, :test, :features, :rubocop, :copyright]
|
37
|
+
|
38
|
+
require 'rake/testtask'
|
39
|
+
desc 'Run all unit tests'
|
40
|
+
Rake::TestTask.new(:test) do |test|
|
41
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
42
|
+
test.libs << 'lib' << 'test'
|
43
|
+
test.pattern = 'test/**/test_*.rb'
|
44
|
+
test.verbose = false
|
45
|
+
end
|
46
|
+
|
47
|
+
require 'rdoc/task'
|
48
|
+
desc 'Build RDoc documentation'
|
49
|
+
Rake::RDocTask.new do |rdoc|
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "#{name} #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
56
|
+
require 'rubocop/rake_task'
|
57
|
+
desc 'Run RuboCop on all directories'
|
58
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
59
|
+
task.fail_on_error = true
|
60
|
+
task.requires << 'rubocop-rspec'
|
61
|
+
end
|
62
|
+
|
63
|
+
require 'cucumber/rake/task'
|
64
|
+
Cucumber::Rake::Task.new(:features) do |t|
|
65
|
+
Rake::Cleaner.cleanup_files(['coverage'])
|
66
|
+
t.profile = 'travis'
|
67
|
+
end
|
68
|
+
Cucumber::Rake::Task.new(:"features:html") do |t|
|
69
|
+
t.profile = 'html_report'
|
70
|
+
end
|
71
|
+
|
72
|
+
task :copyright do
|
73
|
+
sh "grep -q -r '#{Date.today.strftime('%Y')}' \
|
74
|
+
--include '*.rb' \
|
75
|
+
--include '*.txt' \
|
76
|
+
--include 'Rakefile' \
|
77
|
+
."
|
78
|
+
end
|
data/bin/tdx
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
#
|
4
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
5
|
+
#
|
6
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
8
|
+
# in the Software without restriction, including without limitation the rights
|
9
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
|
+
# copies of the Software, and to permit persons to whom the Software is
|
11
|
+
# furnished to do so, subject to the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be included in all
|
14
|
+
# copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
19
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
20
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
22
|
+
# SOFTWARE.
|
23
|
+
|
24
|
+
STDOUT.sync = true
|
25
|
+
|
26
|
+
require 'slop'
|
27
|
+
require 'tdx'
|
28
|
+
|
29
|
+
args = ARGV
|
30
|
+
|
31
|
+
opts = Slop.parse(args, strict: true, help: true) do
|
32
|
+
banner "Usage (#{TDX::VERSION}): tdx [options]"
|
33
|
+
on('version', 'Show current version')
|
34
|
+
on(
|
35
|
+
'r',
|
36
|
+
'repo',
|
37
|
+
'Repository URI, e.g. "git@github.com:yegor256/tdx.git"',
|
38
|
+
type: String,
|
39
|
+
argument: :required,
|
40
|
+
limit: 1
|
41
|
+
)
|
42
|
+
on(
|
43
|
+
'tests',
|
44
|
+
'Comma-separated list of relative paths with test-related files',
|
45
|
+
type: String,
|
46
|
+
argument: :required,
|
47
|
+
limit: 1
|
48
|
+
)
|
49
|
+
on(
|
50
|
+
'login',
|
51
|
+
'GitHub login',
|
52
|
+
argument: :required,
|
53
|
+
type: String,
|
54
|
+
limit: 1
|
55
|
+
)
|
56
|
+
on(
|
57
|
+
'password',
|
58
|
+
'GitHub password',
|
59
|
+
argument: :required,
|
60
|
+
type: String,
|
61
|
+
limit: 1
|
62
|
+
)
|
63
|
+
on(
|
64
|
+
's',
|
65
|
+
'svg',
|
66
|
+
'Full path of the SVG file to generate (STDOUT otherwise)',
|
67
|
+
argument: :required,
|
68
|
+
type: String,
|
69
|
+
limit: 1
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
if opts.help?
|
74
|
+
puts opts
|
75
|
+
exit
|
76
|
+
end
|
77
|
+
|
78
|
+
if opts.version?
|
79
|
+
puts TDX::VERSION
|
80
|
+
exit
|
81
|
+
end
|
82
|
+
|
83
|
+
Encoding.default_external = Encoding::UTF_8
|
84
|
+
Encoding.default_internal = Encoding::UTF_8
|
85
|
+
output = TDX::Base.new(opts).svg
|
86
|
+
if opts[:svg]
|
87
|
+
File.new(opts[:svg], 'w') << output
|
88
|
+
else
|
89
|
+
puts output
|
90
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: Command Line Processing
|
2
|
+
As a repository owner I want to be able to
|
3
|
+
call TDX as a command line tool
|
4
|
+
|
5
|
+
Scenario: Help can be printed
|
6
|
+
When I run bin/tdx with "-h"
|
7
|
+
Then Exit code is zero
|
8
|
+
And Stdout contains "--version"
|
9
|
+
|
10
|
+
Scenario: Version can be printed
|
11
|
+
When I run bin/tdx with "--version"
|
12
|
+
Then Exit code is zero
|
13
|
+
|
14
|
+
Scenario: Simple SVG is built
|
15
|
+
Given I have a Git repository in ./repo
|
16
|
+
When I run bin/tdx with "--svg pic.svg --repo file://$(pwd)/repo"
|
17
|
+
Then Stdout is empty
|
18
|
+
Then Exit code is zero
|
19
|
+
And SVG is valid in "pic.svg"
|
20
|
+
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'tdx'
|
24
|
+
require 'nokogiri'
|
25
|
+
require 'tmpdir'
|
26
|
+
require 'slop'
|
27
|
+
require 'English'
|
28
|
+
|
29
|
+
Before do
|
30
|
+
@cwd = Dir.pwd
|
31
|
+
@dir = Dir.mktmpdir('test')
|
32
|
+
FileUtils.mkdir_p(@dir) unless File.exist?(@dir)
|
33
|
+
Dir.chdir(@dir)
|
34
|
+
end
|
35
|
+
|
36
|
+
After do
|
37
|
+
Dir.chdir(@cwd)
|
38
|
+
FileUtils.rm_rf(@dir) if File.exist?(@dir)
|
39
|
+
end
|
40
|
+
|
41
|
+
Given(%r{^I have a Git repository in ./repo$}) do
|
42
|
+
raise unless system("
|
43
|
+
set -e
|
44
|
+
cd '#{@dir}'
|
45
|
+
git init --quiet repo
|
46
|
+
cd repo
|
47
|
+
git config user.email yegor256@gmail.com
|
48
|
+
git config user.name 'Mr. Tester'
|
49
|
+
echo 'a = 1' > 1.rb && git add 1.rb && git commit -qam '1'
|
50
|
+
echo '<?php b = 2' > 2.php && git add 2.php && git commit -qam '2'
|
51
|
+
mkdir tests
|
52
|
+
echo 'c = 3' > tests/3.py && git add tests/3.py && git commit -qam '3'
|
53
|
+
")
|
54
|
+
end
|
55
|
+
|
56
|
+
When(%r{^I run bin/tdx with "([^"]+)"$}) do |arg|
|
57
|
+
home = File.join(File.dirname(__FILE__), '../..')
|
58
|
+
@stdout = `ruby -I#{home}/lib #{home}/bin/tdx #{arg}`
|
59
|
+
@exitstatus = $CHILD_STATUS.exitstatus
|
60
|
+
end
|
61
|
+
|
62
|
+
Then(/^Exit code is zero$/) do
|
63
|
+
raise "Non-zero exit code #{@exitstatus}" unless @exitstatus == 0
|
64
|
+
end
|
65
|
+
|
66
|
+
Then(/^Exit code is not zero$/) do
|
67
|
+
raise 'Zero exit code' if @exitstatus == 0
|
68
|
+
end
|
69
|
+
|
70
|
+
Then(/^SVG is valid in "([^"]+)"$/) do |path|
|
71
|
+
data = File.read(path)
|
72
|
+
xml = Nokogiri::XML.parse(data)
|
73
|
+
xml.remove_namespaces!
|
74
|
+
raise "SVG is broken: #{xml}" if xml.xpath('/svg//path').empty?
|
75
|
+
end
|
76
|
+
|
77
|
+
Then(/^Stdout is empty$/) do
|
78
|
+
raise "STDOUT is not empty:\n#{@stdout}" unless @stdout == ''
|
79
|
+
end
|
80
|
+
|
81
|
+
Then(/^Stdout contains "([^"]*)"$/) do |txt|
|
82
|
+
unless @stdout.include?(txt)
|
83
|
+
raise "STDOUT doesn't contain '#{txt}':\n#{@stdout}"
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
Given(/^It is Unix$/) do
|
88
|
+
pending if Gem.win_platform?
|
89
|
+
end
|
90
|
+
|
91
|
+
Given(/^It is Windows$/) do
|
92
|
+
pending unless Gem.win_platform?
|
93
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'simplecov'
|
24
|
+
require 'tdx'
|
data/lib/tdx.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'tdx/base'
|
24
|
+
require 'tdx/version'
|
data/lib/tdx/base.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'yaml'
|
24
|
+
require 'fileutils'
|
25
|
+
|
26
|
+
# TDX main module.
|
27
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
28
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
29
|
+
# License:: MIT
|
30
|
+
module TDX
|
31
|
+
# Base class
|
32
|
+
class Base
|
33
|
+
def initialize(opts)
|
34
|
+
@opts = opts
|
35
|
+
end
|
36
|
+
|
37
|
+
def svg
|
38
|
+
dat = Tempfile.new('tdx.dat')
|
39
|
+
version = `git --version`.split(/ /)[2]
|
40
|
+
raise "git version #{version} is too old, upgrade it to 2.0+" unless
|
41
|
+
Gem::Version.new(version) >= Gem::Version.new('2.0')
|
42
|
+
path = checkout
|
43
|
+
commits =
|
44
|
+
`cd "#{path}" && git log '--pretty=format:%H %cI' --reverse`
|
45
|
+
.split(/\n/)
|
46
|
+
.map { |c| c.split(' ') }
|
47
|
+
issues = issues(commits)
|
48
|
+
commits.each do |sha, date|
|
49
|
+
`cd "#{path}" && git checkout --quiet #{sha}`
|
50
|
+
dat << "#{date} #{tests(path)} #{hoc(path)} #{files(path)}"
|
51
|
+
dat << " #{loc(path)} #{issues[sha]}\n"
|
52
|
+
end
|
53
|
+
dat.close
|
54
|
+
svg = Tempfile.new('tdx.svg')
|
55
|
+
gpi = [
|
56
|
+
"set output \"#{svg.path}\"",
|
57
|
+
'set terminal svg size 700, 260',
|
58
|
+
'set termoption font "monospace,10"',
|
59
|
+
'set xdata time',
|
60
|
+
'set timefmt "%Y-%m"',
|
61
|
+
'set ytics format "%.0f%%" textcolor rgb "#81b341"',
|
62
|
+
'set grid linecolor rgb "gray"',
|
63
|
+
'set xtics format "%b/%y" font "monospace,8" textcolor rgb "black"',
|
64
|
+
'set autoscale',
|
65
|
+
'set style fill solid',
|
66
|
+
'set boxwidth 0.75 relative',
|
67
|
+
"plot \"#{dat.path}\" using 1:2 with boxes \
|
68
|
+
title \"Test HoC\" linecolor rgb \"#81b341\""
|
69
|
+
]
|
70
|
+
`gnuplot -e '#{gpi.join(';')}' 2>/dev/null`
|
71
|
+
FileUtils.rm_rf(path)
|
72
|
+
File.delete(dat)
|
73
|
+
xml = File.read(svg)
|
74
|
+
File.delete(svg)
|
75
|
+
xml
|
76
|
+
end
|
77
|
+
|
78
|
+
private
|
79
|
+
|
80
|
+
def checkout
|
81
|
+
dir = Dir.mktmpdir
|
82
|
+
`cd #{dir} && git clone --quiet #{@opts[:repo]} .`
|
83
|
+
dir
|
84
|
+
end
|
85
|
+
|
86
|
+
def files(path)
|
87
|
+
Dir.glob("#{path}/**/*").size
|
88
|
+
end
|
89
|
+
|
90
|
+
def loc(path)
|
91
|
+
cloc = `cd "#{path}" && cloc . --yaml --quiet 2>/dev/null`
|
92
|
+
yaml = YAML.load(cloc)
|
93
|
+
if yaml
|
94
|
+
yaml['SUM']['code']
|
95
|
+
else
|
96
|
+
0
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def hoc(path)
|
101
|
+
`cd "#{path}" && hoc`
|
102
|
+
end
|
103
|
+
|
104
|
+
def tests(path)
|
105
|
+
`cd "#{path}" && hoc`
|
106
|
+
end
|
107
|
+
|
108
|
+
def issues(commits)
|
109
|
+
dates = []
|
110
|
+
# dates = github.issues.map{ |i| i.created_at }
|
111
|
+
commits.map { |sha, date| [sha, dates.select { |d| d < date }.size] }.to_h
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/tdx/version.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
# TDX main module.
|
24
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
25
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
26
|
+
# License:: MIT
|
27
|
+
module TDX
|
28
|
+
VERSION = '0.1'.freeze
|
29
|
+
end
|
data/tdx.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
lib = File.expand_path('../lib', __FILE__)
|
24
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
25
|
+
require 'tdx/version'
|
26
|
+
|
27
|
+
Gem::Specification.new do |s|
|
28
|
+
s.specification_version = 2 if s.respond_to? :specification_version=
|
29
|
+
if s.respond_to? :required_rubygems_version=
|
30
|
+
s.required_rubygems_version = Gem::Requirement.new('>= 0')
|
31
|
+
end
|
32
|
+
s.rubygems_version = '2.2.2'
|
33
|
+
s.required_ruby_version = '>= 1.9.3'
|
34
|
+
s.name = 'tdx'
|
35
|
+
s.version = TDX::VERSION
|
36
|
+
s.license = 'MIT'
|
37
|
+
s.summary = 'Test Dynamics'
|
38
|
+
s.description = 'Analyzer of GitHub repositories'
|
39
|
+
s.authors = ['Yegor Bugayenko']
|
40
|
+
s.email = 'yegor256@gmail.com'
|
41
|
+
s.homepage = 'http://github.com/yegor256/tdx'
|
42
|
+
s.files = `git ls-files`.split($RS)
|
43
|
+
s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
44
|
+
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
45
|
+
s.rdoc_options = ['--charset=UTF-8']
|
46
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
47
|
+
s.add_runtime_dependency 'slop', '~>3.6'
|
48
|
+
s.add_development_dependency 'rake', '12.0.0'
|
49
|
+
s.add_development_dependency 'cucumber', '1.3.17'
|
50
|
+
s.add_development_dependency 'coveralls', '0.7.2'
|
51
|
+
s.add_development_dependency 'rubocop', '0.41.2'
|
52
|
+
s.add_development_dependency 'rubocop-rspec', '1.5.1'
|
53
|
+
s.add_development_dependency 'minitest', '5.10.1'
|
54
|
+
s.add_development_dependency 'nokogiri', '1.7.0.1'
|
55
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'simplecov'
|
24
|
+
require 'tdx'
|
25
|
+
require 'minitest/autorun'
|
data/test/test_tdx.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# Copyright (c) 2017 Yegor Bugayenko
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the 'Software'), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in all
|
13
|
+
# copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
# SOFTWARE.
|
22
|
+
|
23
|
+
require 'tdx'
|
24
|
+
require 'tmpdir'
|
25
|
+
require 'minitest/autorun'
|
26
|
+
require 'slop'
|
27
|
+
|
28
|
+
# TDX main module test.
|
29
|
+
# Author:: Yegor Bugayenko (yegor256@gmail.com)
|
30
|
+
# Copyright:: Copyright (c) 2017 Yegor Bugayenko
|
31
|
+
# License:: MIT
|
32
|
+
class TestPDD < Minitest::Test
|
33
|
+
def test_git_repo
|
34
|
+
skip if Gem.win_platform?
|
35
|
+
Dir.mktmpdir 'test' do |dir|
|
36
|
+
opts = opts(
|
37
|
+
[
|
38
|
+
'--repo', "file:///#{File.join(dir, 'repo')}",
|
39
|
+
'--tests', 'tests'
|
40
|
+
]
|
41
|
+
)
|
42
|
+
raise unless system("
|
43
|
+
set -e
|
44
|
+
cd '#{dir}'
|
45
|
+
git init --quiet repo
|
46
|
+
cd repo
|
47
|
+
git config user.email yegor256@gmail.com
|
48
|
+
git config user.name 'Mr. Tester'
|
49
|
+
echo 'a = 1' > 1.rb && git add 1.rb && git commit -qam '1'
|
50
|
+
echo '<?php b = 2' > 2.php && git add 2.php && git commit -qam '2'
|
51
|
+
mkdir tests
|
52
|
+
echo 'c = 3' > tests/3.py && git add tests/3.py && git commit -qam '3'
|
53
|
+
")
|
54
|
+
assert(TDX::Base.new(opts).svg.include?('<path '))
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
private
|
59
|
+
|
60
|
+
def opts(args)
|
61
|
+
Slop.parse args do
|
62
|
+
on 'p', 'path', argument: :required
|
63
|
+
on 's', 'svg', argument: :required
|
64
|
+
on 'r', 'repo', argument: :required
|
65
|
+
on 't', 'tests', argument: :required
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
metadata
ADDED
@@ -0,0 +1,188 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: tdx
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.1'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yegor Bugayenko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-03-15 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: slop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 12.0.0
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 12.0.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: cucumber
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.3.17
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.3.17
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: coveralls
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.7.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.7.2
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.41.2
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.41.2
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.5.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.5.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - '='
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 5.10.1
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - '='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 5.10.1
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: nokogiri
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - '='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.7.0.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - '='
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.7.0.1
|
125
|
+
description: Analyzer of GitHub repositories
|
126
|
+
email: yegor256@gmail.com
|
127
|
+
executables:
|
128
|
+
- tdx
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files:
|
131
|
+
- README.md
|
132
|
+
- LICENSE.txt
|
133
|
+
files:
|
134
|
+
- ".0pdd.yml"
|
135
|
+
- ".coveralls.yml"
|
136
|
+
- ".gitattributes"
|
137
|
+
- ".gitignore"
|
138
|
+
- ".pdd"
|
139
|
+
- ".rubocop.yml"
|
140
|
+
- ".rultor.yml"
|
141
|
+
- ".simplecov"
|
142
|
+
- ".travis.yml"
|
143
|
+
- Gemfile
|
144
|
+
- LICENSE.txt
|
145
|
+
- README.md
|
146
|
+
- Rakefile
|
147
|
+
- bin/tdx
|
148
|
+
- cucumber.yml
|
149
|
+
- features/cli.feature
|
150
|
+
- features/step_definitions/steps.rb
|
151
|
+
- features/support/env.rb
|
152
|
+
- lib/tdx.rb
|
153
|
+
- lib/tdx/base.rb
|
154
|
+
- lib/tdx/version.rb
|
155
|
+
- tdx.gemspec
|
156
|
+
- test/test__helper.rb
|
157
|
+
- test/test_tdx.rb
|
158
|
+
homepage: http://github.com/yegor256/tdx
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata: {}
|
162
|
+
post_install_message:
|
163
|
+
rdoc_options:
|
164
|
+
- "--charset=UTF-8"
|
165
|
+
require_paths:
|
166
|
+
- lib
|
167
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
168
|
+
requirements:
|
169
|
+
- - ">="
|
170
|
+
- !ruby/object:Gem::Version
|
171
|
+
version: 1.9.3
|
172
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '0'
|
177
|
+
requirements: []
|
178
|
+
rubyforge_project:
|
179
|
+
rubygems_version: 2.4.5.2
|
180
|
+
signing_key:
|
181
|
+
specification_version: 2
|
182
|
+
summary: Test Dynamics
|
183
|
+
test_files:
|
184
|
+
- features/cli.feature
|
185
|
+
- features/step_definitions/steps.rb
|
186
|
+
- features/support/env.rb
|
187
|
+
- test/test__helper.rb
|
188
|
+
- test/test_tdx.rb
|