tomo 1.11.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f646a8ad8b9a55a908ead2765b2b48461f279328424ffae5ddd71adbf525099
4
- data.tar.gz: 07b17c07811315a55e49e8b8e0e5d30f56ff88a618fc8ba8053c147f53fa0289
3
+ metadata.gz: 40ab6286952126707fe78f7d1168a02d2cc07593efdb9a62fb52dbd39ea7e816
4
+ data.tar.gz: 6cd99a5981d14a4a1ea0e520533f87ff7e941293bb9f5a63fbe9f9718afe13db
5
5
  SHA512:
6
- metadata.gz: 1a28e6dcdf0ae942ade3eccad7d3c4cf2b8bc8ae1b843fb342d6bb15b35dacda4e07447a9d68cc7ccbe401bb3665fc48ac3ad82a1c0cf21c3d38b20151d52581
7
- data.tar.gz: 7ed26ba43d56e602c8aebc59c29900ac53174c8dbf781cc357a16ad5cf5d7581caadd706d5efb4fc6befc30830dba6c322fb9e1910b3cfbfca5573d9bf962c0c
6
+ metadata.gz: d23f6506248bbb3fb112ccd2a8225d670adee6ddeca7ef2906d15c16e367da065612d8f0a2087090eb96db9cafd79a5ced35bf0a9cfa137dceb020da09422180
7
+ data.tar.gz: 02be70059d804b3184fbb4898f0bc50c74c4a216034271a888a4bf68fc81dbedb5c42617226c0ed9cd99e3bf7de285e9830712cbf989fcb5b4146473a0f6a54d
data/README.md CHANGED
@@ -240,6 +240,10 @@ host "app2@example.com"
240
240
 
241
241
  Next run `tomo setup` for _both_ apps; this will set everything up for both users on the remote host (environment variables, rbenv, etc.). You can now deploy both apps to the same host, with the confidence that their configurations will be kept cleanly separated.
242
242
 
243
+ #### Does tomo support git submodules?
244
+
245
+ No, not out of the box. However, you can extend tomo with an additional task for submodules; see the solution in [PR #220](https://github.com/mattbrictson/tomo/pull/220#pullrequestreview-979249573) suggested by [@numbcoder](https://github.com/numbcoder).
246
+
243
247
  ## Support
244
248
 
245
249
  This project is a labor of love and I can only spend a few hours a week maintaining it, at most. If you'd like to help by submitting a pull request, or if you've discovered a bug that needs my attention, please let me know. Check out [CONTRIBUTING.md](https://github.com/mattbrictson/tomo/blob/main/CONTRIBUTING.md) to get started. Happy hacking! —Matt
@@ -104,6 +104,16 @@ module Tomo
104
104
  false
105
105
  end
106
106
 
107
+ # Does a .node-version file exist match `node --version`?
108
+ def using_node_version_file?
109
+ return false unless File.exist?(".node-version")
110
+
111
+ version = File.read(".node-version").rstrip
112
+ !version.empty? && version == node_version
113
+ rescue IOError
114
+ false
115
+ end
116
+
107
117
  def config_rb_template(app)
108
118
  path = File.expand_path("../templates/config.rb.erb", __dir__)
109
119
  template = File.read(path)
@@ -55,10 +55,7 @@ module Tomo
55
55
  end
56
56
 
57
57
  def register_task_library(namespace, library_class)
58
- Tomo.logger.debug(
59
- "Registering task library #{library_class}"\
60
- " (#{namespace.inspect} namespace)"
61
- )
58
+ Tomo.logger.debug("Registering task library #{library_class} (#{namespace.inspect} namespace)")
62
59
  namespaced_classes << [namespace, library_class]
63
60
  end
64
61
  end
data/lib/tomo/path.rb CHANGED
@@ -1,4 +1,4 @@
1
- require "forwardable"
1
+ require "delegate"
2
2
  require "pathname"
3
3
 
4
4
  module Tomo
@@ -51,10 +51,7 @@ module Tomo::Plugin::Bundler
51
51
  end
52
52
 
53
53
  def extract_bundler_ver_from_lockfile
54
- lockfile_tail = remote.capture(
55
- "tail", "-n", "10", paths.release.join("Gemfile.lock"),
56
- raise_on_error: false
57
- )
54
+ lockfile_tail = remote.capture("tail", "-n", "10", paths.release.join("Gemfile.lock"), raise_on_error: false)
58
55
  version = lockfile_tail[/BUNDLED WITH\n (\S+)$/, 1]
59
56
  return version if version || dry_run?
60
57
 
@@ -32,10 +32,7 @@ module Tomo::Plugin::Git
32
32
  remote.mkdir_p(paths.release)
33
33
 
34
34
  remote.chdir(paths.git_repo) do
35
- remote.git(
36
- "archive #{ref.shellescape} | "\
37
- "tar -x -f - -C #{paths.release.shellescape}"
38
- )
35
+ remote.git("archive #{ref.shellescape} | tar -x -f - -C #{paths.release.shellescape}")
39
36
  end
40
37
  end
41
38
 
@@ -53,8 +50,8 @@ module Tomo::Plugin::Git
53
50
  return unless settings[:git_ref] && settings[:git_branch]
54
51
 
55
52
  logger.warn(
56
- ":git_ref (#{settings[:git_ref]}) and "\
57
- ":git_branch (#{settings[:git_branch]}) are both specified. "\
53
+ ":git_ref (#{settings[:git_ref]}) and " \
54
+ ":git_branch (#{settings[:git_branch]}) are both specified. " \
58
55
  "Ignoring :git_branch."
59
56
  )
60
57
  @ref_override_warning = true
@@ -31,8 +31,7 @@ module Tomo::Plugin::Nodenv
31
31
  end
32
32
 
33
33
  def install_node
34
- require_setting :nodenv_node_version
35
- node_version = settings[:nodenv_node_version]
34
+ node_version = settings[:nodenv_node_version] || extract_node_ver_from_version_file
36
35
 
37
36
  remote.run "nodenv install #{node_version.shellescape}" unless node_installed?(node_version)
38
37
  remote.run "nodenv global #{node_version.shellescape}"
@@ -57,5 +56,16 @@ module Tomo::Plugin::Nodenv
57
56
  end
58
57
  false
59
58
  end
59
+
60
+ def extract_node_ver_from_version_file
61
+ path = paths.release.join(".node-version")
62
+ version = remote.capture("cat", path, raise_on_error: false).strip
63
+ return version unless version.empty?
64
+
65
+ die <<~REASON
66
+ Could not guess node version from .node-version file.
67
+ Use the :nodenv_node_version setting to specify the version of node to install.
68
+ REASON
69
+ end
60
70
  end
61
71
  end
@@ -21,9 +21,10 @@ module Tomo
21
21
  return if failure?
22
22
 
23
23
  promises << future_on(executor, *args, &block)
24
- .on_rejection_using(executor) do |reason|
25
- self.failure = reason
26
- end
24
+ .on_rejection_using(executor) do |reason|
25
+ self.failure = reason
26
+ end
27
+
27
28
  nil
28
29
  end
29
30
 
@@ -26,8 +26,7 @@ module Tomo
26
26
  when 1 then applicable_hosts.first.to_s
27
27
  when 2 then applicable_hosts.map(&:to_s).join(" and ")
28
28
  else
29
- "#{applicable_hosts.first} and "\
30
- "#{applicable_hosts.length - 1} other hosts"
29
+ "#{applicable_hosts.first} and #{applicable_hosts.length - 1} other hosts"
31
30
  end
32
31
  end
33
32
 
data/lib/tomo/runtime.rb CHANGED
@@ -70,9 +70,9 @@ module Tomo
70
70
 
71
71
  def new_task_runner(release_type, args)
72
72
  run_settings = { release_path: release_path_for(release_type) }
73
- .merge(local_user: Runtime.local_user)
74
- .merge(settings)
75
- .merge(run_args: args)
73
+ .merge(local_user: Runtime.local_user)
74
+ .merge(settings)
75
+ .merge(run_args: args)
76
76
 
77
77
  TaskRunner.new(plugins_registry: plugins_registry, settings: run_settings)
78
78
  end
@@ -1,5 +1,6 @@
1
1
  require "open3"
2
2
  require "shellwords"
3
+ require "stringio"
3
4
 
4
5
  module Tomo
5
6
  module SSH
@@ -41,8 +41,10 @@ module Tomo
41
41
 
42
42
  def control_opts(path, verbose)
43
43
  opts = [
44
- "-o", "ControlMaster=auto",
45
- "-o", "ControlPath=#{path}",
44
+ "-o",
45
+ "ControlMaster=auto",
46
+ "-o",
47
+ "ControlPath=#{path}",
46
48
  "-o"
47
49
  ]
48
50
  opts << (verbose ? "ControlPersist=1s" : "ControlPersist=30s")
@@ -17,7 +17,9 @@ set deploy_to: "/var/www/%{application}"
17
17
  <% unless using_ruby_version_file? -%>
18
18
  set rbenv_ruby_version: <%= RUBY_VERSION.inspect %>
19
19
  <% end -%>
20
+ <% unless using_node_version_file? -%>
20
21
  set nodenv_node_version: <%= node_version&.inspect || "nil # FIXME" %>
22
+ <% end -%>
21
23
  set nodenv_install_yarn: <%= yarn_version ? "true" : "false" %>
22
24
  set git_url: <%= git_origin_url&.inspect || "nil # FIXME" %>
23
25
  set git_branch: <%= git_branch&.inspect || "nil # FIXME" %>
@@ -41,6 +43,7 @@ set linked_dirs: %w[
41
43
  node_modules
42
44
  public/assets
43
45
  public/packs
46
+ public/vite
44
47
  tmp/cache
45
48
  tmp/pids
46
49
  tmp/sockets
@@ -1,4 +1,4 @@
1
- FROM ubuntu:20.04
1
+ FROM ubuntu:22.04
2
2
  WORKDIR /provision
3
3
  COPY ./tomo_test_ed25519.pub /root/.ssh/authorized_keys
4
4
  COPY ./ubuntu_setup.sh ./
@@ -57,8 +57,10 @@ module Tomo
57
57
  hosts_file = File.join(Dir.tmpdir, "tomo_#{SecureRandom.hex(8)}_hosts")
58
58
  {
59
59
  ssh_extra_opts: [
60
- "-o", "UserKnownHostsFile=#{hosts_file}",
61
- "-o", "IdentityFile=#{private_key_path}"
60
+ "-o",
61
+ "UserKnownHostsFile=#{hosts_file}",
62
+ "-o",
63
+ "IdentityFile=#{private_key_path}"
62
64
  ],
63
65
  ssh_strict_host_key_checking: false
64
66
  }
@@ -69,8 +71,8 @@ module Tomo
69
71
  attr_reader :container_id, :image_id, :private_key_path
70
72
 
71
73
  def pull_base_image_if_needed
72
- images = Local.capture('docker images --format "{{.ID}}" ubuntu:20.04')
73
- Local.capture("docker pull ubuntu:20.04") if images.strip.empty?
74
+ images = Local.capture('docker images --format "{{.ID}}" ubuntu:22.04')
75
+ Local.capture("docker pull ubuntu:22.04") if images.strip.empty?
74
76
  end
75
77
 
76
78
  def set_up_private_key
@@ -1,3 +1,5 @@
1
+ require "stringio"
2
+
1
3
  module Tomo
2
4
  module Testing
3
5
  module LogCapturing
data/lib/tomo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.11.0".freeze
2
+ VERSION = "1.13.0".freeze
3
3
  end
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.11.0
4
+ version: 1.13.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: 2022-02-26 00:00:00.000000000 Z
11
+ date: 2022-08-28 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
@@ -182,14 +182,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
182
  requirements:
183
183
  - - ">="
184
184
  - !ruby/object:Gem::Version
185
- version: 2.6.0
185
+ version: '2.6'
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
188
  - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
- rubygems_version: 3.3.7
192
+ rubygems_version: 3.3.21
193
193
  signing_key:
194
194
  specification_version: 4
195
195
  summary: A friendly CLI for deploying Rails apps ✨