tomo 1.4.1 → 1.8.1
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/LICENSE.txt +1 -1
- data/README.md +0 -1
- data/lib/tomo/cli/parser.rb +1 -1
- data/lib/tomo/commands/init.rb +8 -13
- data/lib/tomo/configuration/unknown_plugin_error.rb +15 -4
- data/lib/tomo/error/suggestions.rb +7 -9
- data/lib/tomo/plugin/bundler.rb +1 -1
- data/lib/tomo/plugin/core.rb +1 -1
- data/lib/tomo/plugin/nodenv/tasks.rb +1 -1
- data/lib/tomo/plugin/puma/tasks.rb +4 -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/templates/config.rb.erb +1 -1
- data/lib/tomo/testing/docker_image.rb +1 -3
- data/lib/tomo/testing/systemctl.rb +1 -1
- 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: f097a0641bd9a692351f6ab9fa10b2b2a7b4d6a5df809b19821c644ad1491044
         | 
| 4 | 
            +
              data.tar.gz: 31706e6cec01be45c4e4eb71b1ba6666ce9ec63b197b78af69e1b4b08611eff7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3b53ec01d9d61a5e2238ad82ea786f8ff9a4747dd87459f8ed05a57c400ebd5694b68c5e1bc50e52dedbf0318a58d2f44805eb6a2dd905349330bd1dd6148ae1
         | 
| 7 | 
            +
              data.tar.gz: 1ddf5313df3b5226d311c32f828405242d431e3a5869d61ac091563a1ee06ff844f533afa07d4b78ba03ac24cb7d093625ec6ef833dd3755456016832bb51320
         | 
    
        data/LICENSE.txt
    CHANGED
    
    
    
        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
    
    | @@ -1,4 +1,5 @@ | |
| 1 1 | 
             
            require "erb"
         | 
| 2 | 
            +
            require "fileutils"
         | 
| 2 3 |  | 
| 3 4 | 
             
            module Tomo
         | 
| 4 5 | 
             
              module Commands
         | 
| @@ -94,25 +95,19 @@ module Tomo | |
| 94 95 | 
             
                    File.exist?(".rubocop.yml")
         | 
| 95 96 | 
             
                  end
         | 
| 96 97 |  | 
| 97 | 
            -
                   | 
| 98 | 
            -
             | 
| 99 | 
            -
                     | 
| 100 | 
            -
                  end
         | 
| 98 | 
            +
                  # Does a .ruby-version file exist match the executing RUBY_VERSION?
         | 
| 99 | 
            +
                  def using_ruby_version_file?
         | 
| 100 | 
            +
                    return false unless File.exist?(".ruby-version")
         | 
| 101 101 |  | 
| 102 | 
            -
             | 
| 103 | 
            -
             | 
| 102 | 
            +
                    IO.read(".ruby-version").rstrip == RUBY_VERSION
         | 
| 103 | 
            +
                  rescue IOError
         | 
| 104 | 
            +
                    false
         | 
| 104 105 | 
             
                  end
         | 
| 105 106 |  | 
| 106 107 | 
             
                  def config_rb_template(app)
         | 
| 107 108 | 
             
                    path = File.expand_path("../templates/config.rb.erb", __dir__)
         | 
| 108 109 | 
             
                    template = IO.read(path)
         | 
| 109 | 
            -
             | 
| 110 | 
            -
                    # TODO: remove once we drop Ruby 2.5 support?
         | 
| 111 | 
            -
                    if erb_2_2_or_later?
         | 
| 112 | 
            -
                      ERB.new(template, trim_mode: "-").result(binding)
         | 
| 113 | 
            -
                    else
         | 
| 114 | 
            -
                      ERB.new(template, nil, "-").result(binding)
         | 
| 115 | 
            -
                    end
         | 
| 110 | 
            +
                    ERB.new(template, trim_mode: "-").result(binding)
         | 
| 116 111 | 
             
                  end
         | 
| 117 112 | 
             
                end
         | 
| 118 113 | 
             
              end
         | 
| @@ -17,11 +17,22 @@ module Tomo | |
| 17 17 | 
             
                  private
         | 
| 18 18 |  | 
| 19 19 | 
             
                  def gem_suggestion
         | 
| 20 | 
            -
                    if Tomo.bundled?
         | 
| 21 | 
            -
             | 
| 22 | 
            -
                     | 
| 23 | 
            -
             | 
| 20 | 
            +
                    return "\nYou may need to add #{yellow(gem_name)} to your Gemfile." if Tomo.bundled?
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    messages = ["\nYou may need to install the #{yellow(gem_name)} gem."]
         | 
| 23 | 
            +
                    if present_in_gemfile?
         | 
| 24 | 
            +
                      messages << "\nTry prefixing the tomo command with #{blue('bundle exec')} to fix this error."
         | 
| 24 25 | 
             
                    end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                    messages.join
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                  def present_in_gemfile?
         | 
| 31 | 
            +
                    return false unless File.file?("Gemfile")
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                    IO.read("Gemfile").match?(/^\s*gem ['"]#{Regexp.quote(gem_name)}['"]/)
         | 
| 34 | 
            +
                  rescue IOError
         | 
| 35 | 
            +
                    false
         | 
| 25 36 | 
             
                  end
         | 
| 26 37 | 
             
                end
         | 
| 27 38 | 
             
              end
         | 
| @@ -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/plugin/bundler.rb
    CHANGED
    
    
    
        data/lib/tomo/plugin/core.rb
    CHANGED
    
    | @@ -21,7 +21,7 @@ module Tomo::Plugin | |
| 21 21 | 
             
                  releases_path:         "%{deploy_to}/releases",
         | 
| 22 22 | 
             
                  revision_log_path:     "%{deploy_to}/revisions.log",
         | 
| 23 23 | 
             
                  shared_path:           "%{deploy_to}/shared",
         | 
| 24 | 
            -
                  tmp_path:              "/tmp/tomo",
         | 
| 24 | 
            +
                  tmp_path:              "/tmp/tomo-#{SecureRandom.alphanumeric(8)}",
         | 
| 25 25 | 
             
                  tomo_config_file_path: nil, # determined at runtime
         | 
| 26 26 | 
             
                  run_args:              [] # determined at runtime
         | 
| 27 27 | 
             
                )
         | 
| @@ -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
         | 
| @@ -38,6 +38,10 @@ module Tomo::Plugin::Puma | |
| 38 38 | 
             
                  remote.attach "journalctl", "-q", raw("--user-unit=#{service.name.shellescape}"), *settings[:run_args]
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 | 
            +
                def tail_log
         | 
| 42 | 
            +
                  remote.attach "journalctl -q --user-unit=#{service.name.shellescape} -f"
         | 
| 43 | 
            +
                end
         | 
| 44 | 
            +
             | 
| 41 45 | 
             
                private
         | 
| 42 46 |  | 
| 43 47 | 
             
                def port
         | 
| @@ -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
    
    
| @@ -14,7 +14,7 @@ host "user@hostname.or.ip.address" | |
| 14 14 |  | 
| 15 15 | 
             
            set application: <%= app.inspect %>
         | 
| 16 16 | 
             
            set deploy_to: "/var/www/%{application}"
         | 
| 17 | 
            -
            <% unless  | 
| 17 | 
            +
            <% unless using_ruby_version_file? -%>
         | 
| 18 18 | 
             
            set rbenv_ruby_version: <%= RUBY_VERSION.inspect %>
         | 
| 19 19 | 
             
            <% end -%>
         | 
| 20 20 | 
             
            set nodenv_node_version: <%= node_version&.inspect || "nil # FIXME" %>
         | 
| @@ -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.8.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Matt Brictson
         | 
| 8 8 | 
             
            autorequire:
         | 
| 9 9 | 
             
            bindir: exe
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-05-08 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. | 
| 191 | 
            +
            rubygems_version: 3.2.16
         | 
| 192 192 | 
             
            signing_key:
         | 
| 193 193 | 
             
            specification_version: 4
         | 
| 194 194 | 
             
            summary: A friendly CLI for deploying Rails apps ✨
         |