tomo 0.12.0 → 0.13.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/runtime/settings_interpolation.rb +3 -45
 - data/lib/tomo/runtime/unknown_task_error.rb +16 -3
 - data/lib/tomo/version.rb +1 -1
 - metadata +7 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 79cfaa19c379a5d143b07102f521a707495a89446b4c08a9048b11ee212585b6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 180a8b7e1a7812e7a71b8c9b0dd1c8c9607ac81a5e025de7e685de86dca534d8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 737d43b6ab7ca31529ec9c1c3cc7ea98c87af44cc7c7324c36287e536afc0b95313a77ec989295f7f3998ad4eb7acc9b41e2e128d2dceb78c93e4f3c6d529a71
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e704de839bac059e668f0aa43433cddadd46e2bf2978e6f49d135da3c9d9deb5a63e3f5660bdbf286f3b49f7263201d73a8e24c16986f526179bed4574deaef9
         
     | 
| 
         @@ -7,75 +7,33 @@ module Tomo 
     | 
|
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  def initialize(settings)
         
     | 
| 
       9 
9 
     | 
    
         
             
                    @settings = symbolize(settings)
         
     | 
| 
       10 
     | 
    
         
            -
                    @deprecation_warnings = []
         
     | 
| 
       11 
10 
     | 
    
         
             
                  end
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
       13 
12 
     | 
    
         
             
                  def call
         
     | 
| 
       14 
13 
     | 
    
         
             
                    hash = Hash[settings.keys.map { |name| [name, fetch(name)] }]
         
     | 
| 
       15 
14 
     | 
    
         
             
                    dump_settings(hash) if Tomo.debug?
         
     | 
| 
       16 
     | 
    
         
            -
                    print_deprecation_warnings
         
     | 
| 
       17 
15 
     | 
    
         
             
                    hash
         
     | 
| 
       18 
16 
     | 
    
         
             
                  end
         
     | 
| 
       19 
17 
     | 
    
         | 
| 
       20 
18 
     | 
    
         
             
                  private
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                  attr_reader :settings 
     | 
| 
      
 20 
     | 
    
         
            +
                  attr_reader :settings
         
     | 
| 
       23 
21 
     | 
    
         | 
| 
       24 
     | 
    
         
            -
                  # rubocop:disable Metrics/AbcSize
         
     | 
| 
       25 
22 
     | 
    
         
             
                  def fetch(name, stack=[])
         
     | 
| 
       26 
23 
     | 
    
         
             
                    raise_circular_dependency_error(name, stack) if stack.include?(name)
         
     | 
| 
       27 
24 
     | 
    
         
             
                    value = settings.fetch(name)
         
     | 
| 
       28 
25 
     | 
    
         
             
                    return value unless value.is_a?(String)
         
     | 
| 
       29 
26 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
                    value.gsub(/%{(\w+)} 
     | 
| 
       31 
     | 
    
         
            -
                       
     | 
| 
       32 
     | 
    
         
            -
                      deprecation_warnings << name if Regexp.last_match[2]
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                      fetch(token.to_sym, stack + [name])
         
     | 
| 
      
 27 
     | 
    
         
            +
                    value.gsub(/%{(\w+)}/) do
         
     | 
| 
      
 28 
     | 
    
         
            +
                      fetch(Regexp.last_match[1].to_sym, stack + [name])
         
     | 
| 
       35 
29 
     | 
    
         
             
                    end
         
     | 
| 
       36 
30 
     | 
    
         
             
                  end
         
     | 
| 
       37 
     | 
    
         
            -
                  # rubocop:enable Metrics/AbcSize
         
     | 
| 
       38 
31 
     | 
    
         | 
| 
       39 
32 
     | 
    
         
             
                  def raise_circular_dependency_error(name, stack)
         
     | 
| 
       40 
33 
     | 
    
         
             
                    dependencies = [*stack, name].join(" -> ")
         
     | 
| 
       41 
34 
     | 
    
         
             
                    raise "Circular dependency detected in settings: #{dependencies}"
         
     | 
| 
       42 
35 
     | 
    
         
             
                  end
         
     | 
| 
       43 
36 
     | 
    
         | 
| 
       44 
     | 
    
         
            -
                  # rubocop:disable Metrics/AbcSize
         
     | 
| 
       45 
     | 
    
         
            -
                  # rubocop:disable Metrics/MethodLength
         
     | 
| 
       46 
     | 
    
         
            -
                  def print_deprecation_warnings
         
     | 
| 
       47 
     | 
    
         
            -
                    return if deprecation_warnings.empty?
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                    examples = ""
         
     | 
| 
       50 
     | 
    
         
            -
                    deprecation_warnings.uniq.each do |name|
         
     | 
| 
       51 
     | 
    
         
            -
                      sett = settings[name].inspect
         
     | 
| 
       52 
     | 
    
         
            -
                      old_syntax = sett.gsub(
         
     | 
| 
       53 
     | 
    
         
            -
                        /%<(\w+)>/,
         
     | 
| 
       54 
     | 
    
         
            -
                        Colors.red("%<") + '\1' + Colors.red(">")
         
     | 
| 
       55 
     | 
    
         
            -
                      )
         
     | 
| 
       56 
     | 
    
         
            -
                      new_syntax = sett.gsub(
         
     | 
| 
       57 
     | 
    
         
            -
                        /%<(\w+)>/,
         
     | 
| 
       58 
     | 
    
         
            -
                        Colors.green("%{") + '\1' + Colors.green("}")
         
     | 
| 
       59 
     | 
    
         
            -
                      )
         
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
                      examples << "\n:#{name}\n\n"
         
     | 
| 
       62 
     | 
    
         
            -
                      examples << "  Replace:   set #{name}: #{old_syntax}\n"
         
     | 
| 
       63 
     | 
    
         
            -
                      examples << "  with this: set #{name}: #{new_syntax}\n"
         
     | 
| 
       64 
     | 
    
         
            -
                    end
         
     | 
| 
       65 
     | 
    
         
            -
             
     | 
| 
       66 
     | 
    
         
            -
                    Tomo.logger.warn <<~WARNING
         
     | 
| 
       67 
     | 
    
         
            -
                      There are settings using the deprecated %<...> interpolation syntax.
         
     | 
| 
       68 
     | 
    
         
            -
                      #{examples}
         
     | 
| 
       69 
     | 
    
         
            -
                      #{Colors.red('The %<...> syntax will not work in future versions of tomo.')}
         
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
                    WARNING
         
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
                    # Make sure people see the warning!
         
     | 
| 
       74 
     | 
    
         
            -
                    sleep 5
         
     | 
| 
       75 
     | 
    
         
            -
                  end
         
     | 
| 
       76 
     | 
    
         
            -
                  # rubocop:enable Metrics/AbcSize
         
     | 
| 
       77 
     | 
    
         
            -
                  # rubocop:enable Metrics/MethodLength
         
     | 
| 
       78 
     | 
    
         
            -
             
     | 
| 
       79 
37 
     | 
    
         
             
                  def symbolize(hash)
         
     | 
| 
       80 
38 
     | 
    
         
             
                    hash.each_with_object({}) do |(key, value), symbolized|
         
     | 
| 
       81 
39 
     | 
    
         
             
                      symbolized[key.to_sym] = value
         
     | 
| 
         @@ -9,14 +9,27 @@ module Tomo 
     | 
|
| 
       9 
9 
     | 
    
         
             
                      To see a list of all available tasks, run #{blue('tomo tasks')}.
         
     | 
| 
       10 
10 
     | 
    
         
             
                    ERROR
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
                     
     | 
| 
      
 12 
     | 
    
         
            +
                    sugg = spelling_suggestion || missing_plugin_suggestion
         
     | 
| 
      
 13 
     | 
    
         
            +
                    error << sugg if sugg
         
     | 
| 
      
 14 
     | 
    
         
            +
                    error
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
       13 
16 
     | 
    
         | 
| 
      
 17 
     | 
    
         
            +
                  private
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def spelling_suggestion
         
     | 
| 
       14 
20 
     | 
    
         
             
                    sugg = Error::Suggestions.new(
         
     | 
| 
       15 
21 
     | 
    
         
             
                      dictionary: known_tasks,
         
     | 
| 
       16 
22 
     | 
    
         
             
                      word: unknown_task
         
     | 
| 
       17 
23 
     | 
    
         
             
                    )
         
     | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                    sugg.to_console if sugg.any?
         
     | 
| 
      
 25 
     | 
    
         
            +
                  end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                  def missing_plugin_suggestion
         
     | 
| 
      
 28 
     | 
    
         
            +
                    unknown_plugin = unknown_task[/\A(.+?):/, 1]
         
     | 
| 
      
 29 
     | 
    
         
            +
                    known_plugins = known_tasks.map { |t| t.split(":").first }.uniq
         
     | 
| 
      
 30 
     | 
    
         
            +
                    return if unknown_plugin.nil? || known_plugins.include?(unknown_plugin)
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    "\nDid you forget to install the #{blue(unknown_plugin)} plugin?"
         
     | 
| 
       20 
33 
     | 
    
         
             
                  end
         
     | 
| 
       21 
34 
     | 
    
         
             
                end
         
     | 
| 
       22 
35 
     | 
    
         
             
              end
         
     | 
    
        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: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.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: 2019-11- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-11-21 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -150,7 +150,11 @@ dependencies: 
     | 
|
| 
       150 
150 
     | 
    
         
             
                - - '='
         
     | 
| 
       151 
151 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       152 
152 
     | 
    
         
             
                    version: 1.5.1
         
     | 
| 
       153 
     | 
    
         
            -
            description: 
         
     | 
| 
      
 153 
     | 
    
         
            +
            description: Tomo is a feature-rich deployment tool that contains everything you need
         
     | 
| 
      
 154 
     | 
    
         
            +
              to deploy a basic Rails app out of the box. It has an opinionated, production-tested
         
     | 
| 
      
 155 
     | 
    
         
            +
              set of defaults, but is easily extensible via a well-documented plugin system. Unlike
         
     | 
| 
      
 156 
     | 
    
         
            +
              other Ruby-based deployment tools, tomo’s friendly command-line interface and task
         
     | 
| 
      
 157 
     | 
    
         
            +
              system do not rely on Rake.
         
     | 
| 
       154 
158 
     | 
    
         
             
            email:
         
     | 
| 
       155 
159 
     | 
    
         
             
            - opensource@mattbrictson.com
         
     | 
| 
       156 
160 
     | 
    
         
             
            executables:
         
     |