tomo 1.1.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/README.md +5 -5
- data/lib/tomo/cli.rb +1 -3
- data/lib/tomo/cli/common_options.rb +4 -12
- data/lib/tomo/cli/deploy_options.rb +2 -7
- data/lib/tomo/cli/parser.rb +1 -6
- data/lib/tomo/cli/project_options.rb +1 -3
- data/lib/tomo/cli/rules.rb +4 -22
- data/lib/tomo/cli/rules/argument.rb +2 -2
- data/lib/tomo/cli/rules/switch.rb +1 -5
- data/lib/tomo/cli/rules/value_switch.rb +2 -3
- data/lib/tomo/cli/rules_evaluator.rb +3 -13
- data/lib/tomo/cli/usage.rb +1 -3
- data/lib/tomo/commands/default.rb +1 -3
- data/lib/tomo/commands/init.rb +24 -1
- data/lib/tomo/commands/run.rb +1 -3
- data/lib/tomo/configuration.rb +6 -12
- data/lib/tomo/configuration/dsl/error_formatter.rb +1 -1
- data/lib/tomo/configuration/dsl/hosts_and_settings.rb +1 -2
- data/lib/tomo/configuration/plugins_registry.rb +1 -2
- data/lib/tomo/configuration/plugins_registry/gem_resolver.rb +1 -1
- data/lib/tomo/configuration/unknown_environment_error.rb +1 -4
- data/lib/tomo/console.rb +6 -11
- data/lib/tomo/console/menu.rb +1 -2
- data/lib/tomo/host.rb +1 -2
- data/lib/tomo/paths.rb +1 -1
- data/lib/tomo/plugin/bundler/tasks.rb +2 -7
- data/lib/tomo/plugin/core/helpers.rb +1 -1
- data/lib/tomo/plugin/core/tasks.rb +3 -12
- data/lib/tomo/plugin/env/tasks.rb +32 -10
- data/lib/tomo/plugin/git.rb +1 -4
- data/lib/tomo/plugin/git/tasks.rb +4 -14
- data/lib/tomo/plugin/nodenv/tasks.rb +1 -3
- data/lib/tomo/plugin/puma.rb +0 -3
- data/lib/tomo/plugin/puma/tasks.rb +6 -15
- data/lib/tomo/plugin/rails/helpers.rb +1 -1
- data/lib/tomo/plugin/rails/tasks.rb +6 -4
- data/lib/tomo/plugin/testing.rb +1 -3
- data/lib/tomo/remote.rb +1 -3
- data/lib/tomo/runtime.rb +3 -6
- data/lib/tomo/runtime/concurrent_ruby_thread_pool.rb +1 -4
- data/lib/tomo/runtime/execution_plan.rb +1 -4
- data/lib/tomo/runtime/explanation.rb +1 -7
- data/lib/tomo/runtime/settings_required_error.rb +1 -3
- data/lib/tomo/runtime/task_runner.rb +1 -5
- data/lib/tomo/runtime/unknown_task_error.rb +1 -4
- data/lib/tomo/script.rb +1 -5
- data/lib/tomo/shell_builder.rb +5 -10
- data/lib/tomo/ssh/child_process.rb +2 -7
- data/lib/tomo/ssh/connection.rb +5 -18
- data/lib/tomo/ssh/connection_validator.rb +1 -4
- data/lib/tomo/ssh/executable_error.rb +1 -2
- data/lib/tomo/ssh/options.rb +2 -5
- data/lib/tomo/task_api.rb +4 -15
- data/lib/tomo/templates/config.rb.erb +7 -1
- data/lib/tomo/testing/cli_extensions.rb +1 -1
- data/lib/tomo/testing/connection.rb +1 -6
- data/lib/tomo/testing/docker_image.rb +2 -8
- data/lib/tomo/testing/local.rb +1 -3
- data/lib/tomo/testing/ubuntu_setup.sh +1 -2
- data/lib/tomo/version.rb +1 -1
- metadata +8 -135
- data/lib/tomo/configuration/plugin_resolver.rb +0 -63
@@ -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.chars.last.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
|