scout-essentials 1.6.4 → 1.6.6
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/Rakefile +1 -0
- data/VERSION +1 -1
- data/lib/scout/annotation/annotated_object.rb +0 -4
- data/lib/scout/annotation.rb +6 -2
- data/lib/scout/config.rb +19 -3
- data/lib/scout/indiferent_hash/options.rb +4 -3
- data/lib/scout/indiferent_hash.rb +49 -8
- data/lib/scout/misc/helper.rb +4 -3
- data/lib/scout/misc/matching.rb +44 -0
- data/lib/scout/misc/math.rb +2 -3
- data/lib/scout/misc/system.rb +17 -1
- data/lib/scout/misc.rb +1 -0
- data/lib/scout/named_array.rb +1 -1
- data/lib/scout/open/remote.rb +11 -0
- data/lib/scout/open/stream.rb +2 -1
- data/lib/scout/path/util.rb +17 -1
- data/lib/scout/resource/produce.rb +2 -2
- data/scout-essentials.gemspec +7 -5
- data/test/scout/misc/test_matching.rb +9 -0
- data/test/scout/path/test_util.rb +8 -0
- data/test/scout/test_config.rb +16 -0
- data/test/scout/test_indiferent_hash.rb +18 -0
- metadata +19 -7
- data/test/scout/annotation/test_annotated_object.rb +0 -0
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 49e4171f1423c14ce88fa83062e7a90febad44c979596dd3e185d296ec37d9bc
         | 
| 4 | 
            +
              data.tar.gz: 174e9b8798c3d2541d1b1ee72233adb98152406dc95611a4e2022938442ce373
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5826fb333507b38743aa46232391eec8208062539d72263794747b8b67b79d642c22146866d207fb69fcc1b35bcba07da4ce9deabf936783aff75e2b6c6ce598
         | 
| 7 | 
            +
              data.tar.gz: 381d4453ac80ee4ac6258da44cd0818f5df046744995620d8fc957e873b874360dfb4915f0e30e2ea3c69faddedff0307db6ecd7429ab96c1f3f5e3696e752b6
         | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            1.6. | 
| 1 | 
            +
            1.6.6
         | 
    
        data/lib/scout/annotation.rb
    CHANGED
    
    | @@ -9,8 +9,12 @@ module Annotation | |
| 9 9 | 
             
                annotation_types = annotation_types.split("|") if String === annotation_types
         | 
| 10 10 | 
             
                annotation_types = [annotation_types] unless Array === annotation_types
         | 
| 11 11 | 
             
                annotation_types.each do |type|
         | 
| 12 | 
            -
                   | 
| 13 | 
            -
             | 
| 12 | 
            +
                  begin
         | 
| 13 | 
            +
                    type = Kernel.const_get(type) if String === type
         | 
| 14 | 
            +
                    type.setup(obj, annotation_hash)
         | 
| 15 | 
            +
                  rescue NameError
         | 
| 16 | 
            +
                    Log.warn "Annotation #{type} not defined"
         | 
| 17 | 
            +
                  end
         | 
| 14 18 | 
             
                end
         | 
| 15 19 | 
             
                obj
         | 
| 16 20 | 
             
              end
         | 
    
        data/lib/scout/config.rb
    CHANGED
    
    | @@ -89,7 +89,19 @@ module Scout::Config | |
| 89 89 | 
             
              # For equal priorities the matching prioritizes tokens ealier in the list
         | 
| 90 90 | 
             
              def self.get(key, *tokens)
         | 
| 91 91 | 
             
                options = tokens.pop if Hash === tokens.last
         | 
| 92 | 
            +
                options = IndiferentHash.setup options if options
         | 
| 93 | 
            +
             | 
| 92 94 | 
             
                default = options.nil? ? nil : options[:default]
         | 
| 95 | 
            +
                env = options.nil? ? nil : options[:env]
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                if env
         | 
| 98 | 
            +
                  env.split(/,\s*/).each do |variable|
         | 
| 99 | 
            +
                    if ENV[variable]
         | 
| 100 | 
            +
                      default = ENV[variable]
         | 
| 101 | 
            +
                      break
         | 
| 102 | 
            +
                    end
         | 
| 103 | 
            +
                  end
         | 
| 104 | 
            +
                end
         | 
| 93 105 |  | 
| 94 106 | 
             
                tokens = ["key:" + key] if tokens.empty?
         | 
| 95 107 |  | 
| @@ -120,12 +132,16 @@ module Scout::Config | |
| 120 132 | 
             
                value = priorities.empty? ? default : priorities.collect{|p| p }.sort_by{|p,v| p}.first.last.first
         | 
| 121 133 | 
             
                value = false if value == 'false'
         | 
| 122 134 |  | 
| 123 | 
            -
                Log.debug "Value #{value.inspect} for config key '#{ key }': #{tokens * ", "}"
         | 
| 135 | 
            +
                Log.debug "Value #{value.inspect} for config key '#{ key }': #{tokens * ", "}" + (env ? " env:#{env}" : '')
         | 
| 124 136 | 
             
                GOT_KEYS << [key, value, tokens]
         | 
| 125 137 |  | 
| 126 138 | 
             
                if String === value && m = value.match(/^env:(.*)/)
         | 
| 127 | 
            -
                   | 
| 128 | 
            -
                   | 
| 139 | 
            +
                  variables = m.captures.first
         | 
| 140 | 
            +
                  variables.split(/,\s*/).each do |variable|
         | 
| 141 | 
            +
                    value = ENV[variable]
         | 
| 142 | 
            +
                    return value if value
         | 
| 143 | 
            +
                  end
         | 
| 144 | 
            +
                  nil
         | 
| 129 145 | 
             
                elsif value == 'nil'
         | 
| 130 146 | 
             
                  nil
         | 
| 131 147 | 
             
                else
         | 
| @@ -29,7 +29,9 @@ module IndiferentHash | |
| 29 29 |  | 
| 30 30 | 
             
              def self.pull_keys(hash, prefix)
         | 
| 31 31 | 
             
                IndiferentHash.setup(hash)
         | 
| 32 | 
            -
                new = hash. | 
| 32 | 
            +
                new = hash.delete("#{prefix}_options") if hash.include?("#{prefix}_options")
         | 
| 33 | 
            +
                new = {} if new.nil?
         | 
| 34 | 
            +
                IndiferentHash.setup(new)
         | 
| 33 35 | 
             
                prefix = prefix.to_s
         | 
| 34 36 | 
             
                hash.keys.each do |key|
         | 
| 35 37 | 
             
                  if key.to_s =~ /#{ prefix }_(.*)/
         | 
| @@ -45,8 +47,7 @@ module IndiferentHash | |
| 45 47 | 
             
                    end
         | 
| 46 48 | 
             
                  end
         | 
| 47 49 | 
             
                end
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                IndiferentHash.setup(new)
         | 
| 50 | 
            +
                new
         | 
| 50 51 | 
             
              end
         | 
| 51 52 |  | 
| 52 53 | 
             
              def self.zip2hash(list1, list2)
         | 
| @@ -17,6 +17,19 @@ module IndiferentHash | |
| 17 17 | 
             
                new
         | 
| 18 18 | 
             
              end
         | 
| 19 19 |  | 
| 20 | 
            +
              def deep_merge(other)
         | 
| 21 | 
            +
                new = self.dup
         | 
| 22 | 
            +
                IndiferentHash.setup(new)
         | 
| 23 | 
            +
                other.each do |k,value|
         | 
| 24 | 
            +
                  if new.include?(k) && IndiferentHash === new[k] && Hash === value
         | 
| 25 | 
            +
                    new[k] = new[k].deep_merge(value)
         | 
| 26 | 
            +
                  else
         | 
| 27 | 
            +
                    new[k] = value
         | 
| 28 | 
            +
                  end
         | 
| 29 | 
            +
                end
         | 
| 30 | 
            +
                new
         | 
| 31 | 
            +
              end
         | 
| 32 | 
            +
             | 
| 20 33 | 
             
              def []=(key,value)
         | 
| 21 34 | 
             
                delete(key)
         | 
| 22 35 | 
             
                super(key,value)
         | 
| @@ -28,16 +41,22 @@ module IndiferentHash | |
| 28 41 |  | 
| 29 42 | 
             
              def [](key)
         | 
| 30 43 | 
             
                res = super(key) 
         | 
| 31 | 
            -
                return res unless res.nil? or (_default? and not keys.include? key)
         | 
| 32 44 |  | 
| 33 | 
            -
                 | 
| 34 | 
            -
             | 
| 35 | 
            -
                   | 
| 36 | 
            -
                when String
         | 
| 37 | 
            -
                  super(key.to_sym)
         | 
| 38 | 
            -
                else
         | 
| 39 | 
            -
                  res
         | 
| 45 | 
            +
                if ! (res.nil? || (_default? and not keys.include?(key)))
         | 
| 46 | 
            +
                  IndiferentHash.setup(res) if Hash === res
         | 
| 47 | 
            +
                  return res
         | 
| 40 48 | 
             
                end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
                res = case key
         | 
| 51 | 
            +
                      when Symbol, Module
         | 
| 52 | 
            +
                        super(key.to_s)
         | 
| 53 | 
            +
                      when String
         | 
| 54 | 
            +
                        super(key.to_sym)
         | 
| 55 | 
            +
                      else
         | 
| 56 | 
            +
                        res
         | 
| 57 | 
            +
                      end
         | 
| 58 | 
            +
                IndiferentHash.setup(res) if Hash === res
         | 
| 59 | 
            +
                res
         | 
| 41 60 | 
             
              end
         | 
| 42 61 |  | 
| 43 62 | 
             
              def values_at(*key_list)
         | 
| @@ -99,5 +118,27 @@ module IndiferentHash | |
| 99 118 | 
             
                  self[key.to_sym] = self.delete(key)
         | 
| 100 119 | 
             
                end
         | 
| 101 120 | 
             
              end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
              def prety_print
         | 
| 123 | 
            +
                Misc.format_definition_list(self, sep: "\n")
         | 
| 124 | 
            +
              end
         | 
| 125 | 
            +
             | 
| 126 | 
            +
              def except(*list)
         | 
| 127 | 
            +
                full_list = list.dup
         | 
| 128 | 
            +
             | 
| 129 | 
            +
                list.each do |e|
         | 
| 130 | 
            +
                  begin
         | 
| 131 | 
            +
                    if String === e
         | 
| 132 | 
            +
                      full_list << e.to_sym
         | 
| 133 | 
            +
                    else
         | 
| 134 | 
            +
                      full_list << e.to_s
         | 
| 135 | 
            +
                    end
         | 
| 136 | 
            +
                  rescue
         | 
| 137 | 
            +
                    next
         | 
| 138 | 
            +
                  end
         | 
| 139 | 
            +
                end
         | 
| 140 | 
            +
             | 
| 141 | 
            +
                super(*full_list)
         | 
| 142 | 
            +
              end
         | 
| 102 143 | 
             
            end
         | 
| 103 144 |  | 
    
        data/lib/scout/misc/helper.rb
    CHANGED
    
    | @@ -34,17 +34,18 @@ module Misc | |
| 34 34 | 
             
              def self.chunk(array, size)
         | 
| 35 35 | 
             
                total = array.length
         | 
| 36 36 | 
             
                current = 0
         | 
| 37 | 
            -
                res = [] | 
| 37 | 
            +
                res = []
         | 
| 38 38 | 
             
                while current < total
         | 
| 39 39 | 
             
                  last = current + size - 1
         | 
| 40 40 | 
             
                  if block_given?
         | 
| 41 | 
            -
                    yield array[current..last]
         | 
| 41 | 
            +
                    r = yield array[current..last]
         | 
| 42 | 
            +
                    res.concat r if Array === r
         | 
| 42 43 | 
             
                  else
         | 
| 43 44 | 
             
                    res << array[current..last]
         | 
| 44 45 | 
             
                  end
         | 
| 45 46 | 
             
                  current = last + 1
         | 
| 46 47 | 
             
                end
         | 
| 47 | 
            -
                 | 
| 48 | 
            +
                res
         | 
| 48 49 | 
             
              end
         | 
| 49 50 |  | 
| 50 51 | 
             
              # Divides the array into +num+ chunks of the same size by placing one
         | 
| @@ -0,0 +1,44 @@ | |
| 1 | 
            +
            module Misc
         | 
| 2 | 
            +
              def self._convert_match_condition(condition)
         | 
| 3 | 
            +
                return true if condition == 'true'
         | 
| 4 | 
            +
                return false if condition == 'false'
         | 
| 5 | 
            +
                return condition.to_regexp if condition[0] == "/"
         | 
| 6 | 
            +
                return [:cmp, $1, $2.to_f] if condition =~ /^([<>]=?)(.*)/
         | 
| 7 | 
            +
                return [:invert, _convert_match_condition(condition[1..-1].strip)] if condition[0] == "!"
         | 
| 8 | 
            +
                #return {$1 => $2.to_f} if condition =~ /^([<>]=?)(.*)/
         | 
| 9 | 
            +
                #return {false => _convert_match_condition(condition[1..-1].strip)} if condition[0] == "!"
         | 
| 10 | 
            +
                return condition
         | 
| 11 | 
            +
              end
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              def self.match_value(value, condition)
         | 
| 14 | 
            +
                condition = _convert_match_condition(condition.strip) if String === condition
         | 
| 15 | 
            +
             | 
| 16 | 
            +
                case condition
         | 
| 17 | 
            +
                when Regexp
         | 
| 18 | 
            +
                  !! value.match(condition)
         | 
| 19 | 
            +
                when NilClass, TrueClass
         | 
| 20 | 
            +
                  value === TrueClass or (String === value and value.downcase == 'true')
         | 
| 21 | 
            +
                when FalseClass
         | 
| 22 | 
            +
                  value === FalseClass or (String === value and value.downcase == 'false')
         | 
| 23 | 
            +
                when String
         | 
| 24 | 
            +
                  Numeric === value ? value.to_f == condition.to_f : value == condition
         | 
| 25 | 
            +
                when Numeric
         | 
| 26 | 
            +
                  value.to_f == condition.to_f
         | 
| 27 | 
            +
                when Array
         | 
| 28 | 
            +
                  case condition.first
         | 
| 29 | 
            +
                  when :cmp
         | 
| 30 | 
            +
                    value.to_f.send(condition[1], condition[2])
         | 
| 31 | 
            +
                  when :invert
         | 
| 32 | 
            +
                    ! match_value(value, condition[1] )
         | 
| 33 | 
            +
                  else
         | 
| 34 | 
            +
                    condition.inject(false){|acc,e| acc = acc ? true : match_value(value, e) }
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
                else
         | 
| 37 | 
            +
                  raise "Condition not understood: #{Misc.fingerprint condition}"
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              def self.tokenize(str)
         | 
| 42 | 
            +
                str.scan(/"([^"]*)"|'([^']*)'|([^"'\s]+)/).flatten.compact
         | 
| 43 | 
            +
              end
         | 
| 44 | 
            +
            end
         | 
    
        data/lib/scout/misc/math.rb
    CHANGED
    
    | @@ -52,7 +52,7 @@ module Misc | |
| 52 52 | 
             
              end
         | 
| 53 53 |  | 
| 54 54 | 
             
              def self.variance(list)
         | 
| 55 | 
            -
                return nil if list.length <  | 
| 55 | 
            +
                return nil if list.length < 2
         | 
| 56 56 | 
             
                mean = mean(list)
         | 
| 57 57 | 
             
                list = list.compact
         | 
| 58 58 | 
             
                list_length = list.length
         | 
| @@ -66,9 +66,8 @@ module Misc | |
| 66 66 | 
             
                total_square_distance / (list_length - 1)
         | 
| 67 67 | 
             
              end
         | 
| 68 68 |  | 
| 69 | 
            -
             | 
| 70 69 | 
             
              def self.sd(list)
         | 
| 71 | 
            -
                return nil if list.length <  | 
| 70 | 
            +
                return nil if list.length < 2
         | 
| 72 71 | 
             
                variance = self.variance(list)
         | 
| 73 72 | 
             
                Math.sqrt(variance)
         | 
| 74 73 | 
             
              end
         | 
    
        data/lib/scout/misc/system.rb
    CHANGED
    
    | @@ -52,7 +52,23 @@ module Misc | |
| 52 52 | 
             
                  ENV[var] = old_value
         | 
| 53 53 | 
             
                end
         | 
| 54 54 | 
             
              end
         | 
| 55 | 
            -
             | 
| 55 | 
            +
             | 
| 56 | 
            +
              def self.with_envs(hash, &block)
         | 
| 57 | 
            +
                old_value = {}
         | 
| 58 | 
            +
                begin
         | 
| 59 | 
            +
                  hash.each do |var,value|
         | 
| 60 | 
            +
                    old_value[var] = ENV[var]
         | 
| 61 | 
            +
                    ENV[var] = value
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                  yield
         | 
| 64 | 
            +
                ensure
         | 
| 65 | 
            +
                  old_value.each do |var,value|
         | 
| 66 | 
            +
                    ENV[var] = value
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
              end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
             | 
| 56 72 | 
             
              def self.update_git(gem_name = 'scout-essentials')
         | 
| 57 73 | 
             
                gem_name = 'scout-essentials' if gem_name.nil?
         | 
| 58 74 | 
             
                dir = File.join(__dir__, '../../../../', gem_name)
         | 
    
        data/lib/scout/misc.rb
    CHANGED
    
    
    
        data/lib/scout/named_array.rb
    CHANGED
    
    | @@ -42,7 +42,7 @@ module NamedArray | |
| 42 42 | 
             
                    pos = names.index{|f| f.to_s == field }
         | 
| 43 43 | 
             
                    next pos if pos
         | 
| 44 44 | 
             
                    if field =~ /^\d+$/
         | 
| 45 | 
            -
                      next  | 
| 45 | 
            +
                      next identify_name(names, field.to_i)
         | 
| 46 46 | 
             
                    end
         | 
| 47 47 | 
             
                    next pos if strict
         | 
| 48 48 | 
             
                    pos = names.index{|name| field_match(field, name) }
         | 
    
        data/lib/scout/open/remote.rb
    CHANGED
    
    | @@ -30,6 +30,17 @@ module Open | |
| 30 30 | 
             
                end
         | 
| 31 31 | 
             
              end
         | 
| 32 32 |  | 
| 33 | 
            +
              LAST_TIME = {}
         | 
| 34 | 
            +
              def self.wait(lag, key = nil)
         | 
| 35 | 
            +
                time = Time.now
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                if LAST_TIME[key] != nil && (time < LAST_TIME[key] + lag)
         | 
| 38 | 
            +
                  sleep (LAST_TIME[key] + lag) - time
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                LAST_TIME[key] = Time.now
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 33 44 | 
             
              def self.wget(url, options = {})
         | 
| 34 45 | 
             
                options = options[:wget_options] if options.include?(:wget_options)
         | 
| 35 46 | 
             
                if ! (options[:force] || options[:nocache]) && cache_file = in_cache(url, options)
         | 
    
        data/lib/scout/open/stream.rb
    CHANGED
    
    | @@ -407,7 +407,8 @@ module Open | |
| 407 407 | 
             
                str
         | 
| 408 408 | 
             
              end
         | 
| 409 409 |  | 
| 410 | 
            -
              def self.sort_stream(stream, header_hash: "#", cmd_args:  | 
| 410 | 
            +
              def self.sort_stream(stream, header_hash: "#", cmd_args: nil, memory: false)
         | 
| 411 | 
            +
                cmd_args = '-u' if cmd_args.nil?
         | 
| 411 412 | 
             
                sout = Open.open_pipe do |sin|
         | 
| 412 413 | 
             
                  ConcurrentStream.process_stream(stream) do
         | 
| 413 414 | 
             
                    line = stream.gets
         | 
    
        data/lib/scout/path/util.rb
    CHANGED
    
    | @@ -82,12 +82,28 @@ module Path | |
| 82 82 | 
             
                end.flatten.uniq
         | 
| 83 83 | 
             
              end
         | 
| 84 84 |  | 
| 85 | 
            +
              def get_extension(multiple = false)
         | 
| 86 | 
            +
                parts = File.basename(self).split(".")
         | 
| 87 | 
            +
                extension = [parts.pop]
         | 
| 88 | 
            +
             | 
| 89 | 
            +
                while parts.length < 5
         | 
| 90 | 
            +
                  extension << [parts.pop]
         | 
| 91 | 
            +
                end if multiple
         | 
| 92 | 
            +
             | 
| 93 | 
            +
                extension * "."
         | 
| 94 | 
            +
              end
         | 
| 95 | 
            +
             | 
| 85 96 | 
             
              def set_extension(extension)
         | 
| 86 97 | 
             
                self.annotate(self + ".#{extension}")
         | 
| 87 98 | 
             
              end
         | 
| 88 99 |  | 
| 89 100 | 
             
              def unset_extension
         | 
| 90 | 
            -
                self. | 
| 101 | 
            +
                parts = self.split("/")
         | 
| 102 | 
            +
                basename = parts.pop
         | 
| 103 | 
            +
                return self unless basename.include?(".")
         | 
| 104 | 
            +
                basename = basename.split(".")[0..-2] * "."
         | 
| 105 | 
            +
                parts.push basename
         | 
| 106 | 
            +
                self.annotate(parts * "/")
         | 
| 91 107 | 
             
              end
         | 
| 92 108 |  | 
| 93 109 | 
             
              def remove_extension(extension = nil)
         | 
| @@ -22,7 +22,7 @@ module Resource | |
| 22 22 | 
             
                }.last
         | 
| 23 23 | 
             
              end
         | 
| 24 24 |  | 
| 25 | 
            -
              def has_rake(path)
         | 
| 25 | 
            +
              def has_rake?(path)
         | 
| 26 26 | 
             
                !! rake_for(path)
         | 
| 27 27 | 
             
              end
         | 
| 28 28 |  | 
| @@ -56,7 +56,7 @@ module Resource | |
| 56 56 | 
             
                  type, content = @resources[path]
         | 
| 57 57 | 
             
                when (Path === path && @resources && @resources.include?(path.original))
         | 
| 58 58 | 
             
                  type, content = @resources[path.original]
         | 
| 59 | 
            -
                when has_rake(path)
         | 
| 59 | 
            +
                when has_rake?(path)
         | 
| 60 60 | 
             
                  type = :rake
         | 
| 61 61 | 
             
                  rake_dir, content = rake_for(path)
         | 
| 62 62 | 
             
                  rake_dir = Path.setup(rake_dir.dup, self.pkgdir, self)
         | 
    
        data/scout-essentials.gemspec
    CHANGED
    
    | @@ -2,16 +2,16 @@ | |
| 2 2 | 
             
            # DO NOT EDIT THIS FILE DIRECTLY
         | 
| 3 3 | 
             
            # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
         | 
| 4 4 | 
             
            # -*- encoding: utf-8 -*-
         | 
| 5 | 
            -
            # stub: scout-essentials 1.6. | 
| 5 | 
            +
            # stub: scout-essentials 1.6.6 ruby lib
         | 
| 6 6 |  | 
| 7 7 | 
             
            Gem::Specification.new do |s|
         | 
| 8 8 | 
             
              s.name = "scout-essentials".freeze
         | 
| 9 | 
            -
              s.version = "1.6. | 
| 9 | 
            +
              s.version = "1.6.6".freeze
         | 
| 10 10 |  | 
| 11 11 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
         | 
| 12 12 | 
             
              s.require_paths = ["lib".freeze]
         | 
| 13 13 | 
             
              s.authors = ["Miguel Vazquez".freeze]
         | 
| 14 | 
            -
              s.date = " | 
| 14 | 
            +
              s.date = "2025-03-10"
         | 
| 15 15 | 
             
              s.description = "Things a scout can use anywhere".freeze
         | 
| 16 16 | 
             
              s.email = "mikisvaz@gmail.com".freeze
         | 
| 17 17 | 
             
              s.extra_rdoc_files = [
         | 
| @@ -52,6 +52,7 @@ Gem::Specification.new do |s| | |
| 52 52 | 
             
                "lib/scout/misc/format.rb",
         | 
| 53 53 | 
             
                "lib/scout/misc/helper.rb",
         | 
| 54 54 | 
             
                "lib/scout/misc/insist.rb",
         | 
| 55 | 
            +
                "lib/scout/misc/matching.rb",
         | 
| 55 56 | 
             
                "lib/scout/misc/math.rb",
         | 
| 56 57 | 
             
                "lib/scout/misc/monitor.rb",
         | 
| 57 58 | 
             
                "lib/scout/misc/system.rb",
         | 
| @@ -90,7 +91,6 @@ Gem::Specification.new do |s| | |
| 90 91 | 
             
                "share/color/color_names",
         | 
| 91 92 | 
             
                "share/color/diverging_colors.hex",
         | 
| 92 93 | 
             
                "share/software/install_helpers",
         | 
| 93 | 
            -
                "test/scout/annotation/test_annotated_object.rb",
         | 
| 94 94 | 
             
                "test/scout/annotation/test_array.rb",
         | 
| 95 95 | 
             
                "test/scout/indiferent_hash/test_case_insensitive.rb",
         | 
| 96 96 | 
             
                "test/scout/indiferent_hash/test_options.rb",
         | 
| @@ -101,6 +101,7 @@ Gem::Specification.new do |s| | |
| 101 101 | 
             
                "test/scout/misc/test_filesystem.rb",
         | 
| 102 102 | 
             
                "test/scout/misc/test_helper.rb",
         | 
| 103 103 | 
             
                "test/scout/misc/test_insist.rb",
         | 
| 104 | 
            +
                "test/scout/misc/test_matching.rb",
         | 
| 104 105 | 
             
                "test/scout/misc/test_math.rb",
         | 
| 105 106 | 
             
                "test/scout/misc/test_system.rb",
         | 
| 106 107 | 
             
                "test/scout/open/test_lock.rb",
         | 
| @@ -138,7 +139,7 @@ Gem::Specification.new do |s| | |
| 138 139 | 
             
              ]
         | 
| 139 140 | 
             
              s.homepage = "http://github.com/mikisvaz/scout-essentials".freeze
         | 
| 140 141 | 
             
              s.licenses = ["MIT".freeze]
         | 
| 141 | 
            -
              s.rubygems_version = "3.5 | 
| 142 | 
            +
              s.rubygems_version = "3.6.5".freeze
         | 
| 142 143 | 
             
              s.summary = "Scout essential tools".freeze
         | 
| 143 144 |  | 
| 144 145 | 
             
              s.specification_version = 4
         | 
| @@ -150,5 +151,6 @@ Gem::Specification.new do |s| | |
| 150 151 | 
             
              s.add_development_dependency(%q<simplecov>.freeze, [">= 0".freeze])
         | 
| 151 152 | 
             
              s.add_runtime_dependency(%q<term-ansicolor>.freeze, [">= 0".freeze])
         | 
| 152 153 | 
             
              s.add_runtime_dependency(%q<yaml>.freeze, [">= 0".freeze])
         | 
| 154 | 
            +
              s.add_runtime_dependency(%q<rake>.freeze, [">= 0".freeze])
         | 
| 153 155 | 
             
            end
         | 
| 154 156 |  | 
| @@ -0,0 +1,9 @@ | |
| 1 | 
            +
            require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
         | 
| 2 | 
            +
            require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            class TestMatches < Test::Unit::TestCase
         | 
| 5 | 
            +
              def test_match_value
         | 
| 6 | 
            +
                assert Misc.match_value('test', 'test')
         | 
| 7 | 
            +
              end
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| @@ -18,5 +18,13 @@ class TestPathUtil < Test::Unit::TestCase | |
| 18 18 | 
             
                  assert_equal %w(foo bar).sort, tmpdir.glob.collect{|p| p.basename }.sort
         | 
| 19 19 | 
             
                end
         | 
| 20 20 | 
             
              end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
              def test_unset_extension
         | 
| 23 | 
            +
                path = Path.setup("/home/.scout/dir/file.txt")
         | 
| 24 | 
            +
                assert_equal "/home/.scout/dir/file", path.unset_extension
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                path = Path.setup("/home/.scout/dir/file")
         | 
| 27 | 
            +
                assert_equal "/home/.scout/dir/file", path.unset_extension
         | 
| 28 | 
            +
              end
         | 
| 21 29 | 
             
            end
         | 
| 22 30 |  | 
    
        data/test/scout/test_config.rb
    CHANGED
    
    | @@ -63,4 +63,20 @@ class TestConfig < Test::Unit::TestCase | |
| 63 63 | 
             
                Scout::Config.add_entry 'key', 'V1', 'token1'
         | 
| 64 64 | 
             
                assert_equal "V3", Scout::Config.get('key', 'token2', :default => 'V3')
         | 
| 65 65 | 
             
              end
         | 
| 66 | 
            +
             | 
| 67 | 
            +
              def test_env
         | 
| 68 | 
            +
                Misc.with_env "TEST_VAR", "TEST" do
         | 
| 69 | 
            +
                  assert_equal "TEST", Scout::Config.get("value", :key, :env => "TEST_VAR")
         | 
| 70 | 
            +
                  Scout::Config.set "value", 'env:TEST_VAR', 'key'
         | 
| 71 | 
            +
                  assert_equal "TEST", Scout::Config.get(:value, :key)
         | 
| 72 | 
            +
                end
         | 
| 73 | 
            +
              end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
              def test_env_multiple
         | 
| 76 | 
            +
                Misc.with_env "TEST_VAR", "TEST" do
         | 
| 77 | 
            +
                  assert_equal "TEST", Scout::Config.get("value", :key, :env => "TEST_VAR,TESTVAR")
         | 
| 78 | 
            +
                  Scout::Config.set "value", 'env:TEST_VAR,TESTVAR', 'key'
         | 
| 79 | 
            +
                  assert_equal "TEST", Scout::Config.get(:value, :key)
         | 
| 80 | 
            +
                end
         | 
| 81 | 
            +
              end
         | 
| 66 82 | 
             
            end
         | 
| @@ -22,5 +22,23 @@ class TestClass < Test::Unit::TestCase | |
| 22 22 | 
             
                assert_equal 2, a["B"]
         | 
| 23 23 | 
             
                assert_equal 2, a[:b]
         | 
| 24 24 | 
             
              end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
              def test_deep_merge
         | 
| 27 | 
            +
                o = {h: {a: 1, b: 2}}
         | 
| 28 | 
            +
                n = {h: {c: 3}}
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                IndiferentHash.setup(o)
         | 
| 31 | 
            +
                o = o.deep_merge(n)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                assert_equal 1, o[:h]["a"]
         | 
| 34 | 
            +
                assert_equal 3, o[:h]["c"]
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
              def test_except
         | 
| 38 | 
            +
                h = {:a => 1, "b" => 2}
         | 
| 39 | 
            +
                IndiferentHash.setup(h)
         | 
| 40 | 
            +
                assert_equal [:a], h.except(:b).keys
         | 
| 41 | 
            +
                assert_equal ["b"], h.except("a").keys
         | 
| 42 | 
            +
              end
         | 
| 25 43 | 
             
            end
         | 
| 26 44 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: scout-essentials
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.6. | 
| 4 | 
            +
              version: 1.6.6
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Miguel Vazquez
         | 
| 8 | 
            -
            autorequire: 
         | 
| 9 8 | 
             
            bindir: bin
         | 
| 10 9 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 10 | 
            +
            date: 2025-03-10 00:00:00.000000000 Z
         | 
| 12 11 | 
             
            dependencies:
         | 
| 13 12 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 13 | 
             
              name: shoulda
         | 
| @@ -108,6 +107,20 @@ dependencies: | |
| 108 107 | 
             
                - - ">="
         | 
| 109 108 | 
             
                  - !ruby/object:Gem::Version
         | 
| 110 109 | 
             
                    version: '0'
         | 
| 110 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 111 | 
            +
              name: rake
         | 
| 112 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 113 | 
            +
                requirements:
         | 
| 114 | 
            +
                - - ">="
         | 
| 115 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 116 | 
            +
                    version: '0'
         | 
| 117 | 
            +
              type: :runtime
         | 
| 118 | 
            +
              prerelease: false
         | 
| 119 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 120 | 
            +
                requirements:
         | 
| 121 | 
            +
                - - ">="
         | 
| 122 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 123 | 
            +
                    version: '0'
         | 
| 111 124 | 
             
            description: Things a scout can use anywhere
         | 
| 112 125 | 
             
            email: mikisvaz@gmail.com
         | 
| 113 126 | 
             
            executables: []
         | 
| @@ -149,6 +162,7 @@ files: | |
| 149 162 | 
             
            - lib/scout/misc/format.rb
         | 
| 150 163 | 
             
            - lib/scout/misc/helper.rb
         | 
| 151 164 | 
             
            - lib/scout/misc/insist.rb
         | 
| 165 | 
            +
            - lib/scout/misc/matching.rb
         | 
| 152 166 | 
             
            - lib/scout/misc/math.rb
         | 
| 153 167 | 
             
            - lib/scout/misc/monitor.rb
         | 
| 154 168 | 
             
            - lib/scout/misc/system.rb
         | 
| @@ -187,7 +201,6 @@ files: | |
| 187 201 | 
             
            - share/color/color_names
         | 
| 188 202 | 
             
            - share/color/diverging_colors.hex
         | 
| 189 203 | 
             
            - share/software/install_helpers
         | 
| 190 | 
            -
            - test/scout/annotation/test_annotated_object.rb
         | 
| 191 204 | 
             
            - test/scout/annotation/test_array.rb
         | 
| 192 205 | 
             
            - test/scout/indiferent_hash/test_case_insensitive.rb
         | 
| 193 206 | 
             
            - test/scout/indiferent_hash/test_options.rb
         | 
| @@ -198,6 +211,7 @@ files: | |
| 198 211 | 
             
            - test/scout/misc/test_filesystem.rb
         | 
| 199 212 | 
             
            - test/scout/misc/test_helper.rb
         | 
| 200 213 | 
             
            - test/scout/misc/test_insist.rb
         | 
| 214 | 
            +
            - test/scout/misc/test_matching.rb
         | 
| 201 215 | 
             
            - test/scout/misc/test_math.rb
         | 
| 202 216 | 
             
            - test/scout/misc/test_system.rb
         | 
| 203 217 | 
             
            - test/scout/open/test_lock.rb
         | 
| @@ -236,7 +250,6 @@ homepage: http://github.com/mikisvaz/scout-essentials | |
| 236 250 | 
             
            licenses:
         | 
| 237 251 | 
             
            - MIT
         | 
| 238 252 | 
             
            metadata: {}
         | 
| 239 | 
            -
            post_install_message: 
         | 
| 240 253 | 
             
            rdoc_options: []
         | 
| 241 254 | 
             
            require_paths:
         | 
| 242 255 | 
             
            - lib
         | 
| @@ -251,8 +264,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 251 264 | 
             
                - !ruby/object:Gem::Version
         | 
| 252 265 | 
             
                  version: '0'
         | 
| 253 266 | 
             
            requirements: []
         | 
| 254 | 
            -
            rubygems_version: 3.5 | 
| 255 | 
            -
            signing_key: 
         | 
| 267 | 
            +
            rubygems_version: 3.6.5
         | 
| 256 268 | 
             
            specification_version: 4
         | 
| 257 269 | 
             
            summary: Scout essential tools
         | 
| 258 270 | 
             
            test_files: []
         | 
| 
            File without changes
         |