doit 0.3.0 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -1
- data/.travis.yml +6 -2
- data/Gemfile +12 -11
- data/Gemfile.lock +18 -11
- data/LICENSE +1 -1
- data/README.md +3 -1
- data/bin/doit +1 -0
- data/doit.gemspec +21 -14
- data/lib/doit.rb +2 -2
- data/lib/globals.rb +1 -1
- data/lib/import.rb +3 -3
- data/test/doit_test.rb +7 -8
- data/test/import_test.rb +3 -3
- data/test/my_test.rb +4 -4
- data/test/run_test.rb +7 -7
- data/test/test_helper.rb +3 -1
- data/test/what_test.rb +1 -2
- metadata +75 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bc140e881b43c004f6a23f5b200d098dc7e4359
|
4
|
+
data.tar.gz: 9475f4ed399cd3ebf2dfd227b436da2a434ae7a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13bfdfd39a32bf91c75c033bd472634a4df85b469429b20e21294cce80b1021ebec9837fe48bd4679a0c5174409b7accdd74cec8d781598a5a8dd42c5bc0db70
|
7
|
+
data.tar.gz: ca8a31bc0293c45becb74cbd990aac41c5c67d910042f99bc18ec090dcd2096a6a4a2b5bf29b2713649f39d85066edd9c2e074e48505e847237867c1fe6fb0e1
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rails-5.1
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby-2.
|
1
|
+
ruby-2.5.0
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
group :test do
|
6
|
-
gem 'simplecov', require: false
|
7
|
-
end
|
3
|
+
gemspec
|
8
4
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
gem '
|
13
|
-
end
|
5
|
+
#gem 'micro-optparse'
|
6
|
+
#
|
7
|
+
#group :test do
|
8
|
+
# gem 'simplecov', require: false
|
9
|
+
#end
|
10
|
+
#
|
11
|
+
#group :test, :development do
|
12
|
+
# gem 'rake'
|
13
|
+
# gem 'observr'
|
14
|
+
# gem 'minitest'
|
15
|
+
#end
|
14
16
|
|
15
|
-
gemspec
|
data/Gemfile.lock
CHANGED
@@ -1,31 +1,38 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
doit (0.3.
|
4
|
+
doit (0.3.2)
|
5
5
|
micro-optparse (~> 1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
docile (1.1.5)
|
11
|
-
json (1.
|
12
|
-
micro-optparse (1.2.
|
13
|
-
minitest (5.
|
14
|
-
|
15
|
-
|
16
|
-
simplecov (0.11.1)
|
11
|
+
json (2.1.0)
|
12
|
+
micro-optparse (1.2.1)
|
13
|
+
minitest (5.11.3)
|
14
|
+
rake (12.3.0)
|
15
|
+
simplecov (0.15.1)
|
17
16
|
docile (~> 1.1.0)
|
18
|
-
json (
|
17
|
+
json (>= 1.8, < 3)
|
19
18
|
simplecov-html (~> 0.10.0)
|
20
|
-
simplecov-html (0.10.
|
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)
|
21
25
|
|
22
26
|
PLATFORMS
|
23
27
|
ruby
|
24
28
|
|
25
29
|
DEPENDENCIES
|
30
|
+
bundler
|
26
31
|
doit!
|
27
|
-
micro-optparse
|
28
32
|
minitest
|
29
|
-
observr
|
30
33
|
rake
|
31
34
|
simplecov
|
35
|
+
slim
|
36
|
+
|
37
|
+
BUNDLED WITH
|
38
|
+
1.16.1
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -23,12 +23,14 @@ Options
|
|
23
23
|
-------
|
24
24
|
-l, --[no-]list Lists available scripts
|
25
25
|
-r, --remote ["host"] remote host or comma separated hosts
|
26
|
+
-e, --[no-]each Lists each remote command (no execution)
|
26
27
|
-s, --[no-]silent run silently; suppress output
|
27
28
|
-v, --[no-]verbose Enable verbose output
|
28
29
|
-n, --[no-]noop Suppress execution of commannds
|
29
30
|
-h, --help Show this message
|
30
31
|
-V, --version Print version
|
31
32
|
|
33
|
+
|
32
34
|
File Structure
|
33
35
|
--------------
|
34
36
|
~/.doit/deploy # chmod +x .doit/deploy
|
@@ -73,4 +75,4 @@ $PROJ/.doit/push
|
|
73
75
|
- bob@sample.com
|
74
76
|
- alice@customer.com
|
75
77
|
|
76
|
-
Copyright (c) 2014-
|
78
|
+
Copyright (c) 2014-2017 [Dittmar Krall], released under the MIT license
|
data/bin/doit
CHANGED
data/doit.gemspec
CHANGED
@@ -1,22 +1,29 @@
|
|
1
1
|
$:.push File.expand_path("../lib", __FILE__)
|
2
2
|
require 'globals'
|
3
3
|
|
4
|
-
Gem::Specification.new do |
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'doit'
|
6
|
+
s.version = Globals::VERSION
|
7
|
+
s.summary = "Simple local & remote script executor"
|
8
|
+
s.description = "Run good old shell/bash scripts locally or remotely(ssh)."
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
s.authors = ['Dittmar Krall']
|
11
|
+
s.email = 'dittmar.krall@matique.de'
|
12
|
+
s.homepage = 'http://www.matique.de'
|
13
|
+
s.license = 'MIT'
|
14
14
|
|
15
|
-
|
15
|
+
s.add_dependency 'micro-optparse', '~> 1'
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- test`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
21
|
|
22
|
+
s.add_development_dependency 'bundler'
|
23
|
+
s.add_development_dependency 'rake'
|
24
|
+
s.add_development_dependency 'slim'
|
25
|
+
|
26
|
+
# s.add_development_dependency 'micro-optparse', '~> 1'
|
27
|
+
s.add_development_dependency 'minitest'
|
28
|
+
s.add_development_dependency 'simplecov'
|
22
29
|
end
|
data/lib/doit.rb
CHANGED
data/lib/globals.rb
CHANGED
data/lib/import.rb
CHANGED
@@ -4,8 +4,8 @@ require 'erb'
|
|
4
4
|
Import = Object.new
|
5
5
|
class << Import
|
6
6
|
|
7
|
-
def script; @script; end
|
8
|
-
def config; @config; end
|
7
|
+
def script; @script ||= nil; @script; end
|
8
|
+
def config; @config ||= nil; @config; end
|
9
9
|
|
10
10
|
def init(name)
|
11
11
|
@script = read(name)
|
@@ -54,7 +54,7 @@ class << Import
|
|
54
54
|
def try_ascend(filename)
|
55
55
|
Pathname.pwd.ascend { |dir|
|
56
56
|
str = dir + filename
|
57
|
-
return File.read(str) if File.
|
57
|
+
return File.read(str) if File.exist?(str)
|
58
58
|
}
|
59
59
|
nil
|
60
60
|
end
|
data/test/doit_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'doit'
|
3
2
|
|
4
3
|
describe Doit do
|
5
4
|
|
@@ -20,35 +19,35 @@ describe Doit do
|
|
20
19
|
out = noop {
|
21
20
|
Doit.list
|
22
21
|
}
|
23
|
-
assert_match
|
22
|
+
assert_match(/\/\.doit/, out)
|
24
23
|
end
|
25
24
|
|
26
25
|
it "execute" do
|
27
|
-
out,
|
26
|
+
out, _err = capture_io do
|
28
27
|
Doit.execute('hello')
|
29
28
|
end
|
30
|
-
assert_match
|
29
|
+
assert_match(/\nHello\n/, out)
|
31
30
|
end
|
32
31
|
|
33
32
|
it "execute with unknown script" do
|
34
|
-
out,
|
33
|
+
out, _err = capture_io do
|
35
34
|
Doit.execute('______unknown______')
|
36
35
|
end
|
37
|
-
assert_match
|
36
|
+
assert_match(/not found/, out)
|
38
37
|
end
|
39
38
|
|
40
39
|
it "tests option --each" do
|
41
40
|
out = noop({each: true}) {
|
42
41
|
Doit.execute('hello')
|
43
42
|
}
|
44
|
-
assert_match
|
43
|
+
assert_match(/doit hello -r/, out)
|
45
44
|
end
|
46
45
|
|
47
46
|
it "coverage: list; option -lv" do
|
48
47
|
out = noop({verbose: true, list: true}) {
|
49
48
|
Doit.start({verbose: true, list: true})
|
50
49
|
}
|
51
|
-
assert_match
|
50
|
+
assert_match(/just a test\n/, out)
|
52
51
|
end
|
53
52
|
|
54
53
|
end
|
data/test/import_test.rb
CHANGED
@@ -15,7 +15,7 @@ describe Import do
|
|
15
15
|
|
16
16
|
it "list" do
|
17
17
|
Import.init('hello')
|
18
|
-
assert_match
|
18
|
+
assert_match(/\/\.doit\/hello$/, Import.list['hello'])
|
19
19
|
end
|
20
20
|
|
21
21
|
it "info" do
|
@@ -23,8 +23,8 @@ describe Import do
|
|
23
23
|
Import.init('hello')
|
24
24
|
Import.info
|
25
25
|
}
|
26
|
-
assert_match
|
27
|
-
assert_match
|
26
|
+
assert_match(/SCRIPT/, out)
|
27
|
+
assert_match(/CONFIG/, out)
|
28
28
|
end
|
29
29
|
|
30
30
|
it "coverage: script" do
|
data/test/my_test.rb
CHANGED
@@ -5,18 +5,18 @@ describe My do
|
|
5
5
|
|
6
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
|
11
|
+
assert_match(/#{h}/, _out)
|
12
12
|
end
|
13
13
|
|
14
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
|
19
|
+
assert_match(/#{h}/, _out)
|
20
20
|
end
|
21
21
|
|
22
22
|
end
|
data/test/run_test.rb
CHANGED
@@ -6,42 +6,42 @@ require 'doit'
|
|
6
6
|
describe Run do
|
7
7
|
|
8
8
|
it "coverage #info" do
|
9
|
-
|
9
|
+
_out, _err = capture_io do
|
10
10
|
Run.init('', '')
|
11
11
|
Run.info
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
it "where '' returns nil" do
|
16
|
-
|
16
|
+
_out, _err = capture_io do
|
17
17
|
Run.init('', '')
|
18
18
|
assert_equal nil, Run.ssh
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
22
|
it "where 'a' returns nil" do
|
23
|
-
|
23
|
+
_out, _err = capture_io do
|
24
24
|
Run.init('', 'a')
|
25
25
|
assert_equal nil, Run.ssh
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
29
|
it "where 'a@b' returns 'ssh a@b'" do
|
30
|
-
|
30
|
+
_out, _err = capture_io do
|
31
31
|
Run.init('', 'a@b')
|
32
32
|
assert_equal 'ssh a@b', Run.ssh
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
36
|
it "where 'a@b:c' returns 'ssh a@b'" do
|
37
|
-
|
37
|
+
_out, _err = capture_io do
|
38
38
|
Run.init('', 'a@b:c')
|
39
39
|
assert_equal 'ssh a@b', Run.ssh
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
it "coverage #run" do
|
44
|
-
|
44
|
+
_out, _err = capture_io do
|
45
45
|
Run.init('', '')
|
46
46
|
Run.run
|
47
47
|
end
|
@@ -52,7 +52,7 @@ describe Run do
|
|
52
52
|
Run.init('', '')
|
53
53
|
Run.run
|
54
54
|
}
|
55
|
-
assert_match
|
55
|
+
assert_match(/EOS/, out)
|
56
56
|
end
|
57
57
|
|
58
58
|
end
|
data/test/test_helper.rb
CHANGED
@@ -4,6 +4,8 @@ SimpleCov.start do
|
|
4
4
|
command_name 'Minitest'
|
5
5
|
end
|
6
6
|
|
7
|
+
require 'what'
|
8
|
+
|
7
9
|
require 'minitest/autorun'
|
8
10
|
|
9
11
|
def noop(options = {noop: true}, &block)
|
@@ -11,7 +13,7 @@ def noop(options = {noop: true}, &block)
|
|
11
13
|
|
12
14
|
out = '---'
|
13
15
|
Doit.stub :options, options do
|
14
|
-
out,
|
16
|
+
out, _err = capture_io do
|
15
17
|
block.call
|
16
18
|
end
|
17
19
|
end
|
data/test/what_test.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'test_helper'
|
2
|
-
require 'what'
|
3
2
|
require 'my'
|
4
3
|
|
5
4
|
describe What do
|
@@ -20,7 +19,7 @@ describe What do
|
|
20
19
|
|
21
20
|
it "coverage: #info" do
|
22
21
|
Doit.stub :options, {verbose: true} do
|
23
|
-
|
22
|
+
_out, _err = capture_io do
|
24
23
|
What.init('', '')
|
25
24
|
What.info
|
26
25
|
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.2
|
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: 2018-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: micro-optparse
|
@@ -24,6 +24,76 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: slim
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
27
97
|
description: Run good old shell/bash scripts locally or remotely(ssh).
|
28
98
|
email: dittmar.krall@matique.de
|
29
99
|
executables:
|
@@ -33,6 +103,8 @@ extra_rdoc_files: []
|
|
33
103
|
files:
|
34
104
|
- ".doit/hello"
|
35
105
|
- ".doit/hello.yml"
|
106
|
+
- ".gitignore"
|
107
|
+
- ".ruby-gemset"
|
36
108
|
- ".ruby-version"
|
37
109
|
- ".travis.yml"
|
38
110
|
- ".watchr"
|
@@ -75,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
147
|
version: '0'
|
76
148
|
requirements: []
|
77
149
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.6.14
|
79
151
|
signing_key:
|
80
152
|
specification_version: 4
|
81
153
|
summary: Simple local & remote script executor
|