tomo 1.18.0 → 1.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +48 -46
- data/lib/tomo/cli.rb +8 -3
- data/lib/tomo/commands/default.rb +1 -1
- data/lib/tomo/commands/deploy.rb +1 -1
- data/lib/tomo/commands/run.rb +1 -1
- data/lib/tomo/commands/setup.rb +1 -1
- data/lib/tomo/configuration/dsl/error_formatter.rb +1 -1
- data/lib/tomo/error.rb +1 -1
- data/lib/tomo/host.rb +1 -1
- data/lib/tomo/plugin/core/helpers.rb +4 -3
- data/lib/tomo/plugin/env/tasks.rb +1 -1
- data/lib/tomo/remote.rb +1 -1
- data/lib/tomo/runtime/no_tasks_error.rb +1 -1
- data/lib/tomo/templates/plugin.rb.erb +1 -1
- 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: 5e009fc663164b91e6dd0ad03333d704014775100f9b0aa222f691f6048f2b72
|
4
|
+
data.tar.gz: bb0943cdba7ef40ab5e2ab826826cf189e1ceec7f3ecaf6f55307117bb95d85d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 636abb08a843308c021677869941769fb4cf0f52143a54b7d8cb9132ae99c5b46a26731b9af196715f36f8b1b7cc513278feb1edfdc8f3d686a71b06b1abf547
|
7
|
+
data.tar.gz: 4f63cb3204cc73a707194daaffc9365e52e33bc5abb3131546177f86563783c3b4f08e24c9f1f65a8da4e686ba6fc92387560708b21ff18076f0228e814948f6
|
data/README.md
CHANGED
@@ -14,7 +14,7 @@ Tomo is a friendly command-line tool for deploying Rails apps.
|
|
14
14
|
📚 Quality documentation<br/>
|
15
15
|
🔬 Minimal dependencies<br/>
|
16
16
|
|
17
|
-
[→ See how tomo compares to other Ruby deployment tools like Capistrano and Mina.](https://tomo
|
17
|
+
[→ See how tomo compares to other Ruby deployment tools like Capistrano and Mina.](https://tomo.mattbrictson.com/comparisons/)
|
18
18
|
|
19
19
|
---
|
20
20
|
|
@@ -22,6 +22,7 @@ Tomo is a friendly command-line tool for deploying Rails apps.
|
|
22
22
|
- [Usage](#usage)
|
23
23
|
- [Extending tomo](#extending-tomo)
|
24
24
|
- [Tutorials](#tutorials)
|
25
|
+
- [Blog posts](#blog-posts)
|
25
26
|
- [Reference documentation](#reference-documentation)
|
26
27
|
- [FAQ](#faq)
|
27
28
|
- [Support](#support)
|
@@ -87,8 +88,8 @@ end
|
|
87
88
|
|
88
89
|
#### Next steps
|
89
90
|
|
90
|
-
[→ The reference docs have a complete guide to tomo configuration.](https://tomo
|
91
|
-
[→ Check out the **Deploying Rails From Scratch** tutorial for a step-by-step guide to using tomo with a real app.](https://tomo
|
91
|
+
[→ The reference docs have a complete guide to tomo configuration.](https://tomo.mattbrictson.com/configuration/)<br>
|
92
|
+
[→ Check out the **Deploying Rails From Scratch** tutorial for a step-by-step guide to using tomo with a real app.](https://tomo.mattbrictson.com/tutorials/deploying-rails-from-scratch/)
|
92
93
|
|
93
94
|
## Usage
|
94
95
|
|
@@ -112,25 +113,24 @@ Out of the box, tomo will:
|
|
112
113
|
- Create all necessary deployment directories
|
113
114
|
- Create the Rails database, load the schema, and insert seed data
|
114
115
|
|
115
|
-
[→ Here is the default list of tasks invoked by the setup command.](https://tomo
|
116
|
-
[→ The `tomo setup` section of the reference docs explains supported command-line options.](https://tomo
|
116
|
+
[→ Here is the default list of tasks invoked by the setup command.](https://tomo.mattbrictson.com/configuration#setupblock)<br>
|
117
|
+
[→ The `tomo setup` section of the reference docs explains supported command-line options.](https://tomo.mattbrictson.com/commands/setup/)
|
117
118
|
|
118
119
|
### `tomo deploy`
|
119
120
|
|
120
121
|
Whereas `tomo setup` is typically run once, you can use `tomo deploy` every time you want to deploy a new version of your app. The deploy command will sequentially run the `deploy` list of tasks specified in `.tomo/config.rb`. You can customize this list to meet the needs of your app. By default, tomo runs these tasks:
|
121
122
|
|
122
|
-
1. Create a release (using the [git:create_release](https://tomo
|
123
|
-
2. Build the project (e.g. [bundler:install](https://tomo
|
124
|
-
3. Migrate data to the meet the requirements of the new release (e.g. [rails:db_migrate](https://tomo
|
125
|
-
4. Make the new release the "current" one ([core:symlink_current](https://tomo
|
126
|
-
5. Restart the app to use the new current release (e.g. [puma:restart](https://tomo
|
127
|
-
6. Perform any cleanup (e.g. [bundler:clean](https://tomo
|
123
|
+
1. Create a release (using the [git:create_release](https://tomo.mattbrictson.com/plugins/git#gitcreate_release) task)
|
124
|
+
2. Build the project (e.g. [bundler:install](https://tomo.mattbrictson.com/plugins/bundler#bundlerinstall), [rails:assets_precompile](https://tomo.mattbrictson.com/plugins/rails#railsassets_precompile))
|
125
|
+
3. Migrate data to the meet the requirements of the new release (e.g. [rails:db_migrate](https://tomo.mattbrictson.com/plugins/rails#railsdb_migrate))
|
126
|
+
4. Make the new release the "current" one ([core:symlink_current](https://tomo.mattbrictson.com/plugins/core#coresymlink_current))
|
127
|
+
5. Restart the app to use the new current release (e.g. [puma:restart](https://tomo.mattbrictson.com/plugins/puma#pumarestart))
|
128
|
+
6. Perform any cleanup (e.g. [bundler:clean](https://tomo.mattbrictson.com/plugins/bundler#bundlerclean))
|
128
129
|
|
129
130
|
> 💡 **Protip:** you can abbreviate tomo commands, like `tomo d` for `tomo deploy` or `tomo s` for `tomo setup`.
|
130
131
|
|
131
|
-
[→ Here is the default list of tasks invoked by the deploy command.](https://tomo
|
132
|
-
[→ The `tomo deploy` section of the reference docs explains supported command-line options, like `--dry-run`.](https://tomo
|
133
|
-
|
132
|
+
[→ Here is the default list of tasks invoked by the deploy command.](https://tomo.mattbrictson.com/configuration#deployblock)<br>
|
133
|
+
[→ The `tomo deploy` section of the reference docs explains supported command-line options, like `--dry-run`.](https://tomo.mattbrictson.com/commands/deploy/)
|
134
134
|
|
135
135
|
### `tomo run [TASK]`
|
136
136
|
|
@@ -144,9 +144,7 @@ One of the built-in Rails tasks is `rails:console`, which brings up a fully-inte
|
|
144
144
|
|
145
145
|
> 💡 **Protip:** you can shorten this as `tomo rails:console` (the `run` command is implied).
|
146
146
|
|
147
|
-
[→ The `tomo run` section of the reference docs explains supported command-line options and has more examples.](https://tomo
|
148
|
-
|
149
|
-
|
147
|
+
[→ The `tomo run` section of the reference docs explains supported command-line options and has more examples.](https://tomo.mattbrictson.com/commands/run/)
|
150
148
|
|
151
149
|
## Extending tomo
|
152
150
|
|
@@ -172,43 +170,47 @@ And run it!
|
|
172
170
|
|
173
171
|
![$ tomo run my-plugin:hello](./readme_images/tomo-run-hello.png)
|
174
172
|
|
175
|
-
[→ The **Writing Custom Tasks** tutorial has an in-depth explanation of how plugins work.](https://tomo
|
176
|
-
[→ The **TaskLibrary** API is tomo's DSL for building tasks.](https://tomo
|
177
|
-
[→ The **Publishing a Plugin** tutorial explains how to package your plugin as a Ruby gem to share it with the community.](https://tomo
|
173
|
+
[→ The **Writing Custom Tasks** tutorial has an in-depth explanation of how plugins work.](https://tomo.mattbrictson.com/tutorials/writing-custom-tasks/)<br>
|
174
|
+
[→ The **TaskLibrary** API is tomo's DSL for building tasks.](https://tomo.mattbrictson.com/api/TaskLibrary/)<br>
|
175
|
+
[→ The **Publishing a Plugin** tutorial explains how to package your plugin as a Ruby gem to share it with the community.](https://tomo.mattbrictson.com/tutorials/publishing-a-plugin/)
|
178
176
|
|
179
177
|
## Tutorials
|
180
178
|
|
181
|
-
- [Deploying Rails From Scratch](https://tomo
|
182
|
-
- [Writing Custom Tasks](https://tomo
|
183
|
-
- [Publishing a Plugin](https://tomo
|
179
|
+
- [Deploying Rails From Scratch](https://tomo.mattbrictson.com/tutorials/deploying-rails-from-scratch/)
|
180
|
+
- [Writing Custom Tasks](https://tomo.mattbrictson.com/tutorials/writing-custom-tasks/)
|
181
|
+
- [Publishing a Plugin](https://tomo.mattbrictson.com/tutorials/publishing-a-plugin/)
|
182
|
+
|
183
|
+
## Blog posts
|
184
|
+
|
185
|
+
- [Automate Rails deployments with GitHub Actions](https://mattbrictson.com/blog/deploy-rails-with-github-actions)
|
184
186
|
|
185
187
|
## Reference documentation
|
186
188
|
|
187
|
-
- [Configuration](https://tomo
|
189
|
+
- [Configuration](https://tomo.mattbrictson.com/configuration/)
|
188
190
|
- Commands
|
189
|
-
- [init](https://tomo
|
190
|
-
- [setup](https://tomo
|
191
|
-
- [deploy](https://tomo
|
192
|
-
- [run](https://tomo
|
193
|
-
- [tasks](https://tomo
|
191
|
+
- [init](https://tomo.mattbrictson.com/commands/init/)
|
192
|
+
- [setup](https://tomo.mattbrictson.com/commands/setup/)
|
193
|
+
- [deploy](https://tomo.mattbrictson.com/commands/deploy/)
|
194
|
+
- [run](https://tomo.mattbrictson.com/commands/run/)
|
195
|
+
- [tasks](https://tomo.mattbrictson.com/commands/tasks/)
|
194
196
|
- Plugins
|
195
|
-
- [core](https://tomo
|
196
|
-
- [bundler](https://tomo
|
197
|
-
- [env](https://tomo
|
198
|
-
- [git](https://tomo
|
199
|
-
- [nodenv](https://tomo
|
200
|
-
- [puma](https://tomo
|
201
|
-
- [rails](https://tomo
|
202
|
-
- [rbenv](https://tomo
|
197
|
+
- [core](https://tomo.mattbrictson.com/plugins/core/)
|
198
|
+
- [bundler](https://tomo.mattbrictson.com/plugins/bundler/)
|
199
|
+
- [env](https://tomo.mattbrictson.com/plugins/env/)
|
200
|
+
- [git](https://tomo.mattbrictson.com/plugins/git/)
|
201
|
+
- [nodenv](https://tomo.mattbrictson.com/plugins/nodenv/)
|
202
|
+
- [puma](https://tomo.mattbrictson.com/plugins/puma/)
|
203
|
+
- [rails](https://tomo.mattbrictson.com/plugins/rails/)
|
204
|
+
- [rbenv](https://tomo.mattbrictson.com/plugins/rbenv/)
|
203
205
|
- API
|
204
|
-
- [Host](https://tomo
|
205
|
-
- [Logger](https://tomo
|
206
|
-
- [Paths](https://tomo
|
207
|
-
- [PluginDSL](https://tomo
|
208
|
-
- [Remote](https://tomo
|
209
|
-
- [Result](https://tomo
|
210
|
-
- [TaskLibrary](https://tomo
|
211
|
-
- [Testing::MockPluginTester](https://tomo
|
206
|
+
- [Host](https://tomo.mattbrictson.com/api/Host/)
|
207
|
+
- [Logger](https://tomo.mattbrictson.com/api/Logger/)
|
208
|
+
- [Paths](https://tomo.mattbrictson.com/api/Paths/)
|
209
|
+
- [PluginDSL](https://tomo.mattbrictson.com/api/PluginDSL/)
|
210
|
+
- [Remote](https://tomo.mattbrictson.com/api/Remote/)
|
211
|
+
- [Result](https://tomo.mattbrictson.com/api/Result/)
|
212
|
+
- [TaskLibrary](https://tomo.mattbrictson.com/api/TaskLibrary/)
|
213
|
+
- [Testing::MockPluginTester](https://tomo.mattbrictson.com/api/testing/MockPluginTester/)
|
212
214
|
|
213
215
|
## FAQ
|
214
216
|
|
@@ -225,7 +227,7 @@ set ssh_strict_host_key_checking: true # or false
|
|
225
227
|
|
226
228
|
Tomo relies on the host user's bash profile for various things, like setting environment variables and initializing rbenv and nodenv. This makes it impractical to deploy multiple apps to a single host using the same deploy user.
|
227
229
|
|
228
|
-
The solution is to create multiple users on the remote host, and then configure a different user for deploying each app. That way each user can have its own distinct environment variables and you can easily configure each app differently without risking conflicts. Refer to the [tomo Rails tutorial](https://tomo
|
230
|
+
The solution is to create multiple users on the remote host, and then configure a different user for deploying each app. That way each user can have its own distinct environment variables and you can easily configure each app differently without risking conflicts. Refer to the [tomo Rails tutorial](https://tomo.mattbrictson.com/tutorials/deploying-rails-from-scratch/#set-up-a-deployer-user) for instructions on creating a deploy user.
|
229
231
|
|
230
232
|
E.g. app1 would be configured to deploy as:
|
231
233
|
|
data/lib/tomo/cli.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require "abbrev"
|
2
|
-
|
3
1
|
module Tomo
|
4
2
|
class CLI
|
5
3
|
autoload :Command, "tomo/cli/command"
|
@@ -63,7 +61,7 @@ module Tomo
|
|
63
61
|
commands = COMMANDS.merge(COMMAND_ALIASES)
|
64
62
|
|
65
63
|
command_name = argv.first unless Completions.active? && argv.length == 1
|
66
|
-
command_name =
|
64
|
+
command_name = expand_abbrev(commands.keys, command_name)
|
67
65
|
argv.shift if command_name
|
68
66
|
|
69
67
|
command_name = "run" if command_name.nil? && task_format?(argv.first)
|
@@ -71,6 +69,13 @@ module Tomo
|
|
71
69
|
[command, command_name]
|
72
70
|
end
|
73
71
|
|
72
|
+
def expand_abbrev(names, abbrev)
|
73
|
+
return nil if abbrev.to_s.empty?
|
74
|
+
|
75
|
+
matches = names.select { |name| name.start_with?(abbrev) }
|
76
|
+
matches.first if matches.one?
|
77
|
+
end
|
78
|
+
|
74
79
|
def task_format?(arg)
|
75
80
|
arg.to_s.match?(/\A\S+:\S*\z/)
|
76
81
|
end
|
data/lib/tomo/commands/deploy.rb
CHANGED
data/lib/tomo/commands/run.rb
CHANGED
data/lib/tomo/commands/setup.rb
CHANGED
@@ -35,7 +35,7 @@ module Tomo
|
|
35
35
|
#{highlighted_lines}
|
36
36
|
#{Colors.red([self.class, message].join(': '))}
|
37
37
|
|
38
|
-
Visit #{Colors.blue('https://tomo
|
38
|
+
Visit #{Colors.blue('https://tomo.mattbrictson.com/configuration')} for syntax reference.
|
39
39
|
#{trace_hint}
|
40
40
|
ERROR
|
41
41
|
end
|
data/lib/tomo/error.rb
CHANGED
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(
|
13
|
+
new(user: user, address: address, **kwargs)
|
14
14
|
end
|
15
15
|
|
16
16
|
def initialize(address:, port: nil, log_prefix: nil, roles: nil, user: nil, privileged_user: "root")
|
@@ -3,7 +3,7 @@ require "shellwords"
|
|
3
3
|
module Tomo::Plugin::Core
|
4
4
|
module Helpers
|
5
5
|
def capture(*command, **run_opts)
|
6
|
-
result = run(*command,
|
6
|
+
result = run(*command, silent: true, **run_opts)
|
7
7
|
result.stdout
|
8
8
|
end
|
9
9
|
|
@@ -18,7 +18,8 @@ module Tomo::Plugin::Core
|
|
18
18
|
message = "Writing #{text.bytesize} bytes to #{to}"
|
19
19
|
run(
|
20
20
|
"echo -n #{text.shellescape} #{append ? '>>' : '>'} #{to.shellescape}",
|
21
|
-
|
21
|
+
echo: message,
|
22
|
+
**run_opts
|
22
23
|
)
|
23
24
|
end
|
24
25
|
|
@@ -43,7 +44,7 @@ module Tomo::Plugin::Core
|
|
43
44
|
end
|
44
45
|
|
45
46
|
def command_available?(command_name, **run_opts)
|
46
|
-
run?("which", command_name,
|
47
|
+
run?("which", command_name, silent: true, **run_opts)
|
47
48
|
end
|
48
49
|
|
49
50
|
def file?(file, **run_opts)
|
@@ -129,7 +129,7 @@ module Tomo::Plugin::Env
|
|
129
129
|
user@host. To deploy multiple applications to the same host, use a separate
|
130
130
|
deployer user per app. Refer to the tomo FAQ for details:
|
131
131
|
|
132
|
-
https://tomo
|
132
|
+
https://tomo.mattbrictson.com/#faq
|
133
133
|
|
134
134
|
You may be receiving this message in error if you recently renamed or
|
135
135
|
reconfigured your application. In this case, remove the references to the
|
data/lib/tomo/remote.rb
CHANGED
@@ -21,7 +21,7 @@ module Tomo
|
|
21
21
|
|
22
22
|
def attach(*command, default_chdir: nil, **command_opts)
|
23
23
|
full_command = shell_builder.build(*command, default_chdir: default_chdir)
|
24
|
-
ssh.ssh_exec(Script.new(full_command,
|
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)
|
@@ -1 +1 @@
|
|
1
|
-
# https://tomo
|
1
|
+
# https://tomo.mattbrictson.com/tutorials/writing-custom-tasks/
|
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.18.
|
4
|
+
version: 1.18.2
|
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-
|
11
|
+
date: 2023-12-26 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
|
@@ -173,7 +173,7 @@ metadata:
|
|
173
173
|
changelog_uri: https://github.com/mattbrictson/tomo/releases
|
174
174
|
source_code_uri: https://github.com/mattbrictson/tomo
|
175
175
|
homepage_uri: https://github.com/mattbrictson/tomo
|
176
|
-
documentation_uri: https://tomo
|
176
|
+
documentation_uri: https://tomo.mattbrictson.com/
|
177
177
|
rubygems_mfa_required: 'true'
|
178
178
|
post_install_message:
|
179
179
|
rdoc_options: []
|
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
190
|
- !ruby/object:Gem::Version
|
191
191
|
version: '0'
|
192
192
|
requirements: []
|
193
|
-
rubygems_version: 3.
|
193
|
+
rubygems_version: 3.5.3
|
194
194
|
signing_key:
|
195
195
|
specification_version: 4
|
196
196
|
summary: A friendly CLI for deploying Rails apps ✨
|