tomo 1.7.0 → 1.10.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 +0 -1
- data/lib/tomo/cli/parser.rb +1 -1
- data/lib/tomo/commands/init.rb +4 -15
- data/lib/tomo/configuration/plugins_registry/file_resolver.rb +1 -1
- data/lib/tomo/configuration/role_based_task_filter.rb +2 -2
- data/lib/tomo/configuration/unknown_plugin_error.rb +1 -1
- data/lib/tomo/configuration.rb +1 -1
- data/lib/tomo/console/menu.rb +1 -1
- data/lib/tomo/error/suggestions.rb +7 -9
- data/lib/tomo/error.rb +1 -2
- data/lib/tomo/plugin/nodenv/tasks.rb +8 -5
- data/lib/tomo/plugin/nodenv.rb +1 -0
- data/lib/tomo/plugin/rbenv/tasks.rb +1 -1
- data/lib/tomo/runtime/current.rb +1 -1
- data/lib/tomo/runtime/settings_interpolation.rb +1 -1
- data/lib/tomo/task_api.rb +1 -1
- data/lib/tomo/templates/config.rb.erb +3 -1
- data/lib/tomo/testing/docker_image.rb +1 -3
- data/lib/tomo/testing/systemctl.rb +3 -3
- 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: 05ddcb1e5cb7af61721270c94830cd0140881d4fd85ba97078994cafe8edb3ee
|
4
|
+
data.tar.gz: 6df6ad8b97fd3121b9becaa94682fd5e1c4fe8831903c0aafbfa5d1e91f9075b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a618b9ba648758197a7f593b89594f24d75435ddebf624c5e9bacdc573966e41e9161c833e1897610da79d385881f3d8c0f7bad8ac0957c02accfe00d5f757a8
|
7
|
+
data.tar.gz: 0f007ba2ac69941daca0c619adcaba2b4d97af924781c6fc29cff7a368a2206572f4fc93f1bf2f103accdab694c7427ec2d5d1b87b05277f8853b0c39c75961c
|
data/README.md
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
# Tomo
|
2
2
|
|
3
3
|
[](https://rubygems.org/gems/tomo)
|
4
|
-
[](https://travis-ci.com/github/mattbrictson/tomo)
|
5
4
|
[](https://app.circleci.com/pipelines/github/mattbrictson/tomo?branch=main)
|
6
5
|
[](https://codeclimate.com/github/mattbrictson/tomo)
|
7
6
|
|
data/lib/tomo/cli/parser.rb
CHANGED
data/lib/tomo/commands/init.rb
CHANGED
@@ -35,7 +35,7 @@ module Tomo
|
|
35
35
|
# TODO: use a template for this file
|
36
36
|
FileUtils.touch(".tomo/plugins/#{app}.rb")
|
37
37
|
|
38
|
-
|
38
|
+
File.write(DEFAULT_CONFIG_PATH, config_rb_template(app))
|
39
39
|
|
40
40
|
logger.info(green("✔ Created #{DEFAULT_CONFIG_PATH}"))
|
41
41
|
end
|
@@ -95,30 +95,19 @@ module Tomo
|
|
95
95
|
File.exist?(".rubocop.yml")
|
96
96
|
end
|
97
97
|
|
98
|
-
def erb_2_2_or_later?
|
99
|
-
erb_version = Gem::Version.new(ERB.version[/\d[\d.]+/])
|
100
|
-
Gem::Requirement.new(">= 2.2").satisfied_by?(erb_version)
|
101
|
-
end
|
102
|
-
|
103
98
|
# Does a .ruby-version file exist match the executing RUBY_VERSION?
|
104
99
|
def using_ruby_version_file?
|
105
100
|
return false unless File.exist?(".ruby-version")
|
106
101
|
|
107
|
-
|
102
|
+
File.read(".ruby-version").rstrip == RUBY_VERSION
|
108
103
|
rescue IOError
|
109
104
|
false
|
110
105
|
end
|
111
106
|
|
112
107
|
def config_rb_template(app)
|
113
108
|
path = File.expand_path("../templates/config.rb.erb", __dir__)
|
114
|
-
template =
|
115
|
-
|
116
|
-
# TODO: remove once we drop Ruby 2.5 support?
|
117
|
-
if erb_2_2_or_later?
|
118
|
-
ERB.new(template, trim_mode: "-").result(binding)
|
119
|
-
else
|
120
|
-
ERB.new(template, nil, "-").result(binding)
|
121
|
-
end
|
109
|
+
template = File.read(path)
|
110
|
+
ERB.new(template, trim_mode: "-").result(binding)
|
122
111
|
end
|
123
112
|
end
|
124
113
|
end
|
@@ -13,7 +13,7 @@ module Tomo
|
|
13
13
|
raise_file_not_found(path) unless File.file?(path)
|
14
14
|
|
15
15
|
Tomo.logger.debug("Loading plugin from #{path.inspect}")
|
16
|
-
script =
|
16
|
+
script = File.read(path)
|
17
17
|
plugin = define_anonymous_plugin_class
|
18
18
|
plugin.class_eval(script, path.to_s, 1)
|
19
19
|
|
@@ -20,7 +20,7 @@ module Tomo
|
|
20
20
|
|
21
21
|
def filter(tasks, host:)
|
22
22
|
roles = host.roles
|
23
|
-
roles =
|
23
|
+
roles = [""] if roles.empty?
|
24
24
|
tasks.select do |task|
|
25
25
|
roles.any? { |role| match?(task, role) }
|
26
26
|
end
|
@@ -31,7 +31,7 @@ module Tomo
|
|
31
31
|
attr_reader :globs
|
32
32
|
|
33
33
|
def match?(task, role)
|
34
|
-
task_globs = globs.keys.select { |glob| glob.match?(task) }
|
34
|
+
task_globs = globs.keys.select { |glob| glob.match?(task) } # rubocop:disable Style/SelectByRegexp
|
35
35
|
return true if task_globs.empty?
|
36
36
|
|
37
37
|
roles = globs.values_at(*task_globs).flatten
|
@@ -30,7 +30,7 @@ module Tomo
|
|
30
30
|
def present_in_gemfile?
|
31
31
|
return false unless File.file?("Gemfile")
|
32
32
|
|
33
|
-
|
33
|
+
File.read("Gemfile").match?(/^\s*gem ['"]#{Regexp.quote(gem_name)}['"]/)
|
34
34
|
rescue IOError
|
35
35
|
false
|
36
36
|
end
|
data/lib/tomo/configuration.rb
CHANGED
@@ -14,7 +14,7 @@ module Tomo
|
|
14
14
|
def self.from_config_rb(path=DEFAULT_CONFIG_PATH)
|
15
15
|
ProjectNotFoundError.raise_with(path: path) unless File.file?(path)
|
16
16
|
Tomo.logger.debug("Loading configuration from #{path.inspect}")
|
17
|
-
config_rb =
|
17
|
+
config_rb = File.read(path)
|
18
18
|
|
19
19
|
new.tap do |config|
|
20
20
|
config.path = File.expand_path(path)
|
data/lib/tomo/console/menu.rb
CHANGED
@@ -98,7 +98,7 @@ module Tomo
|
|
98
98
|
def visible_range
|
99
99
|
max_visible = [8, options.length].min
|
100
100
|
|
101
|
-
offset = [0, position - max_visible / 2].max
|
101
|
+
offset = [0, position - (max_visible / 2)].max
|
102
102
|
adjusted_offset = [offset, options.length - max_visible].min
|
103
103
|
|
104
104
|
adjusted_offset...(adjusted_offset + max_visible)
|
@@ -11,15 +11,13 @@ module Tomo
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_a
|
14
|
-
@_suggestions ||=
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
22
|
-
end
|
14
|
+
@_suggestions ||= if defined?(DidYouMean::SpellChecker)
|
15
|
+
checker = DidYouMean::SpellChecker.new(dictionary: dictionary)
|
16
|
+
suggestions = checker.correct(word)
|
17
|
+
suggestions || []
|
18
|
+
else
|
19
|
+
[]
|
20
|
+
end
|
23
21
|
end
|
24
22
|
|
25
23
|
def to_console
|
data/lib/tomo/error.rb
CHANGED
@@ -15,8 +15,7 @@ module Tomo
|
|
15
15
|
def debug_suggestion
|
16
16
|
return if Tomo.debug?
|
17
17
|
|
18
|
-
"For more troubleshooting info, run tomo again using the "
|
19
|
-
"#{blue('--debug')} option."
|
18
|
+
"For more troubleshooting info, run tomo again using the #{blue('--debug')} option."
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -12,7 +12,7 @@ module Tomo::Plugin::Nodenv
|
|
12
12
|
private
|
13
13
|
|
14
14
|
def run_installer
|
15
|
-
install_url = "https://github.com/nodenv/nodenv-installer/raw/
|
15
|
+
install_url = "https://github.com/nodenv/nodenv-installer/raw/HEAD/bin/nodenv-installer"
|
16
16
|
remote.env PATH: raw("$HOME/.nodenv/bin:$HOME/.nodenv/shims:$PATH") do
|
17
17
|
remote.run("curl -fsSL #{install_url.shellescape} | bash")
|
18
18
|
end
|
@@ -39,11 +39,14 @@ module Tomo::Plugin::Nodenv
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def install_yarn
|
42
|
-
|
43
|
-
|
42
|
+
unless settings[:nodenv_install_yarn]
|
43
|
+
logger.info ":nodenv_install_yarn is false; skipping yarn installation."
|
44
|
+
return
|
45
|
+
end
|
44
46
|
|
45
|
-
|
46
|
-
"
|
47
|
+
version = settings[:nodenv_yarn_version]
|
48
|
+
yarn_spec = version ? "yarn@#{version.shellescape}" : "yarn"
|
49
|
+
remote.run "npm i -g #{yarn_spec}"
|
47
50
|
end
|
48
51
|
|
49
52
|
def node_installed?(version)
|
data/lib/tomo/plugin/nodenv.rb
CHANGED
@@ -11,7 +11,7 @@ module Tomo::Plugin::Rbenv
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def run_installer
|
14
|
-
install_url = "https://github.com/rbenv/rbenv-installer/raw/
|
14
|
+
install_url = "https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer"
|
15
15
|
remote.env PATH: raw("$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH") do
|
16
16
|
remote.run("curl -fsSL #{install_url.shellescape} | bash")
|
17
17
|
end
|
data/lib/tomo/runtime/current.rb
CHANGED
data/lib/tomo/task_api.rb
CHANGED
@@ -25,7 +25,7 @@ module Tomo
|
|
25
25
|
path = File.expand_path(path, working_path) if working_path && path.start_with?(".")
|
26
26
|
|
27
27
|
Runtime::TemplateNotFoundError.raise_with(path: path) unless File.file?(path)
|
28
|
-
template =
|
28
|
+
template = File.read(path)
|
29
29
|
ERB.new(template).result(binding)
|
30
30
|
end
|
31
31
|
|
@@ -18,7 +18,7 @@ set deploy_to: "/var/www/%{application}"
|
|
18
18
|
set rbenv_ruby_version: <%= RUBY_VERSION.inspect %>
|
19
19
|
<% end -%>
|
20
20
|
set nodenv_node_version: <%= node_version&.inspect || "nil # FIXME" %>
|
21
|
-
set
|
21
|
+
set nodenv_install_yarn: <%= yarn_version ? "true" : "false" %>
|
22
22
|
set git_url: <%= git_origin_url&.inspect || "nil # FIXME" %>
|
23
23
|
set git_branch: <%= git_branch&.inspect || "nil # FIXME" %>
|
24
24
|
set git_exclusions: %w[
|
@@ -31,10 +31,12 @@ set env_vars: {
|
|
31
31
|
RAILS_ENV: "production",
|
32
32
|
RAILS_LOG_TO_STDOUT: "1",
|
33
33
|
RAILS_SERVE_STATIC_FILES: "1",
|
34
|
+
BOOTSNAP_CACHE_DIR: "tmp/bootsnap-cache",
|
34
35
|
DATABASE_URL: :prompt,
|
35
36
|
SECRET_KEY_BASE: :prompt
|
36
37
|
}
|
37
38
|
set linked_dirs: %w[
|
39
|
+
.yarn/cache
|
38
40
|
log
|
39
41
|
node_modules
|
40
42
|
public/assets
|
@@ -63,9 +63,9 @@ class Unit
|
|
63
63
|
def self.find(name)
|
64
64
|
path = File.join(File.expand_path("~/.config/systemd/user/"), name)
|
65
65
|
raise "Unknown unit: #{name}" unless File.file?(path)
|
66
|
-
return Service.new(name,
|
66
|
+
return Service.new(name, File.read(path)) if name.end_with?(".service")
|
67
67
|
|
68
|
-
new(name,
|
68
|
+
new(name, File.read(path))
|
69
69
|
end
|
70
70
|
|
71
71
|
def initialize(name, spec)
|
@@ -165,7 +165,7 @@ class Service < Unit
|
|
165
165
|
end
|
166
166
|
|
167
167
|
def parse
|
168
|
-
config =
|
168
|
+
config = spec.scan(/^([^\s=]+)=\s*(\S.*?)\s*$/).to_h
|
169
169
|
working_dir = config["WorkingDirectory"] || File.expand_path("~")
|
170
170
|
executable = config.fetch("ExecStart") do
|
171
171
|
raise "#{name} is missing ExecStart attribute"
|
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.10.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: 2021-
|
11
|
+
date: 2021-10-13 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
|
@@ -181,14 +181,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
181
181
|
requirements:
|
182
182
|
- - ">="
|
183
183
|
- !ruby/object:Gem::Version
|
184
|
-
version: 2.
|
184
|
+
version: 2.6.0
|
185
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
186
186
|
requirements:
|
187
187
|
- - ">="
|
188
188
|
- !ruby/object:Gem::Version
|
189
189
|
version: '0'
|
190
190
|
requirements: []
|
191
|
-
rubygems_version: 3.2.
|
191
|
+
rubygems_version: 3.2.26
|
192
192
|
signing_key:
|
193
193
|
specification_version: 4
|
194
194
|
summary: A friendly CLI for deploying Rails apps ✨
|