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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '098582c6866a637c63527b1bf1fecd347686cf1472ddf4e93b11002180b4e0c3'
4
- data.tar.gz: 74ea3479cd90f9d3cf038d7b8e6cffa0200a98a51562798ba1b852ca66866f4e
3
+ metadata.gz: f92e6f11a186cd036164b26a2fad74f9afe3d9eec791c46c75c6aaf3040eabe7
4
+ data.tar.gz: 528ad7dcf0c63df6b887d29bd396475c02df4aef06fb2bae74ea1830a6818127
5
5
  SHA512:
6
- metadata.gz: 7ddd09600b3eae9914c7641b08f169f7f802297cf76170b7faffc0d0cb75cd0af22071c5e8d358c244464efe00672d4573054f30a2947b258aaef3af98e9ed74
7
- data.tar.gz: 78c334db75ce535dd00c434fb3a4a927af4369d7f747cc3776334146c9c41bbae785ddb15e4ec42bdea59a66223a3836644f6bf0ec74e42f57c6de85fc822025
6
+ metadata.gz: 0f751e1f2bf4684b886016d67e22fd909219e4e1787585614daa1b323562940c0042d56fa16ea99c602e70cbede58d3828dcfd51e0618e790175fd500567e4a6
7
+ data.tar.gz: 4e6b438a4b13ccc464591b2d43e980f2f0dd5b221e48106c335aa27c17729ba02f36553ac72f1170e0dcc22ad6aea5663faeb82dae70ce437a7f09af08cb4630
@@ -20,7 +20,7 @@ module Tomo
20
20
  class << self
21
21
  attr_accessor :show_backtrace
22
22
 
23
- def exit(status=true)
23
+ def exit(status=true) # rubocop:disable Style/OptionalBooleanParameter
24
24
  Process.exit(status)
25
25
  end
26
26
  end
@@ -1,6 +1,6 @@
1
1
  class Tomo::CLI::Rules
2
2
  class Argument
3
- def initialize(label, multiple: false, required: false, values_proc:)
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, state:)
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, callback_proc:, &convert_proc)
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
@@ -28,7 +28,7 @@ class Tomo::CLI::Rules
28
28
  state.parsed_option(key, value)
29
29
  end
30
30
 
31
- def candidates(switch=nil, literal: false, state:)
31
+ def candidates(switch=nil, state:, literal: false)
32
32
  return [] if literal
33
33
 
34
34
  vals = values(state)
@@ -90,7 +90,7 @@ module Tomo
90
90
  plugins_registry = PluginsRegistry.new
91
91
 
92
92
  (["core"] + plugins.uniq).each do |plug|
93
- if %w[. /].include?(plug[0])
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
@@ -50,7 +50,7 @@ module Tomo
50
50
  HINT
51
51
  end
52
52
 
53
- def highlighted_lines
53
+ def highlighted_lines # rubocop:disable Metrics/AbcSize
54
54
  first = [1, error_line_no - 1].max
55
55
  last = [dsl_lines.length, error_line_no + 1].min
56
56
  width = last.to_s.length
@@ -20,7 +20,7 @@ module Tomo
20
20
  path(:"#{method}_path")
21
21
  end
22
22
 
23
- def respond_to_missing?(method, include_private=false)
23
+ def respond_to_missing?(method, include_private)
24
24
  setting?(method) || super
25
25
  end
26
26
 
@@ -12,7 +12,7 @@ module Tomo::Plugin::Core
12
12
  result.success?
13
13
  end
14
14
 
15
- def write(text: nil, template: nil, to:, append: false, **run_opts)
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
@@ -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=false)
53
+ def build_args(script, verbose: false)
54
54
  options.build_args(host, script, control_path, verbose)
55
55
  end
56
56
 
@@ -1,7 +1,7 @@
1
1
  module Tomo
2
2
  module Testing
3
3
  module CLIExtensions
4
- def exit(status=true)
4
+ def exit(status=true) # rubocop:disable Style/OptionalBooleanParameter
5
5
  raise MockedExitError, status
6
6
  end
7
7
  end
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.3.0".freeze
2
+ VERSION = "1.3.1".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.3.0
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-08-08 00:00:00.000000000 Z
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