tomo 1.18.2 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +1 -1
- data/lib/tomo/cli/command.rb +2 -2
- data/lib/tomo/cli/completions.rb +1 -1
- data/lib/tomo/cli/parser.rb +1 -1
- data/lib/tomo/cli/rules/value_switch.rb +1 -1
- data/lib/tomo/cli/rules.rb +6 -6
- data/lib/tomo/cli/rules_evaluator.rb +4 -4
- data/lib/tomo/configuration/dsl/batch_block.rb +1 -1
- data/lib/tomo/configuration/dsl/config_file.rb +6 -6
- data/lib/tomo/configuration/dsl/hosts_and_settings.rb +4 -4
- data/lib/tomo/configuration/dsl/tasks_block.rb +3 -3
- data/lib/tomo/configuration/plugins_registry/file_resolver.rb +1 -1
- data/lib/tomo/configuration/plugins_registry/gem_resolver.rb +1 -1
- data/lib/tomo/configuration.rb +5 -5
- data/lib/tomo/console.rb +1 -1
- data/lib/tomo/error/suggestions.rb +1 -1
- data/lib/tomo/host.rb +2 -2
- data/lib/tomo/plugin/env/tasks.rb +15 -6
- data/lib/tomo/plugin/rbenv/tasks.rb +1 -1
- data/lib/tomo/remote.rb +3 -3
- data/lib/tomo/runtime/execution_plan.rb +2 -2
- data/lib/tomo/runtime/host_execution_step.rb +1 -1
- data/lib/tomo/runtime/task_runner.rb +3 -3
- data/lib/tomo/runtime.rb +6 -6
- data/lib/tomo/ssh/child_process.rb +2 -2
- data/lib/tomo/ssh/connection.rb +2 -2
- data/lib/tomo/ssh/connection_validator.rb +6 -6
- data/lib/tomo/task_api.rb +1 -1
- data/lib/tomo/templates/config.rb.erb +1 -4
- data/lib/tomo/testing/cli_tester.rb +2 -2
- data/lib/tomo/testing/host_extensions.rb +1 -1
- data/lib/tomo/testing/local.rb +12 -12
- data/lib/tomo/version.rb +1 -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: e0ab21d55aa30f611411e7184fea0b3456d0ffd8c1877ea74ad8394284286895
|
4
|
+
data.tar.gz: 38e0273b4304685c8515e8d150a2d140f9b9e64e7bac1eb73f3fc7881394d80b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 837b9fe3ca56ddaa228d4e519b13e27efa06edbfbc2af71d3dfb3b387ab1d0c3ae6dfe03ea4093abb0fc1212ead742a810c425c46b10a9e534d1b897d1905057
|
7
|
+
data.tar.gz: 43d50fcc0e8b1c4ac385ad1e476b26351f1f364cf7ea52b6d29350c9bbd03179fffc898c9f3af1d2ca08cb9f40590624a37602e5c41a06aee9e0fa24cbc24da1
|
data/LICENSE.txt
CHANGED
data/lib/tomo/cli/command.rb
CHANGED
@@ -3,11 +3,11 @@ module Tomo
|
|
3
3
|
class Command
|
4
4
|
class << self
|
5
5
|
def arg(spec, values: [])
|
6
|
-
parser.arg(spec, values:
|
6
|
+
parser.arg(spec, values:)
|
7
7
|
end
|
8
8
|
|
9
9
|
def option(key, spec, desc=nil, values: [], &block)
|
10
|
-
parser.option(key, spec, desc, values
|
10
|
+
parser.option(key, spec, desc, values:, &block)
|
11
11
|
end
|
12
12
|
|
13
13
|
def after_parse(context_method_name)
|
data/lib/tomo/cli/completions.rb
CHANGED
data/lib/tomo/cli/parser.rb
CHANGED
@@ -46,7 +46,7 @@ module Tomo
|
|
46
46
|
attr_reader :rules, :usage, :after_parse_methods
|
47
47
|
|
48
48
|
def evaluate(argv, state, literal:)
|
49
|
-
RulesEvaluator.evaluate(rules: rules.to_a, argv
|
49
|
+
RulesEvaluator.evaluate(rules: rules.to_a, argv:, state:, literal:)
|
50
50
|
end
|
51
51
|
|
52
52
|
def check_required_rules(state)
|
data/lib/tomo/cli/rules.rb
CHANGED
@@ -51,29 +51,29 @@ module Tomo
|
|
51
51
|
attr_reader :rules
|
52
52
|
|
53
53
|
def optional_arg_rule(spec, values_proc)
|
54
|
-
Rules::Argument.new(spec, values_proc
|
54
|
+
Rules::Argument.new(spec, values_proc:, required: false, multiple: false)
|
55
55
|
end
|
56
56
|
|
57
57
|
def required_arg_rule(spec, values_proc)
|
58
|
-
Rules::Argument.new(spec, values_proc
|
58
|
+
Rules::Argument.new(spec, values_proc:, required: true, multiple: false)
|
59
59
|
end
|
60
60
|
|
61
61
|
def mutiple_optional_args_rule(spec, values_proc)
|
62
|
-
Rules::Argument.new(spec, multiple: true, values_proc:
|
62
|
+
Rules::Argument.new(spec, multiple: true, values_proc:)
|
63
63
|
end
|
64
64
|
|
65
65
|
def on_off_switch_rule(key, name, _values_proc, callback_proc)
|
66
|
-
Rules::Switch.new(key, "--#{name}", "--no-#{name}", callback_proc:
|
66
|
+
Rules::Switch.new(key, "--#{name}", "--no-#{name}", callback_proc:) do |arg|
|
67
67
|
arg == "--#{name}"
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
71
|
def basic_switch_rule(key, *switches, _values_proc, callback_proc)
|
72
|
-
Rules::Switch.new(key, *switches, callback_proc:
|
72
|
+
Rules::Switch.new(key, *switches, callback_proc:)
|
73
73
|
end
|
74
74
|
|
75
75
|
def value_switch_rule(key, *switches, values_proc, callback_proc)
|
76
|
-
Rules::ValueSwitch.new(key, *switches, values_proc
|
76
|
+
Rules::ValueSwitch.new(key, *switches, values_proc:, callback_proc:)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
@@ -10,7 +10,7 @@ module Tomo
|
|
10
10
|
@argv = argv.dup
|
11
11
|
@state = state
|
12
12
|
@literal = literal
|
13
|
-
@completions = completions || Completions.new(literal:
|
13
|
+
@completions = completions || Completions.new(literal:)
|
14
14
|
end
|
15
15
|
|
16
16
|
def call
|
@@ -18,7 +18,7 @@ module Tomo
|
|
18
18
|
complete_if_needed(remaining_rules, *argv) if argv.length == 1
|
19
19
|
rule, matched_args = match_next_rule
|
20
20
|
complete_if_needed([rule], *matched_args) if argv.empty?
|
21
|
-
rule.process(*matched_args, state:
|
21
|
+
rule.process(*matched_args, state:)
|
22
22
|
state.processed_rule(rule)
|
23
23
|
end
|
24
24
|
end
|
@@ -29,7 +29,7 @@ module Tomo
|
|
29
29
|
|
30
30
|
def match_next_rule
|
31
31
|
matched_rule, length = remaining_rules.find do |rule|
|
32
|
-
matching_length = rule.match(argv.first, literal:
|
32
|
+
matching_length = rule.match(argv.first, literal:)
|
33
33
|
break [rule, matching_length] if matching_length
|
34
34
|
end
|
35
35
|
raise_unrecognized_args if matched_rule.nil?
|
@@ -41,7 +41,7 @@ module Tomo
|
|
41
41
|
def complete_if_needed(matched_rules, *matched_args)
|
42
42
|
return unless Completions.active?
|
43
43
|
|
44
|
-
completions.print_completions_and_exit(matched_rules, *matched_args, state:
|
44
|
+
completions.print_completions_and_exit(matched_rules, *matched_args, state:)
|
45
45
|
end
|
46
46
|
|
47
47
|
def remaining_rules
|
@@ -18,19 +18,19 @@ module Tomo
|
|
18
18
|
self
|
19
19
|
end
|
20
20
|
|
21
|
-
def environment(name, &
|
21
|
+
def environment(name, &)
|
22
22
|
environment = @config.environments[name.to_s] ||= Environment.new
|
23
|
-
EnvironmentBlock.new(environment).instance_eval(&
|
23
|
+
EnvironmentBlock.new(environment).instance_eval(&)
|
24
24
|
self
|
25
25
|
end
|
26
26
|
|
27
|
-
def deploy(&
|
28
|
-
TasksBlock.new(@config.deploy_tasks).instance_eval(&
|
27
|
+
def deploy(&)
|
28
|
+
TasksBlock.new(@config.deploy_tasks).instance_eval(&)
|
29
29
|
self
|
30
30
|
end
|
31
31
|
|
32
|
-
def setup(&
|
33
|
-
TasksBlock.new(@config.setup_tasks).instance_eval(&
|
32
|
+
def setup(&)
|
33
|
+
TasksBlock.new(@config.setup_tasks).instance_eval(&)
|
34
34
|
self
|
35
35
|
end
|
36
36
|
end
|
@@ -10,10 +10,10 @@ module Tomo
|
|
10
10
|
def host(address, port: 22, roles: [], log_prefix: nil, privileged_user: "root")
|
11
11
|
@config.hosts << Host.parse(
|
12
12
|
address,
|
13
|
-
privileged_user
|
14
|
-
port
|
15
|
-
roles
|
16
|
-
log_prefix:
|
13
|
+
privileged_user:,
|
14
|
+
port:,
|
15
|
+
roles:,
|
16
|
+
log_prefix:
|
17
17
|
)
|
18
18
|
self
|
19
19
|
end
|
@@ -6,15 +6,15 @@ module Tomo
|
|
6
6
|
@tasks = tasks
|
7
7
|
end
|
8
8
|
|
9
|
-
def batch(&
|
9
|
+
def batch(&)
|
10
10
|
batch = []
|
11
|
-
BatchBlock.new(batch).instance_eval(&
|
11
|
+
BatchBlock.new(batch).instance_eval(&)
|
12
12
|
@tasks << batch unless batch.empty?
|
13
13
|
self
|
14
14
|
end
|
15
15
|
|
16
16
|
def run(task, privileged: false)
|
17
|
-
task.extend(Runtime::PrivilegedTask) if privileged
|
17
|
+
task = String.new(task).extend(Runtime::PrivilegedTask) if privileged
|
18
18
|
@tasks << task
|
19
19
|
self
|
20
20
|
end
|
data/lib/tomo/configuration.rb
CHANGED
@@ -12,7 +12,7 @@ module Tomo
|
|
12
12
|
autoload :UnspecifiedEnvironmentError, "tomo/configuration/unspecified_environment_error"
|
13
13
|
|
14
14
|
def self.from_config_rb(path=DEFAULT_CONFIG_PATH)
|
15
|
-
ProjectNotFoundError.raise_with(path:
|
15
|
+
ProjectNotFoundError.raise_with(path:) unless File.file?(path)
|
16
16
|
Tomo.logger.debug("Loading configuration from #{path.inspect}")
|
17
17
|
config_rb = File.read(path)
|
18
18
|
|
@@ -51,12 +51,12 @@ module Tomo
|
|
51
51
|
plugins_registry = register_plugins
|
52
52
|
|
53
53
|
Runtime.new(
|
54
|
-
deploy_tasks
|
55
|
-
setup_tasks
|
56
|
-
plugins_registry
|
54
|
+
deploy_tasks:,
|
55
|
+
setup_tasks:,
|
56
|
+
plugins_registry:,
|
57
57
|
hosts: add_log_prefixes(hosts),
|
58
58
|
settings: { tomo_config_file_path: path }.merge(settings),
|
59
|
-
task_filter:
|
59
|
+
task_filter:
|
60
60
|
)
|
61
61
|
end
|
62
62
|
|
data/lib/tomo/console.rb
CHANGED
@@ -12,7 +12,7 @@ module Tomo
|
|
12
12
|
|
13
13
|
def to_a
|
14
14
|
@_suggestions ||= if defined?(DidYouMean::SpellChecker)
|
15
|
-
checker = DidYouMean::SpellChecker.new(dictionary:
|
15
|
+
checker = DidYouMean::SpellChecker.new(dictionary:)
|
16
16
|
suggestions = checker.correct(word)
|
17
17
|
suggestions || []
|
18
18
|
else
|
data/lib/tomo/host.rb
CHANGED
@@ -10,7 +10,7 @@ module Tomo
|
|
10
10
|
user, address = host.match(PATTERN).captures
|
11
11
|
raise ArgumentError, "host cannot be blank" if address.empty?
|
12
12
|
|
13
|
-
new(user
|
13
|
+
new(user:, address:, **kwargs)
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(address:, port: nil, log_prefix: nil, roles: nil, user: nil, privileged_user: "root")
|
@@ -31,7 +31,7 @@ module Tomo
|
|
31
31
|
|
32
32
|
def to_s
|
33
33
|
str = user ? "#{user}@#{address}" : address
|
34
|
-
str
|
34
|
+
str += ":#{port}" unless port == 22
|
35
35
|
str
|
36
36
|
end
|
37
37
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "monitor"
|
2
|
+
require "securerandom"
|
2
3
|
|
3
4
|
module Tomo::Plugin::Env
|
4
5
|
class Tasks < Tomo::TaskLibrary # rubocop:disable Metrics/ClassLength
|
@@ -14,17 +15,25 @@ module Tomo::Plugin::Env
|
|
14
15
|
update
|
15
16
|
end
|
16
17
|
|
17
|
-
def update
|
18
|
+
def update # rubocop:disable Metrics/MethodLength
|
18
19
|
return if settings[:env_vars].empty?
|
19
20
|
|
20
21
|
modify_env_file do |env|
|
21
22
|
settings[:env_vars].each do |name, value|
|
22
|
-
|
23
|
+
case value
|
24
|
+
when :prompt
|
25
|
+
next if contains_entry?(env, name)
|
26
|
+
|
27
|
+
value = prompt_for(name, message: <<~MSG)
|
28
|
+
The remote host needs a value for the $#{name} environment variable.
|
29
|
+
Please provide a value at the prompt.
|
30
|
+
MSG
|
31
|
+
when :generate_secret
|
32
|
+
next if contains_entry?(env, name)
|
33
|
+
|
34
|
+
value = SecureRandom.hex(64)
|
35
|
+
end
|
23
36
|
|
24
|
-
value = prompt_for(name, message: <<~MSG) if value == :prompt
|
25
|
-
The remote host needs a value for the $#{name} environment variable.
|
26
|
-
Please provide a value at the prompt.
|
27
|
-
MSG
|
28
37
|
replace_entry(env, name, value)
|
29
38
|
end
|
30
39
|
end
|
@@ -19,7 +19,7 @@ module Tomo::Plugin::Rbenv
|
|
19
19
|
|
20
20
|
def modify_bashrc
|
21
21
|
existing_rc = remote.capture("cat", paths.bashrc, raise_on_error: false)
|
22
|
-
return if existing_rc.include?("rbenv init")
|
22
|
+
return if existing_rc.include?("rbenv init") && existing_rc.include?("$HOME/.rbenv/bin")
|
23
23
|
|
24
24
|
remote.write(text: <<~BASHRC + existing_rc, to: paths.bashrc)
|
25
25
|
if [ -d $HOME/.rbenv ]; then
|
data/lib/tomo/remote.rb
CHANGED
@@ -20,14 +20,14 @@ module Tomo
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def attach(*command, default_chdir: nil, **command_opts)
|
23
|
-
full_command = shell_builder.build(*command, default_chdir:
|
23
|
+
full_command = shell_builder.build(*command, default_chdir:)
|
24
24
|
ssh.ssh_exec(Script.new(full_command, pty: true, **command_opts))
|
25
25
|
end
|
26
26
|
|
27
27
|
def run(*command, attach: false, default_chdir: nil, **command_opts)
|
28
|
-
attach(*command, default_chdir
|
28
|
+
attach(*command, default_chdir:, **command_opts) if attach
|
29
29
|
|
30
|
-
full_command = shell_builder.build(*command, default_chdir:
|
30
|
+
full_command = shell_builder.build(*command, default_chdir:)
|
31
31
|
ssh.ssh_subprocess(Script.new(full_command, **command_opts))
|
32
32
|
end
|
33
33
|
|
@@ -35,7 +35,7 @@ module Tomo
|
|
35
35
|
open_connections do |remotes|
|
36
36
|
plan.each do |steps|
|
37
37
|
steps.each do |step|
|
38
|
-
step.execute(thread_pool
|
38
|
+
step.execute(thread_pool:, remotes:)
|
39
39
|
end
|
40
40
|
thread_pool.run_to_completion
|
41
41
|
end
|
@@ -76,7 +76,7 @@ module Tomo
|
|
76
76
|
def build_plan(tasks, task_filter)
|
77
77
|
tasks.each_with_object([]) do |task, result|
|
78
78
|
steps = hosts.map do |host|
|
79
|
-
HostExecutionStep.new(tasks: task, host
|
79
|
+
HostExecutionStep.new(tasks: task, host:, task_filter:, task_runner:)
|
80
80
|
end
|
81
81
|
steps.reject!(&:empty?)
|
82
82
|
result << steps unless steps.empty?
|
@@ -24,15 +24,15 @@ module Tomo
|
|
24
24
|
|
25
25
|
def run(task:, remote:)
|
26
26
|
validate_task!(task)
|
27
|
-
Current.with(task
|
27
|
+
Current.with(task:, remote:) do
|
28
28
|
Tomo.logger.task_start(task)
|
29
29
|
tasks_by_name[task].call
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
33
|
def connect(host)
|
34
|
-
Current.with(host:
|
35
|
-
conn = SSH.connect(host
|
34
|
+
Current.with(host:) do
|
35
|
+
conn = SSH.connect(host:, options: ssh_options)
|
36
36
|
remote = Remote.new(conn, context, helper_modules)
|
37
37
|
return remote unless block_given?
|
38
38
|
|
data/lib/tomo/runtime.rb
CHANGED
@@ -51,15 +51,15 @@ module Tomo
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def run!(task, *args, privileged: false)
|
54
|
-
task = task.
|
55
|
-
execution_plan_for([task], release: :current, args:
|
54
|
+
task = String.new(task).extend(PrivilegedTask) if privileged
|
55
|
+
execution_plan_for([task], release: :current, args:).execute
|
56
56
|
end
|
57
57
|
|
58
58
|
def execution_plan_for(tasks, release: :current, args: [])
|
59
59
|
ExecutionPlan.new(
|
60
|
-
tasks
|
61
|
-
hosts
|
62
|
-
task_filter
|
60
|
+
tasks:,
|
61
|
+
hosts:,
|
62
|
+
task_filter:,
|
63
63
|
task_runner: new_task_runner(release, args)
|
64
64
|
)
|
65
65
|
end
|
@@ -74,7 +74,7 @@ module Tomo
|
|
74
74
|
.merge(settings)
|
75
75
|
.merge(run_args: args)
|
76
76
|
|
77
|
-
TaskRunner.new(plugins_registry
|
77
|
+
TaskRunner.new(plugins_registry:, settings: run_settings)
|
78
78
|
end
|
79
79
|
|
80
80
|
def release_path_for(type)
|
@@ -6,7 +6,7 @@ module Tomo
|
|
6
6
|
module SSH
|
7
7
|
class ChildProcess
|
8
8
|
def self.execute(*command, on_data: ->(data) {})
|
9
|
-
process = new(*command, on_data:
|
9
|
+
process = new(*command, on_data:)
|
10
10
|
process.wait_for_exit
|
11
11
|
process.result
|
12
12
|
end
|
@@ -31,7 +31,7 @@ module Tomo
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def result
|
34
|
-
Result.new(exit_status
|
34
|
+
Result.new(exit_status:, stdout: stdout_buffer.string, stderr: stderr_buffer.string)
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
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:)
|
30
30
|
handle_data = ->(data) { logger.script_output(script, data) }
|
31
31
|
|
32
32
|
logger.script_start(script)
|
@@ -62,7 +62,7 @@ module Tomo
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def raise_run_error(script, ssh_args, result)
|
65
|
-
ScriptError.raise_with(result.output, host
|
65
|
+
ScriptError.raise_with(result.output, host:, result:, script:, ssh_args:)
|
66
66
|
end
|
67
67
|
end
|
68
68
|
end
|
@@ -49,13 +49,13 @@ module Tomo
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def handle_bad_executable(error)
|
52
|
-
ExecutableError.raise_with(error, executable:
|
52
|
+
ExecutableError.raise_with(error, executable:)
|
53
53
|
end
|
54
54
|
|
55
55
|
def raise_unsupported_version(ver)
|
56
56
|
UnsupportedVersionError.raise_with(
|
57
57
|
ver,
|
58
|
-
host
|
58
|
+
host:,
|
59
59
|
command: "#{executable} -V",
|
60
60
|
expected_version: "OpenSSH_#{MINIMUM_OPENSSH_VERSION}"
|
61
61
|
)
|
@@ -64,16 +64,16 @@ module Tomo
|
|
64
64
|
def raise_connection_failure(result)
|
65
65
|
case result.output
|
66
66
|
when /Permission denied/i
|
67
|
-
PermissionError.raise_with(result.output, host:
|
67
|
+
PermissionError.raise_with(result.output, host:)
|
68
68
|
when /(Could not resolve|Operation timed out|Connection refused)/i
|
69
|
-
ConnectionError.raise_with(result.output, host:
|
69
|
+
ConnectionError.raise_with(result.output, host:)
|
70
70
|
else
|
71
|
-
UnknownError.raise_with(result.output, host:
|
71
|
+
UnknownError.raise_with(result.output, host:)
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
def raise_unknown_error(result)
|
76
|
-
UnknownError.raise_with(<<~ERROR.strip, host:
|
76
|
+
UnknownError.raise_with(<<~ERROR.strip, host:)
|
77
77
|
Unexpected output from `ssh`. Expected `echo hi` to return "hi" but got:
|
78
78
|
#{result.output}
|
79
79
|
(exited with code #{result.exit_status})
|
data/lib/tomo/task_api.rb
CHANGED
@@ -24,7 +24,7 @@ module Tomo
|
|
24
24
|
working_path = paths.tomo_config_file&.dirname
|
25
25
|
path = File.expand_path(path, working_path) if working_path && path.start_with?(".")
|
26
26
|
|
27
|
-
Runtime::TemplateNotFoundError.raise_with(path:
|
27
|
+
Runtime::TemplateNotFoundError.raise_with(path:) unless File.file?(path)
|
28
28
|
template = File.read(path)
|
29
29
|
ERB.new(template).result(binding)
|
30
30
|
end
|
@@ -29,14 +29,11 @@ set git_exclusions: %w[
|
|
29
29
|
test/
|
30
30
|
]
|
31
31
|
set env_vars: {
|
32
|
-
RACK_ENV: "production",
|
33
32
|
RAILS_ENV: "production",
|
34
|
-
RAILS_LOG_TO_STDOUT: "1",
|
35
|
-
RAILS_SERVE_STATIC_FILES: "1",
|
36
33
|
RUBY_YJIT_ENABLE: "1",
|
37
34
|
BOOTSNAP_CACHE_DIR: "tmp/bootsnap-cache",
|
38
35
|
DATABASE_URL: :prompt,
|
39
|
-
SECRET_KEY_BASE: :
|
36
|
+
SECRET_KEY_BASE: :generate_secret
|
40
37
|
}
|
41
38
|
set linked_dirs: %w[
|
42
39
|
.yarn/cache
|
@@ -14,7 +14,7 @@ module Tomo
|
|
14
14
|
def mock(script, stdout: "", stderr: "", exit_status: 0)
|
15
15
|
mocks << [
|
16
16
|
script.is_a?(Regexp) ? script : /\A#{Regexp.quote(script)}\z/,
|
17
|
-
Result.new(stdout
|
17
|
+
Result.new(stdout:, stderr:, exit_status:)
|
18
18
|
]
|
19
19
|
end
|
20
20
|
|
data/lib/tomo/testing/local.rb
CHANGED
@@ -8,16 +8,16 @@ require "tmpdir"
|
|
8
8
|
module Tomo
|
9
9
|
module Testing
|
10
10
|
module Local
|
11
|
-
def with_tomo_gemfile(&
|
12
|
-
Local.with_tomo_gemfile(&
|
11
|
+
def with_tomo_gemfile(&)
|
12
|
+
Local.with_tomo_gemfile(&)
|
13
13
|
end
|
14
14
|
|
15
|
-
def in_temp_dir(token=nil, &
|
16
|
-
Local.in_temp_dir(token, &
|
15
|
+
def in_temp_dir(token=nil, &)
|
16
|
+
Local.in_temp_dir(token, &)
|
17
17
|
end
|
18
18
|
|
19
19
|
def capture(*command, raise_on_error: true)
|
20
|
-
Local.capture(*command, raise_on_error:
|
20
|
+
Local.capture(*command, raise_on_error:)
|
21
21
|
end
|
22
22
|
|
23
23
|
class << self
|
@@ -29,11 +29,11 @@ module Tomo
|
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
32
|
-
def in_temp_dir(token=nil, &
|
32
|
+
def in_temp_dir(token=nil, &)
|
33
33
|
token ||= SecureRandom.hex(8)
|
34
34
|
dir = File.join(Dir.tmpdir, "tomo_test_#{token}")
|
35
35
|
FileUtils.mkdir_p(dir)
|
36
|
-
Dir.chdir(dir, &
|
36
|
+
Dir.chdir(dir, &)
|
37
37
|
end
|
38
38
|
|
39
39
|
def capture(*command, raise_on_error: true)
|
@@ -49,10 +49,10 @@ module Tomo
|
|
49
49
|
|
50
50
|
private
|
51
51
|
|
52
|
-
def progress(message, &
|
53
|
-
return with_progress(message, &
|
52
|
+
def progress(message, &)
|
53
|
+
return with_progress(message, &) if interactive?
|
54
54
|
|
55
|
-
thread = Thread.new(&
|
55
|
+
thread = Thread.new(&)
|
56
56
|
return thread.value if wait_for_exit(thread, 4)
|
57
57
|
|
58
58
|
puts "#{message} ..."
|
@@ -62,9 +62,9 @@ module Tomo
|
|
62
62
|
thread.value
|
63
63
|
end
|
64
64
|
|
65
|
-
def with_progress(message, &
|
65
|
+
def with_progress(message, &)
|
66
66
|
spinner = %w[⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏].cycle
|
67
|
-
thread = Thread.new(&
|
67
|
+
thread = Thread.new(&)
|
68
68
|
return thread.value if wait_for_exit(thread, 4)
|
69
69
|
|
70
70
|
print "#{spinner.next} #{message}..."
|
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.
|
4
|
+
version: 1.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-25 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
|
@@ -183,14 +183,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
requirements:
|
184
184
|
- - ">="
|
185
185
|
- !ruby/object:Gem::Version
|
186
|
-
version: '3.
|
186
|
+
version: '3.1'
|
187
187
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
188
|
requirements:
|
189
189
|
- - ">="
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.5.
|
193
|
+
rubygems_version: 3.5.10
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: A friendly CLI for deploying Rails apps ✨
|