tomo 1.1.1 → 1.4.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 +4 -4
- data/README.md +47 -29
- 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 +28 -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 +31 -9
- 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/tasks.rb +6 -4
- data/lib/tomo/plugin/rbenv/tasks.rb +16 -2
- 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 +5 -8
- 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 +9 -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 +5 -11
- 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
data/lib/tomo/task_api.rb
CHANGED
@@ -9,11 +9,7 @@ module Tomo
|
|
9
9
|
def_delegators :context, :paths, :settings
|
10
10
|
|
11
11
|
def die(reason)
|
12
|
-
Runtime::TaskAbortedError.raise_with(
|
13
|
-
reason,
|
14
|
-
task: context.current_task,
|
15
|
-
host: remote.host
|
16
|
-
)
|
12
|
+
Runtime::TaskAbortedError.raise_with(reason, task: context.current_task, host: remote.host)
|
17
13
|
end
|
18
14
|
|
19
15
|
def dry_run?
|
@@ -26,13 +22,9 @@ module Tomo
|
|
26
22
|
|
27
23
|
def merge_template(path)
|
28
24
|
working_path = paths.tomo_config_file&.dirname
|
29
|
-
if working_path && path.start_with?(".")
|
30
|
-
path = File.expand_path(path, working_path)
|
31
|
-
end
|
25
|
+
path = File.expand_path(path, working_path) if working_path && path.start_with?(".")
|
32
26
|
|
33
|
-
unless File.file?(path)
|
34
|
-
Runtime::TemplateNotFoundError.raise_with(path: path)
|
35
|
-
end
|
27
|
+
Runtime::TemplateNotFoundError.raise_with(path: path) unless File.file?(path)
|
36
28
|
template = IO.read(path)
|
37
29
|
ERB.new(template).result(binding)
|
38
30
|
end
|
@@ -49,10 +41,7 @@ module Tomo
|
|
49
41
|
missing = names.flatten.select { |sett| settings[sett].nil? }
|
50
42
|
return if missing.empty?
|
51
43
|
|
52
|
-
Runtime::SettingsRequiredError.raise_with(
|
53
|
-
settings: missing,
|
54
|
-
task: context.current_task
|
55
|
-
)
|
44
|
+
Runtime::SettingsRequiredError.raise_with(settings: missing, task: context.current_task)
|
56
45
|
end
|
57
46
|
alias require_settings require_setting
|
58
47
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
<% if rubocop? -%>
|
2
|
+
# rubocop:disable Style/FormatStringToken
|
3
|
+
<% end -%>
|
1
4
|
plugin "git"
|
2
5
|
plugin "env"
|
3
6
|
plugin "bundler"
|
@@ -11,11 +14,13 @@ host "user@hostname.or.ip.address"
|
|
11
14
|
|
12
15
|
set application: <%= app.inspect %>
|
13
16
|
set deploy_to: "/var/www/%{application}"
|
17
|
+
<% unless ruby_version_file? -%>
|
14
18
|
set rbenv_ruby_version: <%= RUBY_VERSION.inspect %>
|
19
|
+
<% end -%>
|
15
20
|
set nodenv_node_version: <%= node_version&.inspect || "nil # FIXME" %>
|
16
21
|
set nodenv_yarn_version: <%= yarn_version.inspect %>
|
17
22
|
set git_url: <%= git_origin_url&.inspect || "nil # FIXME" %>
|
18
|
-
set git_branch: "
|
23
|
+
set git_branch: <%= git_branch&.inspect || "nil # FIXME" %>
|
19
24
|
set git_exclusions: %w[
|
20
25
|
.tomo/
|
21
26
|
spec/
|
@@ -72,3 +77,6 @@ deploy do
|
|
72
77
|
run "bundler:clean"
|
73
78
|
run "core:log_revision"
|
74
79
|
end
|
80
|
+
<% if rubocop? -%>
|
81
|
+
# rubocop:enable Style/FormatStringToken
|
82
|
+
<% end -%>
|
@@ -2,12 +2,7 @@ module Tomo
|
|
2
2
|
module Testing
|
3
3
|
class Connection < Tomo::SSH::Connection
|
4
4
|
def initialize(host, options)
|
5
|
-
super(
|
6
|
-
host,
|
7
|
-
options,
|
8
|
-
exec_proc: proc { raise MockedExecError },
|
9
|
-
child_proc: method(:mock_child_process)
|
10
|
-
)
|
5
|
+
super(host, options, exec_proc: proc { raise MockedExecError }, child_proc: method(:mock_child_process))
|
11
6
|
end
|
12
7
|
|
13
8
|
def ssh_exec(script)
|
@@ -74,21 +74,15 @@ module Tomo
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def set_up_private_key
|
77
|
-
@private_key_path = File.join(
|
78
|
-
|
79
|
-
"tomo_test_ed25519_#{SecureRandom.hex(8)}"
|
80
|
-
)
|
81
|
-
FileUtils.cp(
|
82
|
-
File.expand_path("tomo_test_ed25519", __dir__),
|
83
|
-
private_key_path
|
84
|
-
)
|
77
|
+
@private_key_path = File.join(Dir.tmpdir, "tomo_test_ed25519_#{SecureRandom.hex(8)}")
|
78
|
+
FileUtils.cp(File.expand_path("tomo_test_ed25519", __dir__), private_key_path)
|
85
79
|
FileUtils.chmod(0o600, private_key_path)
|
86
80
|
end
|
87
81
|
|
88
82
|
def build_image
|
89
|
-
|
90
|
-
|
91
|
-
|
83
|
+
tag = "tomo_testing:latest"
|
84
|
+
Local.capture("docker build --tag #{tag} #{build_dir}")
|
85
|
+
tag
|
92
86
|
end
|
93
87
|
|
94
88
|
def start_container
|
data/lib/tomo/testing/local.rb
CHANGED
@@ -41,9 +41,7 @@ module Tomo
|
|
41
41
|
progress(command_str) do
|
42
42
|
output, status = Open3.capture2e(*command)
|
43
43
|
|
44
|
-
if raise_on_error && !status.success?
|
45
|
-
raise "Command failed: #{command_str}\n#{output}"
|
46
|
-
end
|
44
|
+
raise "Command failed: #{command_str}\n#{output}" if raise_on_error && !status.success?
|
47
45
|
|
48
46
|
output
|
49
47
|
end
|
@@ -17,8 +17,7 @@ touch /var/lib/systemd/linger/deployer
|
|
17
17
|
|
18
18
|
# Packages needed for ruby, etc.
|
19
19
|
apt-get -y update
|
20
|
-
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev
|
21
|
-
git-core curl locales libsqlite3-dev
|
20
|
+
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev git-core curl locales libsqlite3-dev
|
22
21
|
|
23
22
|
apt-get -y install tzdata \
|
24
23
|
-o DPkg::options::="--force-confdef" \
|
data/lib/tomo/version.rb
CHANGED
metadata
CHANGED
@@ -1,141 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brictson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: bundler
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '2.0'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '2.0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: concurrent-ruby
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '1.1'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '1.1'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: minitest
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '5.11'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '5.11'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: minitest-ci
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '3.4'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '3.4'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: minitest-reporters
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.3'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.3'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rake
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '13.0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '13.0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rubocop
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - '='
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.82.0
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - '='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.82.0
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: rubocop-minitest
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - '='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: 0.9.0
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - '='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: 0.9.0
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop-performance
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - '='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: 1.5.2
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - '='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: 1.5.2
|
11
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
139
13
|
description: Tomo is a feature-rich deployment tool that contains everything you need
|
140
14
|
to deploy a basic Rails app out of the box. It has an opinionated, production-tested
|
141
15
|
set of defaults, but is easily extensible via a well-documented plugin system. Unlike
|
@@ -191,7 +65,6 @@ files:
|
|
191
65
|
- lib/tomo/configuration/environment.rb
|
192
66
|
- lib/tomo/configuration/glob.rb
|
193
67
|
- lib/tomo/configuration/plugin_file_not_found_error.rb
|
194
|
-
- lib/tomo/configuration/plugin_resolver.rb
|
195
68
|
- lib/tomo/configuration/plugins_registry.rb
|
196
69
|
- lib/tomo/configuration/plugins_registry/file_resolver.rb
|
197
70
|
- lib/tomo/configuration/plugins_registry/gem_resolver.rb
|
@@ -298,9 +171,9 @@ metadata:
|
|
298
171
|
bug_tracker_uri: https://github.com/mattbrictson/tomo/issues
|
299
172
|
changelog_uri: https://github.com/mattbrictson/tomo/releases
|
300
173
|
source_code_uri: https://github.com/mattbrictson/tomo
|
301
|
-
homepage_uri: https://
|
174
|
+
homepage_uri: https://github.com/mattbrictson/tomo
|
302
175
|
documentation_uri: https://tomo-deploy.com/
|
303
|
-
post_install_message:
|
176
|
+
post_install_message:
|
304
177
|
rdoc_options: []
|
305
178
|
require_paths:
|
306
179
|
- lib
|
@@ -315,8 +188,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
315
188
|
- !ruby/object:Gem::Version
|
316
189
|
version: '0'
|
317
190
|
requirements: []
|
318
|
-
rubygems_version: 3.1.
|
319
|
-
signing_key:
|
191
|
+
rubygems_version: 3.1.4
|
192
|
+
signing_key:
|
320
193
|
specification_version: 4
|
321
194
|
summary: A friendly CLI for deploying Rails apps ✨
|
322
195
|
test_files: []
|
@@ -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
|