tomo 1.18.3 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/exe/tomo +1 -0
- data/lib/tomo/cli/command.rb +4 -2
- data/lib/tomo/cli/common_options.rb +2 -0
- data/lib/tomo/cli/completions.rb +3 -1
- data/lib/tomo/cli/deploy_options.rb +2 -0
- data/lib/tomo/cli/error.rb +2 -0
- data/lib/tomo/cli/interrupted_error.rb +2 -0
- data/lib/tomo/cli/options.rb +2 -0
- data/lib/tomo/cli/parser.rb +3 -1
- data/lib/tomo/cli/project_options.rb +2 -0
- data/lib/tomo/cli/rules/argument.rb +2 -0
- data/lib/tomo/cli/rules/switch.rb +2 -0
- data/lib/tomo/cli/rules/value_switch.rb +3 -1
- data/lib/tomo/cli/rules.rb +8 -6
- data/lib/tomo/cli/rules_evaluator.rb +6 -4
- data/lib/tomo/cli/state.rb +2 -0
- data/lib/tomo/cli/usage.rb +2 -0
- data/lib/tomo/cli.rb +2 -0
- data/lib/tomo/colors.rb +2 -0
- data/lib/tomo/commands/completion_script.rb +2 -0
- data/lib/tomo/commands/default.rb +2 -0
- data/lib/tomo/commands/deploy.rb +2 -0
- data/lib/tomo/commands/help.rb +2 -0
- data/lib/tomo/commands/init.rb +2 -0
- data/lib/tomo/commands/run.rb +2 -0
- data/lib/tomo/commands/setup.rb +2 -0
- data/lib/tomo/commands/tasks.rb +2 -0
- data/lib/tomo/commands/version.rb +2 -0
- data/lib/tomo/commands.rb +2 -0
- data/lib/tomo/configuration/dsl/batch_block.rb +3 -1
- data/lib/tomo/configuration/dsl/config_file.rb +8 -6
- data/lib/tomo/configuration/dsl/environment_block.rb +2 -0
- data/lib/tomo/configuration/dsl/error_formatter.rb +3 -1
- data/lib/tomo/configuration/dsl/hosts_and_settings.rb +6 -4
- data/lib/tomo/configuration/dsl/tasks_block.rb +5 -3
- data/lib/tomo/configuration/dsl.rb +2 -0
- data/lib/tomo/configuration/environment.rb +2 -0
- data/lib/tomo/configuration/glob.rb +2 -0
- data/lib/tomo/configuration/plugin_file_not_found_error.rb +2 -0
- data/lib/tomo/configuration/plugins_registry/file_resolver.rb +3 -1
- data/lib/tomo/configuration/plugins_registry/gem_resolver.rb +4 -2
- data/lib/tomo/configuration/plugins_registry.rb +2 -0
- data/lib/tomo/configuration/project_not_found_error.rb +2 -0
- data/lib/tomo/configuration/role_based_task_filter.rb +2 -0
- data/lib/tomo/configuration/unknown_environment_error.rb +4 -2
- data/lib/tomo/configuration/unknown_plugin_error.rb +4 -2
- data/lib/tomo/configuration/unspecified_environment_error.rb +2 -0
- data/lib/tomo/configuration.rb +7 -5
- data/lib/tomo/console/key_reader.rb +4 -2
- data/lib/tomo/console/menu.rb +6 -4
- data/lib/tomo/console/non_interactive_error.rb +4 -2
- data/lib/tomo/console.rb +3 -1
- data/lib/tomo/error/suggestions.rb +3 -1
- data/lib/tomo/error.rb +2 -0
- data/lib/tomo/host.rb +4 -2
- data/lib/tomo/logger/tagged_io.rb +2 -0
- data/lib/tomo/logger.rb +2 -0
- data/lib/tomo/path.rb +2 -0
- data/lib/tomo/paths.rb +2 -0
- data/lib/tomo/plugin/bundler/helpers.rb +2 -0
- data/lib/tomo/plugin/bundler/tasks.rb +2 -0
- data/lib/tomo/plugin/bundler.rb +2 -0
- data/lib/tomo/plugin/core/helpers.rb +2 -0
- data/lib/tomo/plugin/core/tasks.rb +2 -0
- data/lib/tomo/plugin/core.rb +2 -0
- data/lib/tomo/plugin/env/tasks.rb +17 -6
- data/lib/tomo/plugin/env.rb +2 -0
- data/lib/tomo/plugin/git/helpers.rb +2 -0
- data/lib/tomo/plugin/git/tasks.rb +2 -0
- data/lib/tomo/plugin/git.rb +2 -0
- data/lib/tomo/plugin/nodenv/tasks.rb +2 -0
- data/lib/tomo/plugin/nodenv.rb +2 -0
- data/lib/tomo/plugin/puma/tasks.rb +2 -0
- data/lib/tomo/plugin/puma.rb +2 -0
- data/lib/tomo/plugin/rails/helpers.rb +2 -0
- data/lib/tomo/plugin/rails/tasks.rb +2 -0
- data/lib/tomo/plugin/rails.rb +2 -0
- data/lib/tomo/plugin/rbenv/tasks.rb +3 -1
- data/lib/tomo/plugin/rbenv.rb +2 -0
- data/lib/tomo/plugin/testing.rb +2 -0
- data/lib/tomo/plugin.rb +2 -0
- data/lib/tomo/plugin_dsl.rb +2 -0
- data/lib/tomo/remote.rb +5 -3
- data/lib/tomo/result.rb +3 -1
- data/lib/tomo/runtime/concurrent_ruby_load_error.rb +2 -0
- data/lib/tomo/runtime/concurrent_ruby_thread_pool.rb +2 -0
- data/lib/tomo/runtime/context.rb +2 -0
- data/lib/tomo/runtime/current.rb +2 -0
- data/lib/tomo/runtime/execution_plan.rb +4 -2
- data/lib/tomo/runtime/explanation.rb +3 -1
- data/lib/tomo/runtime/host_execution_step.rb +3 -1
- data/lib/tomo/runtime/inline_thread_pool.rb +2 -0
- data/lib/tomo/runtime/no_tasks_error.rb +2 -0
- data/lib/tomo/runtime/privileged_task.rb +2 -0
- data/lib/tomo/runtime/settings_interpolation.rb +3 -1
- data/lib/tomo/runtime/settings_required_error.rb +3 -1
- data/lib/tomo/runtime/task_aborted_error.rb +2 -0
- data/lib/tomo/runtime/task_runner.rb +5 -3
- data/lib/tomo/runtime/template_not_found_error.rb +2 -0
- data/lib/tomo/runtime/unknown_task_error.rb +3 -1
- data/lib/tomo/runtime.rb +8 -6
- data/lib/tomo/script.rb +2 -0
- data/lib/tomo/shell_builder.rb +2 -0
- data/lib/tomo/ssh/child_process.rb +4 -2
- data/lib/tomo/ssh/connection.rb +4 -2
- data/lib/tomo/ssh/connection_error.rb +2 -0
- data/lib/tomo/ssh/connection_validator.rb +8 -6
- data/lib/tomo/ssh/error.rb +2 -0
- data/lib/tomo/ssh/executable_error.rb +2 -0
- data/lib/tomo/ssh/options.rb +4 -2
- data/lib/tomo/ssh/permission_error.rb +2 -0
- data/lib/tomo/ssh/script_error.rb +2 -0
- data/lib/tomo/ssh/unknown_error.rb +2 -0
- data/lib/tomo/ssh/unsupported_version_error.rb +2 -0
- data/lib/tomo/ssh.rb +2 -0
- data/lib/tomo/task_api.rb +3 -1
- data/lib/tomo/task_library.rb +2 -0
- data/lib/tomo/templates/config.rb.erb +1 -4
- data/lib/tomo/testing/Dockerfile +1 -1
- data/lib/tomo/testing/cli_extensions.rb +2 -0
- data/lib/tomo/testing/cli_tester.rb +4 -2
- data/lib/tomo/testing/connection.rb +2 -0
- data/lib/tomo/testing/docker_image.rb +4 -2
- data/lib/tomo/testing/host_extensions.rb +3 -1
- data/lib/tomo/testing/local.rb +14 -12
- data/lib/tomo/testing/log_capturing.rb +2 -0
- data/lib/tomo/testing/mock_plugin_tester.rb +2 -0
- data/lib/tomo/testing/mocked_exec_error.rb +2 -0
- data/lib/tomo/testing/mocked_exit_error.rb +2 -0
- data/lib/tomo/testing/remote_extensions.rb +2 -0
- data/lib/tomo/testing/ssh_extensions.rb +2 -0
- data/lib/tomo/testing/systemctl.rb +1 -0
- data/lib/tomo/testing/ubuntu_setup.sh +3 -1
- data/lib/tomo/testing.rb +2 -0
- data/lib/tomo/version.rb +3 -1
- data/lib/tomo.rb +3 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 818e5cca74aa96ed436ea031e78780f927b07fdbdfd9cf43a52b35ddca393a48
|
4
|
+
data.tar.gz: cfacd1ee7b6d7bd0748c55493f7b3e0e2d1aedb022ff095b406bfaec85129254
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad640825bf0973ef78e3a29d79290487f1a7fa73550fc40e26bb464df1438bb66d8659035588f3219a9661ad7be5aafbd43e28e0cf62e95a8977fafa68a210fc
|
7
|
+
data.tar.gz: d329fb4f7bfa764532f453f9cadd92ae83060503de15ba97a235eeec0ce47faa1e520b6113622bebc63a00b93822ea0de662a247117554fba0d478e11baf8ba9
|
data/exe/tomo
CHANGED
data/lib/tomo/cli/command.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class CLI
|
3
5
|
class Command
|
4
6
|
class << self
|
5
7
|
def arg(spec, values: [])
|
6
|
-
parser.arg(spec, values:
|
8
|
+
parser.arg(spec, values:)
|
7
9
|
end
|
8
10
|
|
9
11
|
def option(key, spec, desc=nil, values: [], &block)
|
10
|
-
parser.option(key, spec, desc, values
|
12
|
+
parser.option(key, spec, desc, values:, &block)
|
11
13
|
end
|
12
14
|
|
13
15
|
def after_parse(context_method_name)
|
data/lib/tomo/cli/completions.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class CLI
|
3
5
|
class Completions
|
@@ -35,7 +37,7 @@ module Tomo
|
|
35
37
|
|
36
38
|
def all_candidates(rules, prefix_args, state)
|
37
39
|
rules.flat_map do |rule|
|
38
|
-
rule.candidates(*prefix_args, literal
|
40
|
+
rule.candidates(*prefix_args, literal:, state:)
|
39
41
|
end
|
40
42
|
end
|
41
43
|
|
data/lib/tomo/cli/error.rb
CHANGED
data/lib/tomo/cli/options.rb
CHANGED
data/lib/tomo/cli/parser.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "forwardable"
|
2
4
|
|
3
5
|
module Tomo
|
@@ -46,7 +48,7 @@ module Tomo
|
|
46
48
|
attr_reader :rules, :usage, :after_parse_methods
|
47
49
|
|
48
50
|
def evaluate(argv, state, literal:)
|
49
|
-
RulesEvaluator.evaluate(rules: rules.to_a, argv
|
51
|
+
RulesEvaluator.evaluate(rules: rules.to_a, argv:, state:, literal:)
|
50
52
|
end
|
51
53
|
|
52
54
|
def check_required_rules(state)
|
@@ -1,9 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
class Tomo::CLI::Rules
|
2
4
|
class ValueSwitch < Switch
|
3
5
|
include Tomo::Colors
|
4
6
|
|
5
7
|
def initialize(key, *switches, values_proc:, callback_proc:)
|
6
|
-
super(key, *switches, callback_proc:
|
8
|
+
super(key, *switches, callback_proc:)
|
7
9
|
|
8
10
|
@values_proc = values_proc
|
9
11
|
end
|
data/lib/tomo/cli/rules.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class CLI
|
3
5
|
class Rules
|
@@ -51,29 +53,29 @@ module Tomo
|
|
51
53
|
attr_reader :rules
|
52
54
|
|
53
55
|
def optional_arg_rule(spec, values_proc)
|
54
|
-
Rules::Argument.new(spec, values_proc
|
56
|
+
Rules::Argument.new(spec, values_proc:, required: false, multiple: false)
|
55
57
|
end
|
56
58
|
|
57
59
|
def required_arg_rule(spec, values_proc)
|
58
|
-
Rules::Argument.new(spec, values_proc
|
60
|
+
Rules::Argument.new(spec, values_proc:, required: true, multiple: false)
|
59
61
|
end
|
60
62
|
|
61
63
|
def mutiple_optional_args_rule(spec, values_proc)
|
62
|
-
Rules::Argument.new(spec, multiple: true, values_proc:
|
64
|
+
Rules::Argument.new(spec, multiple: true, values_proc:)
|
63
65
|
end
|
64
66
|
|
65
67
|
def on_off_switch_rule(key, name, _values_proc, callback_proc)
|
66
|
-
Rules::Switch.new(key, "--#{name}", "--no-#{name}", callback_proc:
|
68
|
+
Rules::Switch.new(key, "--#{name}", "--no-#{name}", callback_proc:) do |arg|
|
67
69
|
arg == "--#{name}"
|
68
70
|
end
|
69
71
|
end
|
70
72
|
|
71
73
|
def basic_switch_rule(key, *switches, _values_proc, callback_proc)
|
72
|
-
Rules::Switch.new(key, *switches, callback_proc:
|
74
|
+
Rules::Switch.new(key, *switches, callback_proc:)
|
73
75
|
end
|
74
76
|
|
75
77
|
def value_switch_rule(key, *switches, values_proc, callback_proc)
|
76
|
-
Rules::ValueSwitch.new(key, *switches, values_proc
|
78
|
+
Rules::ValueSwitch.new(key, *switches, values_proc:, callback_proc:)
|
77
79
|
end
|
78
80
|
end
|
79
81
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class CLI
|
3
5
|
class RulesEvaluator
|
@@ -10,7 +12,7 @@ module Tomo
|
|
10
12
|
@argv = argv.dup
|
11
13
|
@state = state
|
12
14
|
@literal = literal
|
13
|
-
@completions = completions || Completions.new(literal:
|
15
|
+
@completions = completions || Completions.new(literal:)
|
14
16
|
end
|
15
17
|
|
16
18
|
def call
|
@@ -18,7 +20,7 @@ module Tomo
|
|
18
20
|
complete_if_needed(remaining_rules, *argv) if argv.length == 1
|
19
21
|
rule, matched_args = match_next_rule
|
20
22
|
complete_if_needed([rule], *matched_args) if argv.empty?
|
21
|
-
rule.process(*matched_args, state:
|
23
|
+
rule.process(*matched_args, state:)
|
22
24
|
state.processed_rule(rule)
|
23
25
|
end
|
24
26
|
end
|
@@ -29,7 +31,7 @@ module Tomo
|
|
29
31
|
|
30
32
|
def match_next_rule
|
31
33
|
matched_rule, length = remaining_rules.find do |rule|
|
32
|
-
matching_length = rule.match(argv.first, literal:
|
34
|
+
matching_length = rule.match(argv.first, literal:)
|
33
35
|
break [rule, matching_length] if matching_length
|
34
36
|
end
|
35
37
|
raise_unrecognized_args if matched_rule.nil?
|
@@ -41,7 +43,7 @@ module Tomo
|
|
41
43
|
def complete_if_needed(matched_rules, *matched_args)
|
42
44
|
return unless Completions.active?
|
43
45
|
|
44
|
-
completions.print_completions_and_exit(matched_rules, *matched_args, state:
|
46
|
+
completions.print_completions_and_exit(matched_rules, *matched_args, state:)
|
45
47
|
end
|
46
48
|
|
47
49
|
def remaining_rules
|
data/lib/tomo/cli/state.rb
CHANGED
data/lib/tomo/cli/usage.rb
CHANGED
data/lib/tomo/cli.rb
CHANGED
data/lib/tomo/colors.rb
CHANGED
data/lib/tomo/commands/deploy.rb
CHANGED
data/lib/tomo/commands/help.rb
CHANGED
data/lib/tomo/commands/init.rb
CHANGED
data/lib/tomo/commands/run.rb
CHANGED
data/lib/tomo/commands/setup.rb
CHANGED
data/lib/tomo/commands/tasks.rb
CHANGED
data/lib/tomo/commands.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
module DSL
|
@@ -7,7 +9,7 @@ module Tomo
|
|
7
9
|
end
|
8
10
|
|
9
11
|
def run(task, privileged: false)
|
10
|
-
task.extend(Runtime::PrivilegedTask) if privileged
|
12
|
+
task = String.new(task).extend(Runtime::PrivilegedTask) if privileged
|
11
13
|
@batch << task
|
12
14
|
self
|
13
15
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
module DSL
|
@@ -18,19 +20,19 @@ module Tomo
|
|
18
20
|
self
|
19
21
|
end
|
20
22
|
|
21
|
-
def environment(name, &
|
23
|
+
def environment(name, &)
|
22
24
|
environment = @config.environments[name.to_s] ||= Environment.new
|
23
|
-
EnvironmentBlock.new(environment).instance_eval(&
|
25
|
+
EnvironmentBlock.new(environment).instance_eval(&)
|
24
26
|
self
|
25
27
|
end
|
26
28
|
|
27
|
-
def deploy(&
|
28
|
-
TasksBlock.new(@config.deploy_tasks).instance_eval(&
|
29
|
+
def deploy(&)
|
30
|
+
TasksBlock.new(@config.deploy_tasks).instance_eval(&)
|
29
31
|
self
|
30
32
|
end
|
31
33
|
|
32
|
-
def setup(&
|
33
|
-
TasksBlock.new(@config.setup_tasks).instance_eval(&
|
34
|
+
def setup(&)
|
35
|
+
TasksBlock.new(@config.setup_tasks).instance_eval(&)
|
34
36
|
self
|
35
37
|
end
|
36
38
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
module DSL
|
@@ -55,7 +57,7 @@ module Tomo
|
|
55
57
|
last = [dsl_lines.length, error_line_no + 1].min
|
56
58
|
width = last.to_s.length
|
57
59
|
|
58
|
-
(first..last).each_with_object("") do |line_no, result|
|
60
|
+
(first..last).each_with_object(+"") do |line_no, result|
|
59
61
|
line = dsl_lines[line_no - 1]
|
60
62
|
line_no_prefix = line_no.to_s.rjust(width)
|
61
63
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
module DSL
|
@@ -10,10 +12,10 @@ module Tomo
|
|
10
12
|
def host(address, port: 22, roles: [], log_prefix: nil, privileged_user: "root")
|
11
13
|
@config.hosts << Host.parse(
|
12
14
|
address,
|
13
|
-
privileged_user
|
14
|
-
port
|
15
|
-
roles
|
16
|
-
log_prefix:
|
15
|
+
privileged_user:,
|
16
|
+
port:,
|
17
|
+
roles:,
|
18
|
+
log_prefix:
|
17
19
|
)
|
18
20
|
self
|
19
21
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
module DSL
|
@@ -6,15 +8,15 @@ module Tomo
|
|
6
8
|
@tasks = tasks
|
7
9
|
end
|
8
10
|
|
9
|
-
def batch(&
|
11
|
+
def batch(&)
|
10
12
|
batch = []
|
11
|
-
BatchBlock.new(batch).instance_eval(&
|
13
|
+
BatchBlock.new(batch).instance_eval(&)
|
12
14
|
@tasks << batch unless batch.empty?
|
13
15
|
self
|
14
16
|
end
|
15
17
|
|
16
18
|
def run(task, privileged: false)
|
17
|
-
task.extend(Runtime::PrivilegedTask) if privileged
|
19
|
+
task = String.new(task).extend(Runtime::PrivilegedTask) if privileged
|
18
20
|
@tasks << task
|
19
21
|
self
|
20
22
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
class PluginsRegistry::FileResolver
|
@@ -25,7 +27,7 @@ module Tomo
|
|
25
27
|
attr_reader :path
|
26
28
|
|
27
29
|
def raise_file_not_found(path)
|
28
|
-
PluginFileNotFoundError.raise_with(path:
|
30
|
+
PluginFileNotFoundError.raise_with(path:)
|
29
31
|
end
|
30
32
|
|
31
33
|
def define_anonymous_plugin_class
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
class PluginsRegistry::GemResolver
|
4
|
-
PLUGIN_PREFIX = "tomo/plugin"
|
6
|
+
PLUGIN_PREFIX = "tomo/plugin"
|
5
7
|
private_constant :PLUGIN_PREFIX
|
6
8
|
|
7
9
|
def self.resolve(name)
|
@@ -47,7 +49,7 @@ module Tomo
|
|
47
49
|
def raise_unknown_plugin_error(error)
|
48
50
|
UnknownPluginError.raise_with(
|
49
51
|
error.message,
|
50
|
-
name
|
52
|
+
name:,
|
51
53
|
gem_name: "#{PLUGIN_PREFIX}/#{name}".tr("/", "-"),
|
52
54
|
known_plugins: scan_for_plugins
|
53
55
|
)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
class UnknownEnvironmentError < Tomo::Error
|
@@ -23,10 +25,10 @@ module Tomo
|
|
23
25
|
ERROR
|
24
26
|
|
25
27
|
if suggestions.any?
|
26
|
-
error
|
28
|
+
error + suggestions.to_console
|
27
29
|
else
|
28
30
|
envs = known_environments.map { |env| blue(" #{env}") }
|
29
|
-
error
|
31
|
+
error + <<~ENVS
|
30
32
|
|
31
33
|
The following environments are available:
|
32
34
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
class UnknownPluginError < Tomo::Error
|
@@ -9,9 +11,9 @@ module Tomo
|
|
9
11
|
ERROR
|
10
12
|
|
11
13
|
sugg = Error::Suggestions.new(dictionary: known_plugins, word: name)
|
12
|
-
error
|
14
|
+
error += sugg.to_console if sugg.any?
|
13
15
|
|
14
|
-
error
|
16
|
+
error + gem_suggestion
|
15
17
|
end
|
16
18
|
|
17
19
|
private
|
data/lib/tomo/configuration.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Tomo
|
2
4
|
class Configuration
|
3
5
|
autoload :DSL, "tomo/configuration/dsl"
|
@@ -12,7 +14,7 @@ module Tomo
|
|
12
14
|
autoload :UnspecifiedEnvironmentError, "tomo/configuration/unspecified_environment_error"
|
13
15
|
|
14
16
|
def self.from_config_rb(path=DEFAULT_CONFIG_PATH)
|
15
|
-
ProjectNotFoundError.raise_with(path:
|
17
|
+
ProjectNotFoundError.raise_with(path:) unless File.file?(path)
|
16
18
|
Tomo.logger.debug("Loading configuration from #{path.inspect}")
|
17
19
|
config_rb = File.read(path)
|
18
20
|
|
@@ -51,12 +53,12 @@ module Tomo
|
|
51
53
|
plugins_registry = register_plugins
|
52
54
|
|
53
55
|
Runtime.new(
|
54
|
-
deploy_tasks
|
55
|
-
setup_tasks
|
56
|
-
plugins_registry
|
56
|
+
deploy_tasks:,
|
57
|
+
setup_tasks:,
|
58
|
+
plugins_registry:,
|
57
59
|
hosts: add_log_prefixes(hosts),
|
58
60
|
settings: { tomo_config_file_path: path }.merge(settings),
|
59
|
-
task_filter:
|
61
|
+
task_filter:
|
60
62
|
)
|
61
63
|
end
|
62
64
|
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "forwardable"
|
2
4
|
require "io/console"
|
3
5
|
require "time"
|
@@ -8,7 +10,7 @@ module Tomo
|
|
8
10
|
extend Forwardable
|
9
11
|
|
10
12
|
def initialize(input=$stdin)
|
11
|
-
@buffer = ""
|
13
|
+
@buffer = +""
|
12
14
|
@input = input
|
13
15
|
end
|
14
16
|
|
@@ -35,7 +37,7 @@ module Tomo
|
|
35
37
|
end
|
36
38
|
|
37
39
|
def read_chars_nonblock
|
38
|
-
chars = ""
|
40
|
+
chars = +""
|
39
41
|
loop do
|
40
42
|
next_char = raw { read_nonblock(1) }
|
41
43
|
break if next_char.nil?
|
data/lib/tomo/console/menu.rb
CHANGED
@@ -1,13 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "forwardable"
|
2
4
|
require "io/console"
|
3
5
|
|
4
6
|
module Tomo
|
5
7
|
class Console
|
6
8
|
class Menu
|
7
|
-
ARROW_UP = "\e[A"
|
8
|
-
ARROW_DOWN = "\e[B"
|
9
|
-
RETURN = "\r"
|
10
|
-
ENTER = "\n"
|
9
|
+
ARROW_UP = "\e[A"
|
10
|
+
ARROW_DOWN = "\e[B"
|
11
|
+
RETURN = "\r"
|
12
|
+
ENTER = "\n"
|
11
13
|
|
12
14
|
extend Forwardable
|
13
15
|
include Colors
|