tomo 1.18.2 → 1.19.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5e009fc663164b91e6dd0ad03333d704014775100f9b0aa222f691f6048f2b72
4
- data.tar.gz: bb0943cdba7ef40ab5e2ab826826cf189e1ceec7f3ecaf6f55307117bb95d85d
3
+ metadata.gz: e0ab21d55aa30f611411e7184fea0b3456d0ffd8c1877ea74ad8394284286895
4
+ data.tar.gz: 38e0273b4304685c8515e8d150a2d140f9b9e64e7bac1eb73f3fc7881394d80b
5
5
  SHA512:
6
- metadata.gz: 636abb08a843308c021677869941769fb4cf0f52143a54b7d8cb9132ae99c5b46a26731b9af196715f36f8b1b7cc513278feb1edfdc8f3d686a71b06b1abf547
7
- data.tar.gz: 4f63cb3204cc73a707194daaffc9365e52e33bc5abb3131546177f86563783c3b4f08e24c9f1f65a8da4e686ba6fc92387560708b21ff18076f0228e814948f6
6
+ metadata.gz: 837b9fe3ca56ddaa228d4e519b13e27efa06edbfbc2af71d3dfb3b387ab1d0c3ae6dfe03ea4093abb0fc1212ead742a810c425c46b10a9e534d1b897d1905057
7
+ data.tar.gz: 43d50fcc0e8b1c4ac385ad1e476b26351f1f364cf7ea52b6d29350c9bbd03179fffc898c9f3af1d2ca08cb9f40590624a37602e5c41a06aee9e0fa24cbc24da1
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2023 Matt Brictson
3
+ Copyright (c) 2024 Matt Brictson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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: 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: values, &block)
10
+ parser.option(key, spec, desc, values:, &block)
11
11
  end
12
12
 
13
13
  def after_parse(context_method_name)
@@ -35,7 +35,7 @@ module Tomo
35
35
 
36
36
  def all_candidates(rules, prefix_args, state)
37
37
  rules.flat_map do |rule|
38
- rule.candidates(*prefix_args, literal: literal, state: state)
38
+ rule.candidates(*prefix_args, literal:, state:)
39
39
  end
40
40
  end
41
41
 
@@ -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: argv, state: state, literal: literal)
49
+ RulesEvaluator.evaluate(rules: rules.to_a, argv:, state:, literal:)
50
50
  end
51
51
 
52
52
  def check_required_rules(state)
@@ -3,7 +3,7 @@ class Tomo::CLI::Rules
3
3
  include Tomo::Colors
4
4
 
5
5
  def initialize(key, *switches, values_proc:, callback_proc:)
6
- super(key, *switches, callback_proc: callback_proc)
6
+ super(key, *switches, callback_proc:)
7
7
 
8
8
  @values_proc = values_proc
9
9
  end
@@ -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: values_proc, required: false, multiple: false)
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: values_proc, required: true, multiple: false)
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: 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: callback_proc) do |arg|
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: 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: values_proc, callback_proc: callback_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: 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: 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: 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: state)
44
+ completions.print_completions_and_exit(matched_rules, *matched_args, state:)
45
45
  end
46
46
 
47
47
  def remaining_rules
@@ -7,7 +7,7 @@ module Tomo
7
7
  end
8
8
 
9
9
  def run(task, privileged: false)
10
- task.extend(Runtime::PrivilegedTask) if privileged
10
+ task = String.new(task).extend(Runtime::PrivilegedTask) if privileged
11
11
  @batch << task
12
12
  self
13
13
  end
@@ -18,19 +18,19 @@ module Tomo
18
18
  self
19
19
  end
20
20
 
21
- def environment(name, &block)
21
+ def environment(name, &)
22
22
  environment = @config.environments[name.to_s] ||= Environment.new
23
- EnvironmentBlock.new(environment).instance_eval(&block)
23
+ EnvironmentBlock.new(environment).instance_eval(&)
24
24
  self
25
25
  end
26
26
 
27
- def deploy(&block)
28
- TasksBlock.new(@config.deploy_tasks).instance_eval(&block)
27
+ def deploy(&)
28
+ TasksBlock.new(@config.deploy_tasks).instance_eval(&)
29
29
  self
30
30
  end
31
31
 
32
- def setup(&block)
33
- TasksBlock.new(@config.setup_tasks).instance_eval(&block)
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: privileged_user,
14
- port: port,
15
- roles: roles,
16
- log_prefix: 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(&block)
9
+ def batch(&)
10
10
  batch = []
11
- BatchBlock.new(batch).instance_eval(&block)
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
@@ -25,7 +25,7 @@ module Tomo
25
25
  attr_reader :path
26
26
 
27
27
  def raise_file_not_found(path)
28
- PluginFileNotFoundError.raise_with(path: path)
28
+ PluginFileNotFoundError.raise_with(path:)
29
29
  end
30
30
 
31
31
  def define_anonymous_plugin_class
@@ -47,7 +47,7 @@ module Tomo
47
47
  def raise_unknown_plugin_error(error)
48
48
  UnknownPluginError.raise_with(
49
49
  error.message,
50
- name: name,
50
+ name:,
51
51
  gem_name: "#{PLUGIN_PREFIX}/#{name}".tr("/", "-"),
52
52
  known_plugins: scan_for_plugins
53
53
  )
@@ -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: path) unless File.file?(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: deploy_tasks,
55
- setup_tasks: setup_tasks,
56
- plugins_registry: 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: task_filter
59
+ task_filter:
60
60
  )
61
61
  end
62
62
 
data/lib/tomo/console.rb CHANGED
@@ -56,7 +56,7 @@ module Tomo
56
56
  private_constant :CI_VARS
57
57
 
58
58
  def ci?
59
- (env.keys & CI_VARS).any?
59
+ env.keys.intersect?(CI_VARS)
60
60
  end
61
61
 
62
62
  def assert_interactive
@@ -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: 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: user, address: address, **kwargs)
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 << ":#{port}" unless port == 22
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
- next if value == :prompt && contains_entry?(env, name)
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: 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: default_chdir, **command_opts) if attach
28
+ attach(*command, default_chdir:, **command_opts) if attach
29
29
 
30
- full_command = shell_builder.build(*command, default_chdir: 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: thread_pool, remotes: remotes)
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: host, task_filter: task_filter, task_runner: task_runner)
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?
@@ -25,7 +25,7 @@ module Tomo
25
25
 
26
26
  task_host = task.is_a?(PrivilegedTask) ? host.as_privileged : host
27
27
  remote = remotes[task_host]
28
- task_runner.run(task: task, remote: remote)
28
+ task_runner.run(task:, remote:)
29
29
  end
30
30
  end
31
31
  end
@@ -24,15 +24,15 @@ module Tomo
24
24
 
25
25
  def run(task:, remote:)
26
26
  validate_task!(task)
27
- Current.with(task: task, remote: remote) do
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: host) do
35
- conn = SSH.connect(host: host, options: ssh_options)
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.dup.extend(PrivilegedTask) if privileged
55
- execution_plan_for([task], release: :current, args: args).execute
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: tasks,
61
- hosts: hosts,
62
- task_filter: 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: plugins_registry, settings: run_settings)
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: 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: exit_status, stdout: stdout_buffer.string, stderr: stderr_buffer.string)
34
+ Result.new(exit_status:, stdout: stdout_buffer.string, stderr: stderr_buffer.string)
35
35
  end
36
36
 
37
37
  private
@@ -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: 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: host, result: result, script: script, ssh_args: ssh_args)
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: 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: 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: 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: host)
69
+ ConnectionError.raise_with(result.output, host:)
70
70
  else
71
- UnknownError.raise_with(result.output, host: 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: 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: path) unless File.file?(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: :prompt
36
+ SECRET_KEY_BASE: :generate_secret
40
37
  }
41
38
  set linked_dirs: %w[
42
39
  .yarn/cache
@@ -10,8 +10,8 @@ module Tomo
10
10
  @token = SecureRandom.hex(8)
11
11
  end
12
12
 
13
- def in_temp_dir(&block)
14
- super(token, &block)
13
+ def in_temp_dir(&)
14
+ super(token, &)
15
15
  end
16
16
 
17
17
  def run(*args, raise_on_error: true)
@@ -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: stdout, stderr: stderr, exit_status: exit_status)
17
+ Result.new(stdout:, stderr:, exit_status:)
18
18
  ]
19
19
  end
20
20
 
@@ -8,16 +8,16 @@ require "tmpdir"
8
8
  module Tomo
9
9
  module Testing
10
10
  module Local
11
- def with_tomo_gemfile(&block)
12
- Local.with_tomo_gemfile(&block)
11
+ def with_tomo_gemfile(&)
12
+ Local.with_tomo_gemfile(&)
13
13
  end
14
14
 
15
- def in_temp_dir(token=nil, &block)
16
- Local.in_temp_dir(token, &block)
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: 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, &block)
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, &block)
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, &block)
53
- return with_progress(message, &block) if interactive?
52
+ def progress(message, &)
53
+ return with_progress(message, &) if interactive?
54
54
 
55
- thread = Thread.new(&block)
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, &block)
65
+ def with_progress(message, &)
66
66
  spinner = %w[⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏].cycle
67
- thread = Thread.new(&block)
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
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.18.2".freeze
2
+ VERSION = "1.19.0".freeze
3
3
  end
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.18.2
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: 2023-12-26 00:00:00.000000000 Z
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.0'
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.3
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 ✨