doit 0.3.2 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.gitignore +1 -0
- data/.rubocop.yml +74 -0
- data/.ruby-gemset +1 -1
- data/.ruby-version +1 -1
- data/.travis.yml +8 -3
- data/.watchr +2 -1
- data/Gemfile +0 -13
- data/Gemfile.lock +8 -13
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/bin/doit +7 -5
- data/doit.gemspec +7 -7
- data/lib/doit.rb +13 -11
- data/lib/globals.rb +6 -1
- data/lib/import.rb +13 -5
- data/lib/my.rb +3 -1
- data/lib/run.rb +8 -6
- data/lib/what.rb +18 -15
- data/test/doit_test.rb +11 -11
- data/test/import_test.rb +7 -7
- data/test/my_test.rb +6 -6
- data/test/run_test.rb +3 -3
- data/test/test_helper.rb +2 -2
- data/test/what_test.rb +17 -17
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ab3e45ae5cd8368470a2f596274de76dace66dcbdf5179a36e72f0829593b7f6
|
4
|
+
data.tar.gz: 7639c595a1c200e7d6dcbae89272cbde935f1c391082a0cf2256329b724b3e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4469bb7cb6e1ed2d38830da1ea11570f90a398f04a4a9ad11d8c42a443cc9e3d2d3b9b71643a0964836a8d5def2781203255ffa36e16d0db9eef1e101144e529
|
7
|
+
data.tar.gz: 5440ec7f1a51ae549dac16cde73dc968b5488dbb0a2cc28a64969b092c86016cba03e90b9e16a1cde15dfc582a1fba3c3b5bad1009128bc1c56b563470790873
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
# inherit_from: .rubocop_todo.yml
|
4
|
+
|
5
|
+
# rubocop --auto-gen-config
|
6
|
+
# rubocop
|
7
|
+
# rubocop:disable all
|
8
|
+
|
9
|
+
#inherit_from: .rubocop_todo.yml
|
10
|
+
|
11
|
+
AllCops:
|
12
|
+
Include:
|
13
|
+
# - 'app/**/*.rb'
|
14
|
+
# - 'bin/**/*.rb'
|
15
|
+
# - 'config/**/*.rb'
|
16
|
+
# - 'db/**/*.rb'
|
17
|
+
- 'lib/**/*.rb'
|
18
|
+
# - 'test/**/*.rb'
|
19
|
+
- '**/*.gemfile'
|
20
|
+
# - '**/*.gemspec'
|
21
|
+
# - '**/*.rake'
|
22
|
+
# - '**/*.ru'
|
23
|
+
# - '**/Gemfile'
|
24
|
+
# - '**/Rakefile'
|
25
|
+
|
26
|
+
#AllCops:
|
27
|
+
# Exclude:
|
28
|
+
# - 'db/**/*'
|
29
|
+
# - 'config/**/*'
|
30
|
+
# - 'script/**/*'
|
31
|
+
# - 'bin/{rails,rake}'
|
32
|
+
# - 'spec/**/*'
|
33
|
+
# - !ruby/regexp /old_and_unused\.rb$/
|
34
|
+
|
35
|
+
Bundler/OrderedGems:
|
36
|
+
Exclude:
|
37
|
+
- 'Gemfile'
|
38
|
+
|
39
|
+
Layout/AccessModifierIndentation:
|
40
|
+
Enabled: false
|
41
|
+
Layout/AlignArray:
|
42
|
+
Enabled: false
|
43
|
+
Layout/CommentIndentation:
|
44
|
+
Enabled: false
|
45
|
+
Layout/EmptyLinesAroundAccessModifier:
|
46
|
+
Enabled: false
|
47
|
+
Layout/EmptyLinesAroundBlockBody:
|
48
|
+
Enabled: false
|
49
|
+
Layout/EmptyLinesAroundClassBody:
|
50
|
+
Enabled: false
|
51
|
+
Layout/ExtraSpacing:
|
52
|
+
Enabled: false
|
53
|
+
Layout/IndentArray:
|
54
|
+
Enabled: false
|
55
|
+
Layout/IndentationWidth:
|
56
|
+
Enabled: false
|
57
|
+
Layout/Tab:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Security/YAMLLoad:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/BlockDelimiters:
|
64
|
+
Enabled: false
|
65
|
+
Style/FrozenStringLiteralComment:
|
66
|
+
Exclude:
|
67
|
+
- 'test/**/*.rb'
|
68
|
+
Style/WhenThen:
|
69
|
+
Exclude:
|
70
|
+
- '.watchr'
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
data/.ruby-gemset
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rails-5.
|
1
|
+
rails-5.2
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.6.1
|
data/.travis.yml
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
language: ruby
|
2
2
|
sudo: false
|
3
3
|
|
4
|
+
bundler_args: --without production
|
5
|
+
script: "bundle exec rake test"
|
6
|
+
|
4
7
|
rvm:
|
5
|
-
- 2.
|
6
|
-
- 2.
|
7
|
-
- 2.
|
8
|
+
- 2.6.1
|
9
|
+
# - 2.5.1
|
10
|
+
# - 2.5.0
|
11
|
+
# - 2.4.1
|
12
|
+
# - 2.3.0 # tested; no longer in CI
|
8
13
|
# - 2.2.3 # tested; no longer in CI
|
9
14
|
# - 2.0.0 # tested; no longer in CI
|
10
15
|
|
data/.watchr
CHANGED
@@ -16,7 +16,8 @@ end
|
|
16
16
|
|
17
17
|
def run_it(type, file)
|
18
18
|
case type
|
19
|
-
when 'test'; run %Q{ruby -I"lib:test" -rubygems #{file}}
|
19
|
+
# when 'test'; run %Q{ruby -I"lib:test" -rubygems #{file}}
|
20
|
+
when 'test'; run %Q{ruby -I"lib:test" #{file}}
|
20
21
|
when 'spec'; run %Q{spring rspec -X #{file}}
|
21
22
|
else; puts "#{H} unknown type: #{type}, file: #{file}"
|
22
23
|
end
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,27 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
doit (0.3.
|
4
|
+
doit (0.3.5)
|
5
5
|
micro-optparse (~> 1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
docile (1.1
|
11
|
-
json (2.
|
10
|
+
docile (1.3.1)
|
11
|
+
json (2.2.0)
|
12
12
|
micro-optparse (1.2.1)
|
13
13
|
minitest (5.11.3)
|
14
|
-
rake (12.3.
|
15
|
-
simplecov (0.
|
16
|
-
docile (~> 1.1
|
14
|
+
rake (12.3.2)
|
15
|
+
simplecov (0.16.1)
|
16
|
+
docile (~> 1.1)
|
17
17
|
json (>= 1.8, < 3)
|
18
18
|
simplecov-html (~> 0.10.0)
|
19
19
|
simplecov-html (0.10.2)
|
20
|
-
slim (3.0.9)
|
21
|
-
temple (>= 0.7.6, < 0.9)
|
22
|
-
tilt (>= 1.3.3, < 2.1)
|
23
|
-
temple (0.8.0)
|
24
|
-
tilt (2.0.8)
|
25
20
|
|
26
21
|
PLATFORMS
|
27
22
|
ruby
|
@@ -29,10 +24,10 @@ PLATFORMS
|
|
29
24
|
DEPENDENCIES
|
30
25
|
bundler
|
31
26
|
doit!
|
27
|
+
micro-optparse (~> 1)
|
32
28
|
minitest
|
33
29
|
rake
|
34
30
|
simplecov
|
35
|
-
slim
|
36
31
|
|
37
32
|
BUNDLED WITH
|
38
|
-
1.
|
33
|
+
1.17.2
|
data/LICENSE
CHANGED
data/README.md
CHANGED
data/bin/doit
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
|
1
|
+
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
lib = File.expand_path('
|
4
|
-
$:.unshift lib unless $:.include?(lib)
|
3
|
+
lib = File.expand_path('../lib/', __dir__)
|
4
|
+
# $:.unshift lib unless $:.include?(lib)
|
5
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
5
6
|
|
6
7
|
require 'doit'
|
7
8
|
require 'micro-optparse'
|
@@ -9,11 +10,12 @@ require 'globals'
|
|
9
10
|
require 'what'
|
10
11
|
|
11
12
|
options = Parser.new do |p|
|
12
|
-
p.banner =
|
13
|
+
p.banner = 'Usage: doit script... [options] # execute locally or remotely'
|
13
14
|
p.version = "doit #{Globals::VERSION}"
|
14
15
|
p.option :list, 'Lists available scripts'
|
15
16
|
p.option :each, 'Lists each remote command (no execution)'
|
16
|
-
p.option :remote, 'Remote host or comma separated hosts',
|
17
|
+
p.option :remote, 'Remote host or comma separated hosts',
|
18
|
+
default: '...', optional: true
|
17
19
|
p.option :silent, 'Run silently; suppress output'
|
18
20
|
p.option :verbose, 'Enable verbose output'
|
19
21
|
p.option :noop, 'Suppress execution of commannds'
|
data/doit.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
2
2
|
require 'globals'
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'doit'
|
6
6
|
s.version = Globals::VERSION
|
7
|
-
s.summary =
|
8
|
-
s.description =
|
7
|
+
s.summary = 'Simple local & remote script executor'
|
8
|
+
s.description = 'Run good old shell/bash scripts locally or remotely(ssh).'
|
9
9
|
|
10
10
|
s.authors = ['Dittmar Krall']
|
11
11
|
s.email = 'dittmar.krall@matique.de'
|
@@ -16,14 +16,14 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.files = `git ls-files`.split("\n")
|
18
18
|
s.test_files = `git ls-files -- test`.split("\n")
|
19
|
-
s.executables = `git ls-files -- bin
|
20
|
-
|
19
|
+
s.executables = `git ls-files -- bin/*`
|
20
|
+
.split("\n").map { |f| File.basename(f) }
|
21
|
+
s.require_paths = ['lib']
|
21
22
|
|
22
23
|
s.add_development_dependency 'bundler'
|
23
24
|
s.add_development_dependency 'rake'
|
24
|
-
s.add_development_dependency 'slim'
|
25
25
|
|
26
|
-
|
26
|
+
s.add_development_dependency 'micro-optparse', '~> 1'
|
27
27
|
s.add_development_dependency 'minitest'
|
28
28
|
s.add_development_dependency 'simplecov'
|
29
29
|
end
|
data/lib/doit.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'my'
|
2
4
|
require 'run'
|
3
5
|
require 'import'
|
@@ -25,10 +27,12 @@ class << Doit
|
|
25
27
|
hsh.sort.each { |abb, long|
|
26
28
|
puts "#{abb}\t- #{long}"
|
27
29
|
next unless options[:verbose]
|
30
|
+
|
28
31
|
lines = `grep -i 'usage\\|summary' #{long} | grep '^#'`.split("\n")
|
29
32
|
lines.each { |line|
|
30
33
|
next unless line
|
31
34
|
next if line.empty?
|
35
|
+
|
32
36
|
puts "\t #{line}"
|
33
37
|
}
|
34
38
|
}
|
@@ -40,11 +44,9 @@ class << Doit
|
|
40
44
|
puts "doit: script '#{name}' not found"
|
41
45
|
return
|
42
46
|
end
|
43
|
-
What.init(Import.
|
47
|
+
What.init(Import.config)
|
44
48
|
|
45
|
-
What.where.each { |w|
|
46
|
-
puts "doit #{name} -r #{w}"
|
47
|
-
} if options[:each]
|
49
|
+
What.where.each { |w| puts "doit #{name} -r #{w}" } if options[:each]
|
48
50
|
|
49
51
|
where_loop unless options[:each]
|
50
52
|
end
|
@@ -56,18 +58,18 @@ class << Doit
|
|
56
58
|
}
|
57
59
|
end
|
58
60
|
|
59
|
-
def matrix_loop(
|
61
|
+
def matrix_loop(where)
|
60
62
|
What.matrix.each { |mm|
|
61
63
|
prefix = mm.empty? ? '' : "#{What.to_env(mm)}\n"
|
62
64
|
|
63
65
|
What.env.each { |en|
|
64
|
-
|
66
|
+
prefix2 = en.empty? ? '' : "#{en}\n"
|
65
67
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
68
|
+
cmds = Import.script
|
69
|
+
cmds = @argv + prefix + prefix2 + cmds
|
70
|
+
Run.init cmds, where
|
71
|
+
Run.info if options[:verbose]
|
72
|
+
Run.run
|
71
73
|
}
|
72
74
|
}
|
73
75
|
end
|
data/lib/globals.rb
CHANGED
data/lib/import.rb
CHANGED
@@ -1,11 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'pathname'
|
2
4
|
require 'erb'
|
3
5
|
|
4
6
|
Import = Object.new
|
5
7
|
class << Import
|
6
8
|
|
7
|
-
def script
|
8
|
-
|
9
|
+
def script
|
10
|
+
@script ||= nil
|
11
|
+
@script
|
12
|
+
end
|
13
|
+
|
14
|
+
def config
|
15
|
+
@config ||= nil
|
16
|
+
@config
|
17
|
+
end
|
9
18
|
|
10
19
|
def init(name)
|
11
20
|
@script = read(name)
|
@@ -21,11 +30,10 @@ class << Import
|
|
21
30
|
def info
|
22
31
|
return unless Doit.options[:verbose]
|
23
32
|
|
24
|
-
My.verbose
|
25
|
-
My.verbose
|
33
|
+
My.verbose 'SCRIPT', @script
|
34
|
+
My.verbose 'CONFIG(yml)', @config
|
26
35
|
end
|
27
36
|
|
28
|
-
|
29
37
|
private
|
30
38
|
def list2
|
31
39
|
res = {}
|
data/lib/my.rb
CHANGED
data/lib/run.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
Run = Object.new
|
2
4
|
class << Run
|
3
5
|
|
4
|
-
|
6
|
+
attr_reader :ssh
|
5
7
|
|
6
8
|
def init(cmds, where)
|
7
|
-
aster = '*'*24
|
9
|
+
aster = '*' * 24
|
8
10
|
puts "#{aster} #{where} #{aster}"
|
9
11
|
@ssh = nil
|
10
12
|
@cmds = cmds
|
@@ -18,7 +20,7 @@ class << Run
|
|
18
20
|
dir = where
|
19
21
|
end
|
20
22
|
|
21
|
-
@cmds = "cd; cd #{dir}\n" + @cmds unless dir
|
23
|
+
@cmds = "cd; cd #{dir}\n" + @cmds unless dir&.empty?
|
22
24
|
@ssh = "ssh #{host}" if host
|
23
25
|
end
|
24
26
|
|
@@ -33,10 +35,10 @@ class << Run
|
|
33
35
|
cmd = "cat <<'#{here}\' | #{@ssh} bash -i -l #{silent} 2>&1"
|
34
36
|
cmds = "#{cmd}\n#{@cmds}#{here}\n"
|
35
37
|
|
36
|
-
|
37
|
-
IO.popen(cmds) { |p| p.each { |f| puts f } }
|
38
|
-
else
|
38
|
+
if Doit.options[:noop]
|
39
39
|
My.verbose('noop', cmds)
|
40
|
+
else
|
41
|
+
IO.popen(cmds) { |p| p.each { |f| puts f } }
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
data/lib/what.rb
CHANGED
@@ -1,14 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'yaml'
|
2
4
|
require 'doit'
|
3
5
|
|
4
6
|
What = Object.new
|
5
7
|
class << What
|
6
8
|
|
7
|
-
|
8
|
-
|
9
|
-
|
9
|
+
attr_reader :matrix
|
10
|
+
attr_reader :where
|
11
|
+
attr_reader :env
|
10
12
|
|
11
|
-
def init(
|
13
|
+
def init(config)
|
12
14
|
@matrix = nil
|
13
15
|
@yml = (config && YAML.load(config)) || {}
|
14
16
|
|
@@ -37,24 +39,25 @@ class << What
|
|
37
39
|
def info
|
38
40
|
return unless Doit.options[:verbose]
|
39
41
|
|
40
|
-
My.verbose
|
41
|
-
My.verbose
|
42
|
-
My.verbose
|
42
|
+
My.verbose 'where', @where
|
43
|
+
My.verbose 'matrix', @matrix
|
44
|
+
My.verbose 'env', @env
|
43
45
|
end
|
44
46
|
|
45
|
-
|
46
47
|
private
|
47
48
|
def build_matrix
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
return if @yml.empty?
|
50
|
+
|
51
|
+
key, value = @yml.first
|
52
|
+
@yml.delete(key)
|
53
|
+
add_to_matrix(key, value)
|
54
|
+
build_matrix
|
54
55
|
end
|
55
56
|
|
56
57
|
def add_to_matrix(key, val)
|
57
|
-
arr = Array === val ?
|
58
|
+
arr = Array === val ?
|
59
|
+
val.collect { |v| [{ key => v }] } :
|
60
|
+
[{ key => val }]
|
58
61
|
@matrix = @matrix ? @matrix.product(arr) : arr
|
59
62
|
end
|
60
63
|
|
data/test/doit_test.rb
CHANGED
@@ -6,46 +6,46 @@ describe Doit do
|
|
6
6
|
Doit.start({})
|
7
7
|
end
|
8
8
|
|
9
|
-
it
|
10
|
-
out = noop {
|
9
|
+
it 'start' do
|
10
|
+
out = noop {}
|
11
11
|
assert_equal '', out
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'options' do
|
15
15
|
assert_equal({}, Doit.options)
|
16
16
|
end
|
17
17
|
|
18
|
-
it
|
18
|
+
it 'list' do
|
19
19
|
out = noop {
|
20
20
|
Doit.list
|
21
21
|
}
|
22
22
|
assert_match(/\/\.doit/, out)
|
23
23
|
end
|
24
24
|
|
25
|
-
it
|
25
|
+
it 'execute' do
|
26
26
|
out, _err = capture_io do
|
27
27
|
Doit.execute('hello')
|
28
28
|
end
|
29
29
|
assert_match(/\nHello\n/, out)
|
30
30
|
end
|
31
31
|
|
32
|
-
it
|
32
|
+
it 'execute with unknown script' do
|
33
33
|
out, _err = capture_io do
|
34
34
|
Doit.execute('______unknown______')
|
35
35
|
end
|
36
36
|
assert_match(/not found/, out)
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
out = noop(
|
39
|
+
it 'tests option --each' do
|
40
|
+
out = noop(each: true) {
|
41
41
|
Doit.execute('hello')
|
42
42
|
}
|
43
43
|
assert_match(/doit hello -r/, out)
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
47
|
-
out = noop(
|
48
|
-
Doit.start(
|
46
|
+
it 'coverage: list; option -lv' do
|
47
|
+
out = noop(verbose: true, list: true) {
|
48
|
+
Doit.start(verbose: true, list: true)
|
49
49
|
}
|
50
50
|
assert_match(/just a test\n/, out)
|
51
51
|
end
|
data/test/import_test.rb
CHANGED
@@ -5,21 +5,21 @@ require 'my'
|
|
5
5
|
|
6
6
|
describe Import do
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'init fails with empty' do
|
9
9
|
assert_raises(Errno::EISDIR) { Import.init('') }
|
10
10
|
end
|
11
11
|
|
12
|
-
it
|
12
|
+
it 'init' do
|
13
13
|
Import.init('hello')
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
16
|
+
it 'list' do
|
17
17
|
Import.init('hello')
|
18
18
|
assert_match(/\/\.doit\/hello$/, Import.list['hello'])
|
19
19
|
end
|
20
20
|
|
21
|
-
it
|
22
|
-
out = noop(
|
21
|
+
it 'info' do
|
22
|
+
out = noop(verbose: true) {
|
23
23
|
Import.init('hello')
|
24
24
|
Import.info
|
25
25
|
}
|
@@ -27,11 +27,11 @@ describe Import do
|
|
27
27
|
assert_match(/CONFIG/, out)
|
28
28
|
end
|
29
29
|
|
30
|
-
it
|
30
|
+
it 'coverage: script' do
|
31
31
|
Import.script
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
34
|
+
it 'coverage: config' do
|
35
35
|
Import.config
|
36
36
|
end
|
37
37
|
|
data/test/my_test.rb
CHANGED
@@ -3,20 +3,20 @@ require 'my'
|
|
3
3
|
|
4
4
|
describe My do
|
5
5
|
|
6
|
-
it
|
6
|
+
it 'verbose' do
|
7
7
|
h = 'hello'
|
8
|
-
|
8
|
+
out, _err = capture_io do
|
9
9
|
My.verbose('a', h)
|
10
10
|
end
|
11
|
-
assert_match(/#{h}/,
|
11
|
+
assert_match(/#{h}/, out)
|
12
12
|
end
|
13
13
|
|
14
|
-
it
|
14
|
+
it 'verbose text' do
|
15
15
|
h = 'hello'
|
16
|
-
|
16
|
+
out, _err = capture_io do
|
17
17
|
My.verbose('a', "#{h}\nx\n")
|
18
18
|
end
|
19
|
-
assert_match(/#{h}/,
|
19
|
+
assert_match(/#{h}/, out)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/test/run_test.rb
CHANGED
@@ -5,7 +5,7 @@ require 'doit'
|
|
5
5
|
|
6
6
|
describe Run do
|
7
7
|
|
8
|
-
it
|
8
|
+
it 'coverage #info' do
|
9
9
|
_out, _err = capture_io do
|
10
10
|
Run.init('', '')
|
11
11
|
Run.info
|
@@ -40,14 +40,14 @@ describe Run do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
it
|
43
|
+
it 'coverage #run' do
|
44
44
|
_out, _err = capture_io do
|
45
45
|
Run.init('', '')
|
46
46
|
Run.run
|
47
47
|
end
|
48
48
|
end
|
49
49
|
|
50
|
-
it
|
50
|
+
it 'coverage #run noop' do
|
51
51
|
out = noop {
|
52
52
|
Run.init('', '')
|
53
53
|
Run.run
|
data/test/test_helper.rb
CHANGED
@@ -8,13 +8,13 @@ require 'what'
|
|
8
8
|
|
9
9
|
require 'minitest/autorun'
|
10
10
|
|
11
|
-
def noop(options = {noop: true}, &block)
|
11
|
+
def noop(options = { noop: true }, &block)
|
12
12
|
return 'noop: missing block' unless block
|
13
13
|
|
14
14
|
out = '---'
|
15
15
|
Doit.stub :options, options do
|
16
16
|
out, _err = capture_io do
|
17
|
-
|
17
|
+
yield
|
18
18
|
end
|
19
19
|
end
|
20
20
|
out
|
data/test/what_test.rb
CHANGED
@@ -3,8 +3,8 @@ require 'my'
|
|
3
3
|
|
4
4
|
describe What do
|
5
5
|
|
6
|
-
it
|
7
|
-
What.init(''
|
6
|
+
it 'is robust against empty params' do
|
7
|
+
What.init('')
|
8
8
|
assert_equal [Dir.pwd], What.where
|
9
9
|
assert_equal [{}], What.matrix
|
10
10
|
end
|
@@ -13,32 +13,32 @@ describe What do
|
|
13
13
|
assert_equal '', What.to_env({})
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
assert_equal 'A=1', What.to_env(
|
16
|
+
it 'to_env converts variable to uppercase' do
|
17
|
+
assert_equal 'A=1', What.to_env(a: 1)
|
18
18
|
end
|
19
19
|
|
20
|
-
it
|
21
|
-
Doit.stub :options,
|
20
|
+
it 'coverage: #info' do
|
21
|
+
Doit.stub :options, verbose: true do
|
22
22
|
_out, _err = capture_io do
|
23
|
-
|
24
|
-
|
23
|
+
What.init('')
|
24
|
+
What.info
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
-
it
|
30
|
-
What.init(
|
31
|
-
assert_equal [{
|
29
|
+
it 'builds simple matrix' do
|
30
|
+
What.init("a: 1\n")
|
31
|
+
assert_equal [{ 'a' => 1 }], What.matrix
|
32
32
|
end
|
33
33
|
|
34
|
-
it
|
35
|
-
What.init(
|
36
|
-
assert_equal [{
|
34
|
+
it 'builds matrix' do
|
35
|
+
What.init("a:\n - 1\n - 2\n")
|
36
|
+
assert_equal [{ 'a' => 1 }, { 'a' => 2 }], What.matrix
|
37
37
|
end
|
38
38
|
|
39
|
-
it
|
40
|
-
What.init(
|
41
|
-
assert_equal [{
|
39
|
+
it 'builds product matrix' do
|
40
|
+
What.init("a:\n - 1\nb:\n - 3\n - 4\n")
|
41
|
+
assert_equal [{ 'a' => 1, 'b' => 3 }, { 'a' => 1, 'b' => 4 }], What.matrix
|
42
42
|
end
|
43
43
|
|
44
44
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dittmar Krall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: micro-optparse
|
@@ -53,19 +53,19 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: micro-optparse
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: minitest
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- ".doit/hello"
|
105
105
|
- ".doit/hello.yml"
|
106
106
|
- ".gitignore"
|
107
|
+
- ".rubocop.yml"
|
107
108
|
- ".ruby-gemset"
|
108
109
|
- ".ruby-version"
|
109
110
|
- ".travis.yml"
|
@@ -146,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
147
|
- !ruby/object:Gem::Version
|
147
148
|
version: '0'
|
148
149
|
requirements: []
|
149
|
-
|
150
|
-
rubygems_version: 2.6.14
|
150
|
+
rubygems_version: 3.0.1
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Simple local & remote script executor
|