tomo 1.22.1 → 1.23.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/lib/tomo/cli/deploy_options.rb +1 -0
- data/lib/tomo/cli/project_options.rb +1 -1
- data/lib/tomo/configuration/dsl/config_file.rb +2 -2
- data/lib/tomo/configuration/environment.rb +6 -1
- data/lib/tomo/configuration/unknown_environment_error.rb +4 -2
- data/lib/tomo/configuration.rb +11 -4
- data/lib/tomo/plugin/rbenv/tasks.rb +11 -1
- data/lib/tomo/plugin/rbenv.rb +2 -1
- data/lib/tomo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2e5e093589de77525a3e23c89ade9506ab805e6714185f223b517c855e9833f
|
|
4
|
+
data.tar.gz: '0162796e298153c9d102c49806f9e14e13a7a0b163b520ce7044c4ce2eaa3942'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de7fcac2ea42c90e56a7517527a55c451c78fe7b681f833c2e42ea25a9002b64c439efbaf97d202931ea63aba73a4db4a18746e51f077b2add9fdfafbe406679
|
|
7
|
+
data.tar.gz: a8e0fa50d90ab152f06ffcac8e56a30411e643c7a6f871a07967e4fe0e395312648bb4aa97885f9f53136e677a89aa5e4aeec59d4c98f6b4255f2d355ec7531b
|
|
@@ -13,7 +13,7 @@ module Tomo
|
|
|
13
13
|
|
|
14
14
|
def configure_runtime(options, strict: true)
|
|
15
15
|
config = load_configuration(options)
|
|
16
|
-
env = options[:environment]
|
|
16
|
+
env = options[:environment] || config.default_environment_name
|
|
17
17
|
env = config.environments.keys.first if env.nil? && !strict
|
|
18
18
|
config = config.for_environment(env)
|
|
19
19
|
config.settings.merge!(settings_from_env)
|
|
@@ -20,8 +20,8 @@ module Tomo
|
|
|
20
20
|
self
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def environment(name, &)
|
|
24
|
-
environment = @config.environments[name.to_s] ||= Environment.new
|
|
23
|
+
def environment(name, default: false, &)
|
|
24
|
+
environment = @config.environments[name.to_s] ||= Environment.new(default:)
|
|
25
25
|
EnvironmentBlock.new(environment).instance_eval(&)
|
|
26
26
|
self
|
|
27
27
|
end
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
module Tomo
|
|
4
4
|
class Configuration
|
|
5
5
|
class UnknownEnvironmentError < Tomo::Error
|
|
6
|
-
attr_accessor :name, :known_environments
|
|
6
|
+
attr_accessor :name, :known_environments, :default_environment
|
|
7
7
|
|
|
8
8
|
def to_console
|
|
9
9
|
known_environments.empty? ? no_envs : wrong_envs
|
|
@@ -27,7 +27,9 @@ module Tomo
|
|
|
27
27
|
if suggestions.any?
|
|
28
28
|
error + suggestions.to_console
|
|
29
29
|
else
|
|
30
|
-
envs = known_environments.map
|
|
30
|
+
envs = known_environments.map do |env|
|
|
31
|
+
[blue(" #{env}"), env == default_environment ? gray(" (default)") : nil].compact.join
|
|
32
|
+
end
|
|
31
33
|
error + <<~ENVS
|
|
32
34
|
|
|
33
35
|
The following environments are available:
|
data/lib/tomo/configuration.rb
CHANGED
|
@@ -38,6 +38,11 @@ module Tomo
|
|
|
38
38
|
@task_filter = RoleBasedTaskFilter.new
|
|
39
39
|
end
|
|
40
40
|
|
|
41
|
+
def default_environment_name
|
|
42
|
+
default_env = environments.one? ? environments.first : environments.find { |_, env| env.default? }
|
|
43
|
+
default_env&.first
|
|
44
|
+
end
|
|
45
|
+
|
|
41
46
|
def for_environment(environment)
|
|
42
47
|
validate_environment!(environment)
|
|
43
48
|
|
|
@@ -109,12 +114,14 @@ module Tomo
|
|
|
109
114
|
settings.merge(environments[environ].settings)
|
|
110
115
|
end
|
|
111
116
|
|
|
112
|
-
def raise_no_environment_specified
|
|
113
|
-
UnspecifiedEnvironmentError.raise_with(environments: environments.keys)
|
|
114
|
-
end
|
|
117
|
+
def raise_no_environment_specified = UnspecifiedEnvironmentError.raise_with(environments: environments.keys)
|
|
115
118
|
|
|
116
119
|
def raise_unknown_environment(environ)
|
|
117
|
-
UnknownEnvironmentError.raise_with(
|
|
120
|
+
UnknownEnvironmentError.raise_with(
|
|
121
|
+
name: environ,
|
|
122
|
+
default_environment: default_environment_name,
|
|
123
|
+
known_environments: environments.keys
|
|
124
|
+
)
|
|
118
125
|
end
|
|
119
126
|
end
|
|
120
127
|
end
|
|
@@ -37,11 +37,21 @@ module Tomo::Plugin::Rbenv
|
|
|
37
37
|
|
|
38
38
|
unless ruby_installed?(ruby_version)
|
|
39
39
|
logger.info("Installing ruby #{ruby_version} -- this may take several minutes")
|
|
40
|
-
|
|
40
|
+
using_tmpdir do
|
|
41
|
+
remote.run "CFLAGS=-O3 rbenv install #{ruby_version.shellescape} --verbose"
|
|
42
|
+
end
|
|
41
43
|
end
|
|
42
44
|
remote.run "rbenv global #{ruby_version.shellescape}"
|
|
43
45
|
end
|
|
44
46
|
|
|
47
|
+
def using_tmpdir(&)
|
|
48
|
+
tmpdir = paths.rbenv_tmpdir
|
|
49
|
+
return yield if tmpdir.nil?
|
|
50
|
+
|
|
51
|
+
remote.mkdir_p(tmpdir)
|
|
52
|
+
remote.env(TMPDIR: tmpdir, &)
|
|
53
|
+
end
|
|
54
|
+
|
|
45
55
|
def ruby_installed?(version)
|
|
46
56
|
versions = remote.capture("rbenv versions", raise_on_error: false)
|
|
47
57
|
if versions.match?(/^\*?\s*#{Regexp.quote(version)}\s/)
|
data/lib/tomo/plugin/rbenv.rb
CHANGED
data/lib/tomo/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tomo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.23.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Brictson
|
|
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
188
188
|
- !ruby/object:Gem::Version
|
|
189
189
|
version: '0'
|
|
190
190
|
requirements: []
|
|
191
|
-
rubygems_version: 4.0.
|
|
191
|
+
rubygems_version: 4.0.20
|
|
192
192
|
specification_version: 4
|
|
193
193
|
summary: A friendly CLI for deploying Rails apps ✨
|
|
194
194
|
test_files: []
|