tomo 1.8.1 → 1.11.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: f097a0641bd9a692351f6ab9fa10b2b2a7b4d6a5df809b19821c644ad1491044
4
- data.tar.gz: 31706e6cec01be45c4e4eb71b1ba6666ce9ec63b197b78af69e1b4b08611eff7
3
+ metadata.gz: 2f646a8ad8b9a55a908ead2765b2b48461f279328424ffae5ddd71adbf525099
4
+ data.tar.gz: 07b17c07811315a55e49e8b8e0e5d30f56ff88a618fc8ba8053c147f53fa0289
5
5
  SHA512:
6
- metadata.gz: 3b53ec01d9d61a5e2238ad82ea786f8ff9a4747dd87459f8ed05a57c400ebd5694b68c5e1bc50e52dedbf0318a58d2f44805eb6a2dd905349330bd1dd6148ae1
7
- data.tar.gz: 1ddf5313df3b5226d311c32f828405242d431e3a5869d61ac091563a1ee06ff844f533afa07d4b78ba03ac24cb7d093625ec6ef833dd3755456016832bb51320
6
+ metadata.gz: 1a28e6dcdf0ae942ade3eccad7d3c4cf2b8bc8ae1b843fb342d6bb15b35dacda4e07447a9d68cc7ccbe401bb3665fc48ac3ad82a1c0cf21c3d38b20151d52581
7
+ data.tar.gz: 7ed26ba43d56e602c8aebc59c29900ac53174c8dbf781cc357a16ad5cf5d7581caadd706d5efb4fc6befc30830dba6c322fb9e1910b3cfbfca5573d9bf962c0c
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2021 Matt Brictson
3
+ Copyright (c) 2022 Matt Brictson
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -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
- IO.write(DEFAULT_CONFIG_PATH, config_rb_template(app))
38
+ File.write(DEFAULT_CONFIG_PATH, config_rb_template(app))
39
39
 
40
40
  logger.info(green("✔ Created #{DEFAULT_CONFIG_PATH}"))
41
41
  end
@@ -99,14 +99,14 @@ module Tomo
99
99
  def using_ruby_version_file?
100
100
  return false unless File.exist?(".ruby-version")
101
101
 
102
- IO.read(".ruby-version").rstrip == RUBY_VERSION
102
+ File.read(".ruby-version").rstrip == RUBY_VERSION
103
103
  rescue IOError
104
104
  false
105
105
  end
106
106
 
107
107
  def config_rb_template(app)
108
108
  path = File.expand_path("../templates/config.rb.erb", __dir__)
109
- template = IO.read(path)
109
+ template = File.read(path)
110
110
  ERB.new(template, trim_mode: "-").result(binding)
111
111
  end
112
112
  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 = IO.read(path)
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 = roles.empty? ? [""] : 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
- IO.read("Gemfile").match?(/^\s*gem ['"]#{Regexp.quote(gem_name)}['"]/)
33
+ File.read("Gemfile").match?(/^\s*gem ['"]#{Regexp.quote(gem_name)}['"]/)
34
34
  rescue IOError
35
35
  false
36
36
  end
@@ -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 = IO.read(path)
17
+ config_rb = File.read(path)
18
18
 
19
19
  new.tap do |config|
20
20
  config.path = File.expand_path(path)
@@ -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)
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
@@ -3,6 +3,14 @@ require "time"
3
3
 
4
4
  module Tomo::Plugin::Git
5
5
  class Tasks < Tomo::TaskLibrary
6
+ def config
7
+ user_name = settings[:git_user_name] || remote.host.user
8
+ user_email = settings[:git_user_email] || "#{remote.host.user}@example.com"
9
+
10
+ remote.git("config", "--global", "user.name", user_name)
11
+ remote.git("config", "--global", "user.email", user_email)
12
+ end
13
+
6
14
  def clone
7
15
  require_setting :git_url
8
16
 
@@ -12,6 +12,8 @@ module Tomo::Plugin
12
12
  git_exclusions: [],
13
13
  git_env: { GIT_SSH_COMMAND: "ssh -o PasswordAuthentication=no -o StrictHostKeyChecking=no" },
14
14
  git_ref: nil,
15
- git_url: nil
15
+ git_url: nil,
16
+ git_user_name: nil,
17
+ git_user_email: nil
16
18
  end
17
19
  end
@@ -39,11 +39,14 @@ module Tomo::Plugin::Nodenv
39
39
  end
40
40
 
41
41
  def install_yarn
42
- version = settings[:nodenv_yarn_version]
43
- return remote.run "npm i -g yarn@#{version.shellescape}" if version
42
+ unless settings[:nodenv_install_yarn]
43
+ logger.info ":nodenv_install_yarn is false; skipping yarn installation."
44
+ return
45
+ end
44
46
 
45
- logger.info "No :nodenv_yarn_version specified; "\
46
- "skipping yarn installation."
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)
@@ -5,6 +5,7 @@ module Tomo::Plugin
5
5
  extend Tomo::PluginDSL
6
6
 
7
7
  defaults bashrc_path: ".bashrc",
8
+ nodenv_install_yarn: true,
8
9
  nodenv_node_version: nil,
9
10
  nodenv_yarn_version: nil
10
11
 
@@ -29,7 +29,7 @@ module Tomo
29
29
  private
30
30
 
31
31
  def slice(*keys)
32
- keys.map { |key| [key, fiber_locals[key]] }.to_h
32
+ keys.to_h { |key| [key, fiber_locals[key]] }
33
33
  end
34
34
 
35
35
  def fiber_locals
@@ -10,7 +10,7 @@ module Tomo
10
10
  end
11
11
 
12
12
  def call
13
- hash = settings.keys.map { |name| [name, fetch(name)] }.to_h
13
+ hash = settings.keys.to_h { |name| [name, fetch(name)] }
14
14
  dump_settings(hash) if Tomo.debug?
15
15
  hash
16
16
  end
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 = IO.read(path)
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 nodenv_yarn_version: <%= yarn_version.inspect %>
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
@@ -47,6 +49,7 @@ set linked_dirs: %w[
47
49
  setup do
48
50
  run "env:setup"
49
51
  run "core:setup_directories"
52
+ run "git:config"
50
53
  run "git:clone"
51
54
  run "git:create_release"
52
55
  run "core:symlink_shared"
@@ -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, IO.read(path)) if name.end_with?(".service")
66
+ return Service.new(name, File.read(path)) if name.end_with?(".service")
67
67
 
68
- new(name, IO.read(path))
68
+ new(name, File.read(path))
69
69
  end
70
70
 
71
71
  def initialize(name, spec)
data/lib/tomo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Tomo
2
- VERSION = "1.8.1".freeze
2
+ VERSION = "1.11.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.8.1
4
+ version: 1.11.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-05-08 00:00:00.000000000 Z
11
+ date: 2022-02-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,6 +173,7 @@ metadata:
173
173
  source_code_uri: https://github.com/mattbrictson/tomo
174
174
  homepage_uri: https://github.com/mattbrictson/tomo
175
175
  documentation_uri: https://tomo-deploy.com/
176
+ rubygems_mfa_required: 'true'
176
177
  post_install_message:
177
178
  rdoc_options: []
178
179
  require_paths:
@@ -188,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  - !ruby/object:Gem::Version
189
190
  version: '0'
190
191
  requirements: []
191
- rubygems_version: 3.2.16
192
+ rubygems_version: 3.3.7
192
193
  signing_key:
193
194
  specification_version: 4
194
195
  summary: A friendly CLI for deploying Rails apps ✨