tomo 1.17.0 → 1.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/lib/tomo/cli/completions.rb +1 -1
- data/lib/tomo/cli/usage.rb +1 -1
- data/lib/tomo/commands/init.rb +22 -6
- data/lib/tomo/plugin/bundler/tasks.rb +1 -0
- data/lib/tomo/plugin/bundler.rb +9 -8
- data/lib/tomo/plugin/puma/tasks.rb +1 -1
- data/lib/tomo/runtime/concurrent_ruby_thread_pool.rb +2 -2
- data/lib/tomo/runtime/explanation.rb +1 -1
- data/lib/tomo/runtime/settings_interpolation.rb +1 -1
- data/lib/tomo/shell_builder.rb +1 -1
- data/lib/tomo/templates/config.rb.erb +1 -1
- data/lib/tomo/templates/plugin.rb.erb +1 -0
- data/lib/tomo/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c340ddcd3ab2385834e3611bd577a7858cbd3f61136c19d8797d552eb15f6a4b
|
4
|
+
data.tar.gz: ab367d0bb86bd69f92255a4550f839f0bba0efbee83d67b9fd18e7117ca83973
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7659312aa674e8c3bdb26c18fc9dbbf5369a0530873eb07db16584b68dd2dd995af71bb0fe742532a4b16310554d77ff9c3a4a2c986e254c408f22834c6a6eeb
|
7
|
+
data.tar.gz: a4052c634e67510b0467b10d4f053e7993d593eb8a449abb8e660fdb8a39b794c473726f05d221515d24ba76b1d7fdf9b8baeb99dde7d8a00c6cecd0fff85f29
|
data/README.md
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
# Tomo
|
2
2
|
|
3
|
-
[![Gem Version](https://
|
4
|
-
[![
|
5
|
-
[![
|
3
|
+
[![Gem Version](https://img.shields.io/gem/v/tomo)](https://rubygems.org/gems/tomo)
|
4
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/tomo)](https://www.ruby-toolbox.com/projects/tomo)
|
5
|
+
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/mattbrictson/tomo/ci.yml)](https://github.com/mattbrictson/tomo/actions/workflows/ci.yml)
|
6
|
+
[![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/mattbrictson/tomo)](https://codeclimate.com/github/mattbrictson/tomo)
|
6
7
|
|
7
8
|
Tomo is a friendly command-line tool for deploying Rails apps.
|
8
9
|
|
data/lib/tomo/cli/completions.rb
CHANGED
@@ -45,7 +45,7 @@ module Tomo
|
|
45
45
|
|
46
46
|
# Don't complete the =value part of long switch unless the user has
|
47
47
|
# already typed at least up to the = sign.
|
48
|
-
|
48
|
+
true if cand.match?(/\A--.*=/) && !word.match?(/\A--.*=/)
|
49
49
|
end
|
50
50
|
|
51
51
|
# bash tokenizes the user's input prior to completion, and expects the
|
data/lib/tomo/cli/usage.rb
CHANGED
@@ -26,7 +26,7 @@ module Tomo
|
|
26
26
|
attr_reader :banner_proc, :options
|
27
27
|
|
28
28
|
def options_help
|
29
|
-
width = options.map
|
29
|
+
width = options.map { |opt| opt.first.length }.max
|
30
30
|
options.each_with_object([]) do |(spec, desc), help|
|
31
31
|
help << "#{Colors.yellow(spec.ljust(width))} #{desc}"
|
32
32
|
end.join("\n")
|
data/lib/tomo/commands/init.rb
CHANGED
@@ -30,11 +30,9 @@ module Tomo
|
|
30
30
|
|
31
31
|
app = args.first || current_dir_name || "default"
|
32
32
|
app = app.gsub(/([^\w-]|_)+/, "_").downcase
|
33
|
-
FileUtils.mkdir_p(".tomo/plugins")
|
34
|
-
|
35
|
-
# TODO: use a template for this file
|
36
|
-
FileUtils.touch(".tomo/plugins/#{app}.rb")
|
37
33
|
|
34
|
+
FileUtils.mkdir_p(".tomo/plugins")
|
35
|
+
File.write(".tomo/plugins/#{app}.rb", plugin_rb_template)
|
38
36
|
File.write(DEFAULT_CONFIG_PATH, config_rb_template(app))
|
39
37
|
|
40
38
|
logger.info(green("✔ Created #{DEFAULT_CONFIG_PATH}"))
|
@@ -71,10 +69,22 @@ module Tomo
|
|
71
69
|
nil
|
72
70
|
end
|
73
71
|
|
74
|
-
def
|
72
|
+
def git_main_branch
|
75
73
|
return unless File.file?(".git/config")
|
76
74
|
|
77
|
-
|
75
|
+
# If "main" or "master" is in the list of branch names, use that
|
76
|
+
branch = (%w[main master] & `git branch`.scan(/^\W*(.+)$/).flatten).first
|
77
|
+
|
78
|
+
# If not, use the current branch
|
79
|
+
if branch.nil?
|
80
|
+
branch = if `git --version`[/\d+\.\d+/].to_f >= 2.22
|
81
|
+
`git branch --show-current`.chomp
|
82
|
+
else
|
83
|
+
`git rev-parse --abbrev-ref HEAD`.chomp
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
branch.empty? ? nil : branch
|
78
88
|
rescue SystemCallError
|
79
89
|
nil
|
80
90
|
end
|
@@ -119,6 +129,12 @@ module Tomo
|
|
119
129
|
template = File.read(path)
|
120
130
|
ERB.new(template, trim_mode: "-").result(binding)
|
121
131
|
end
|
132
|
+
|
133
|
+
def plugin_rb_template
|
134
|
+
path = File.expand_path("../templates/plugin.rb.erb", __dir__)
|
135
|
+
template = File.read(path)
|
136
|
+
ERB.new(template, trim_mode: "-").result(binding)
|
137
|
+
end
|
122
138
|
end
|
123
139
|
end
|
124
140
|
end
|
data/lib/tomo/plugin/bundler.rb
CHANGED
@@ -8,13 +8,14 @@ module Tomo::Plugin
|
|
8
8
|
tasks Tomo::Plugin::Bundler::Tasks
|
9
9
|
helpers Tomo::Plugin::Bundler::Helpers
|
10
10
|
|
11
|
-
defaults bundler_config_path:
|
12
|
-
bundler_deployment:
|
13
|
-
bundler_gemfile:
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
defaults bundler_config_path: ".bundle/config",
|
12
|
+
bundler_deployment: true,
|
13
|
+
bundler_gemfile: nil,
|
14
|
+
bundler_ignore_messages: true,
|
15
|
+
bundler_jobs: nil,
|
16
|
+
bundler_path: "%{shared_path}/bundle",
|
17
|
+
bundler_retry: "3",
|
18
|
+
bundler_version: nil,
|
19
|
+
bundler_without: %w[development test]
|
19
20
|
end
|
20
21
|
end
|
@@ -17,10 +17,10 @@ module Tomo
|
|
17
17
|
@promises = []
|
18
18
|
end
|
19
19
|
|
20
|
-
def post(
|
20
|
+
def post(...)
|
21
21
|
return if failure?
|
22
22
|
|
23
|
-
promises << future_on(executor,
|
23
|
+
promises << future_on(executor, ...)
|
24
24
|
.on_rejection_using(executor) do |reason|
|
25
25
|
self.failure = reason
|
26
26
|
end
|
@@ -39,7 +39,7 @@ module Tomo
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def dump_settings(hash)
|
42
|
-
key_len = hash.keys.map
|
42
|
+
key_len = hash.keys.map { |k| k.to_s.length }.max
|
43
43
|
dump = "Settings: {\n"
|
44
44
|
hash.to_a.sort_by(&:first).each do |key, value|
|
45
45
|
justified_key = "#{key}:".ljust(key_len + 1)
|
data/lib/tomo/shell_builder.rb
CHANGED
@@ -67,7 +67,7 @@ module Tomo
|
|
67
67
|
def shell_join(*command)
|
68
68
|
return command.first.to_s if command.length == 1
|
69
69
|
|
70
|
-
command.flatten.compact.map
|
70
|
+
command.flatten.compact.map { |arg| arg.to_s.shellescape }.join(" ")
|
71
71
|
end
|
72
72
|
|
73
73
|
def cd_chdir
|
@@ -22,7 +22,7 @@ set nodenv_node_version: <%= node_version&.inspect || "nil # FIXME" %>
|
|
22
22
|
<% end -%>
|
23
23
|
set nodenv_install_yarn: <%= yarn_version ? "true" : "false" %>
|
24
24
|
set git_url: <%= git_origin_url&.inspect || "nil # FIXME" %>
|
25
|
-
set git_branch: <%=
|
25
|
+
set git_branch: <%= git_main_branch&.inspect || "nil # FIXME" %>
|
26
26
|
set git_exclusions: %w[
|
27
27
|
.tomo/
|
28
28
|
spec/
|
@@ -0,0 +1 @@
|
|
1
|
+
# https://tomo-deploy.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.
|
4
|
+
version: 1.18.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-
|
11
|
+
date: 2023-08-15 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
|
@@ -145,6 +145,7 @@ files:
|
|
145
145
|
- lib/tomo/task_api.rb
|
146
146
|
- lib/tomo/task_library.rb
|
147
147
|
- lib/tomo/templates/config.rb.erb
|
148
|
+
- lib/tomo/templates/plugin.rb.erb
|
148
149
|
- lib/tomo/testing.rb
|
149
150
|
- lib/tomo/testing/Dockerfile
|
150
151
|
- lib/tomo/testing/cli_extensions.rb
|
@@ -189,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
190
|
- !ruby/object:Gem::Version
|
190
191
|
version: '0'
|
191
192
|
requirements: []
|
192
|
-
rubygems_version: 3.4.
|
193
|
+
rubygems_version: 3.4.18
|
193
194
|
signing_key:
|
194
195
|
specification_version: 4
|
195
196
|
summary: A friendly CLI for deploying Rails apps ✨
|