tomo 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/tomo/cli.rb +1 -1
- data/lib/tomo/cli/rules/argument.rb +2 -2
- data/lib/tomo/cli/rules/switch.rb +1 -1
- data/lib/tomo/cli/rules/value_switch.rb +1 -1
- data/lib/tomo/configuration.rb +1 -1
- data/lib/tomo/configuration/dsl/error_formatter.rb +1 -1
- data/lib/tomo/paths.rb +1 -1
- data/lib/tomo/plugin/core/helpers.rb +1 -1
- data/lib/tomo/runtime/explanation.rb +1 -1
- data/lib/tomo/ssh/connection.rb +2 -2
- data/lib/tomo/testing/cli_extensions.rb +1 -1
- data/lib/tomo/version.rb +1 -1
- metadata +2 -3
- data/lib/tomo/configuration/plugin_resolver.rb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f92e6f11a186cd036164b26a2fad74f9afe3d9eec791c46c75c6aaf3040eabe7
|
4
|
+
data.tar.gz: 528ad7dcf0c63df6b887d29bd396475c02df4aef06fb2bae74ea1830a6818127
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f751e1f2bf4684b886016d67e22fd909219e4e1787585614daa1b323562940c0042d56fa16ea99c602e70cbede58d3828dcfd51e0618e790175fd500567e4a6
|
7
|
+
data.tar.gz: 4e6b438a4b13ccc464591b2d43e980f2f0dd5b221e48106c335aa27c17729ba02f36553ac72f1170e0dcc22ad6aea5663faeb82dae70ce437a7f09af08cb4630
|
data/lib/tomo/cli.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
class Tomo::CLI::Rules
|
2
2
|
class Argument
|
3
|
-
def initialize(label, multiple: false, required: false
|
3
|
+
def initialize(label, values_proc:, multiple: false, required: false)
|
4
4
|
@label = label
|
5
5
|
@multiple = multiple
|
6
6
|
@required = required
|
@@ -15,7 +15,7 @@ class Tomo::CLI::Rules
|
|
15
15
|
state.parsed_arg(arg)
|
16
16
|
end
|
17
17
|
|
18
|
-
def candidates(literal: false
|
18
|
+
def candidates(state:, literal: false)
|
19
19
|
values(state).reject { |val| literal && val.start_with?("-") }
|
20
20
|
end
|
21
21
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Tomo::CLI::Rules
|
2
2
|
class Switch
|
3
|
-
def initialize(key, *switches, required: false,
|
3
|
+
def initialize(key, *switches, callback_proc:, required: false, &convert_proc)
|
4
4
|
@key = key
|
5
5
|
@switches = switches
|
6
6
|
@callback_proc = callback_proc
|
data/lib/tomo/configuration.rb
CHANGED
@@ -90,7 +90,7 @@ module Tomo
|
|
90
90
|
plugins_registry = PluginsRegistry.new
|
91
91
|
|
92
92
|
(["core"] + plugins.uniq).each do |plug|
|
93
|
-
if
|
93
|
+
if plug.start_with?(".", "/")
|
94
94
|
plug = File.expand_path(plug, File.dirname(path)) unless path.nil?
|
95
95
|
plugins_registry.load_plugin_from_path(plug)
|
96
96
|
else
|
data/lib/tomo/paths.rb
CHANGED
@@ -12,7 +12,7 @@ module Tomo::Plugin::Core
|
|
12
12
|
result.success?
|
13
13
|
end
|
14
14
|
|
15
|
-
def write(text: nil, template: nil,
|
15
|
+
def write(to:, text: nil, template: nil, append: false, **run_opts)
|
16
16
|
assert_text_or_template_required!(text, template)
|
17
17
|
text = merge_template(template) unless template.nil?
|
18
18
|
message = "Writing #{text.bytesize} bytes to #{to}"
|
@@ -7,7 +7,7 @@ module Tomo
|
|
7
7
|
@concurrency = concurrency
|
8
8
|
end
|
9
9
|
|
10
|
-
def to_s # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity
|
10
|
+
def to_s # rubocop:disable Metrics/MethodLength, Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
|
11
11
|
desc = []
|
12
12
|
threads = [applicable_hosts.length, concurrency].min
|
13
13
|
desc << "CONCURRENTLY (#{threads} THREADS):" if threads > 1
|
data/lib/tomo/ssh/connection.rb
CHANGED
@@ -26,7 +26,7 @@ module Tomo
|
|
26
26
|
end
|
27
27
|
|
28
28
|
def ssh_subprocess(script, verbose: false)
|
29
|
-
ssh_args = build_args(script, verbose)
|
29
|
+
ssh_args = build_args(script, verbose: verbose)
|
30
30
|
handle_data = ->(data) { logger.script_output(script, data) }
|
31
31
|
|
32
32
|
logger.script_start(script)
|
@@ -50,7 +50,7 @@ module Tomo
|
|
50
50
|
Tomo.logger
|
51
51
|
end
|
52
52
|
|
53
|
-
def build_args(script, verbose
|
53
|
+
def build_args(script, verbose: false)
|
54
54
|
options.build_args(host, script, control_path, verbose)
|
55
55
|
end
|
56
56
|
|
data/lib/tomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Tomo is a feature-rich deployment tool that contains everything you need
|
14
14
|
to deploy a basic Rails app out of the box. It has an opinionated, production-tested
|
@@ -65,7 +65,6 @@ files:
|
|
65
65
|
- lib/tomo/configuration/environment.rb
|
66
66
|
- lib/tomo/configuration/glob.rb
|
67
67
|
- lib/tomo/configuration/plugin_file_not_found_error.rb
|
68
|
-
- lib/tomo/configuration/plugin_resolver.rb
|
69
68
|
- lib/tomo/configuration/plugins_registry.rb
|
70
69
|
- lib/tomo/configuration/plugins_registry/file_resolver.rb
|
71
70
|
- lib/tomo/configuration/plugins_registry/gem_resolver.rb
|
@@ -1,63 +0,0 @@
|
|
1
|
-
module Tomo
|
2
|
-
class Configuration
|
3
|
-
class PluginResolver
|
4
|
-
PLUGIN_PREFIX = "tomo/plugin".freeze
|
5
|
-
private_constant :PLUGIN_PREFIX
|
6
|
-
|
7
|
-
def self.resolve(name)
|
8
|
-
new(name).plugin_module
|
9
|
-
end
|
10
|
-
|
11
|
-
def initialize(name)
|
12
|
-
@name = name
|
13
|
-
end
|
14
|
-
|
15
|
-
def plugin_module
|
16
|
-
plugin_path = [PLUGIN_PREFIX, name.tr("-", "/")].join("/")
|
17
|
-
require plugin_path
|
18
|
-
|
19
|
-
plugin = constantize(plugin_path)
|
20
|
-
assert_compatible_api(plugin)
|
21
|
-
|
22
|
-
plugin
|
23
|
-
rescue LoadError => e
|
24
|
-
raise unless e.message.match?(/\s#{Regexp.quote(plugin_path)}$/)
|
25
|
-
|
26
|
-
raise_unknown_plugin_error(e)
|
27
|
-
end
|
28
|
-
|
29
|
-
private
|
30
|
-
|
31
|
-
attr_reader :name
|
32
|
-
|
33
|
-
def assert_compatible_api(plugin)
|
34
|
-
return if plugin.is_a?(::Tomo::PluginDSL)
|
35
|
-
|
36
|
-
raise "#{plugin} does not extend Tomo::PluginDSL"
|
37
|
-
end
|
38
|
-
|
39
|
-
def constantize(path)
|
40
|
-
parts = path.split("/")
|
41
|
-
parts.reduce(Object) do |parent, part|
|
42
|
-
child = part.gsub(/^[a-z]|_[a-z]/) { |str| str[-1].upcase }
|
43
|
-
parent.const_get(child, false)
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def raise_unknown_plugin_error(error)
|
48
|
-
UnknownPluginError.raise_with(
|
49
|
-
error.message,
|
50
|
-
name: name,
|
51
|
-
gem_name: "#{PLUGIN_PREFIX}/#{name}".tr("/", "-"),
|
52
|
-
known_plugins: scan_for_plugins
|
53
|
-
)
|
54
|
-
end
|
55
|
-
|
56
|
-
def scan_for_plugins
|
57
|
-
Gem.find_latest_files("#{PLUGIN_PREFIX}/*.rb").map do |file|
|
58
|
-
file[%r{#{PLUGIN_PREFIX}/(.+).rb$}, 1].tr("/", "-")
|
59
|
-
end.uniq.sort
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|