scout-essentials 1.1.0 → 1.1.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/VERSION +1 -1
 - data/lib/scout/log/fingerprint.rb +9 -4
 - data/lib/scout/meta_extension.rb +2 -1
 - data/lib/scout/misc/digest.rb +2 -0
 - data/lib/scout/misc/monitor.rb +2 -2
 - data/lib/scout/open/remote.rb +1 -0
 - data/lib/scout/open/util.rb +4 -0
 - data/lib/scout/path/find.rb +2 -2
 - data/lib/scout/path/util.rb +4 -0
 - data/lib/scout/persist/serialize.rb +1 -1
 - data/scout-essentials.gemspec +4 -3
 - data/test/scout/log/test_fingerprint.rb +10 -0
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: b180a31f0775b92588e69028899896e5d7a865a818eaa3ac07235e9e3cbe0a4b
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: dee502eb8812dd3dbeb039858225110114b7b6279eb6fb7c062dff3f86e697d7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 224014296d5798f7dbe980d67eb241456c62de05b21ddaf255c429f1f8c76a3d28de89fdff69f8c37ed06e8de65cc244a77f9d34004545318d986c8386de2ff2
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: de7644e77bac10982314a1f73ea200294755901e66aff6010c027c6808f3209c35da1d6675a179689662c6c57370ddf8c2f61bf5df358b59fe747936d682f889
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            1.1. 
     | 
| 
      
 1 
     | 
    
         
            +
            1.1.1
         
     | 
| 
         @@ -1,5 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'digest/md5'
         
     | 
| 
       2 
2 
     | 
    
         
             
            module Log
         
     | 
| 
      
 3 
     | 
    
         
            +
              FP_MAX_STRING = 150
         
     | 
| 
      
 4 
     | 
    
         
            +
              FP_MAX_ARRAY = 20
         
     | 
| 
      
 5 
     | 
    
         
            +
              FP_MAX_HASH = 10
         
     | 
| 
       3 
6 
     | 
    
         
             
              def self.fingerprint(obj)
         
     | 
| 
       4 
7 
     | 
    
         
             
                return obj.fingerprint if obj.respond_to?(:fingerprint)
         
     | 
| 
       5 
8 
     | 
    
         | 
| 
         @@ -13,9 +16,11 @@ module Log 
     | 
|
| 
       13 
16 
     | 
    
         
             
                when Symbol
         
     | 
| 
       14 
17 
     | 
    
         
             
                  ":" << obj.to_s
         
     | 
| 
       15 
18 
     | 
    
         
             
                when String
         
     | 
| 
       16 
     | 
    
         
            -
                  if obj.length >  
     | 
| 
      
 19 
     | 
    
         
            +
                  if obj.length > FP_MAX_STRING
         
     | 
| 
       17 
20 
     | 
    
         
             
                    digest = Digest::MD5.hexdigest(obj)
         
     | 
| 
       18 
     | 
    
         
            -
                     
     | 
| 
      
 21 
     | 
    
         
            +
                    middle = "<...#{obj.length} - #{digest[0..4]}...>"
         
     | 
| 
      
 22 
     | 
    
         
            +
                    s = (FP_MAX_STRING - middle.length) / 2
         
     | 
| 
      
 23 
     | 
    
         
            +
                    "'" << obj.slice(0,s-1) << middle << obj.slice(-s, obj.length )<< "'"
         
     | 
| 
       19 
24 
     | 
    
         
             
                  else 
         
     | 
| 
       20 
25 
     | 
    
         
             
                    "'" << obj << "'"
         
     | 
| 
       21 
26 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -28,13 +33,13 @@ module Log 
     | 
|
| 
       28 
33 
     | 
    
         
             
                when File
         
     | 
| 
       29 
34 
     | 
    
         
             
                  "<File:" + obj.path + ">"
         
     | 
| 
       30 
35 
     | 
    
         
             
                when Array
         
     | 
| 
       31 
     | 
    
         
            -
                  if (length = obj.length) >  
     | 
| 
      
 36 
     | 
    
         
            +
                  if (length = obj.length) > FP_MAX_ARRAY
         
     | 
| 
       32 
37 
     | 
    
         
             
                    "[#{length}--" <<  (obj.values_at(0,1, length / 2, -2, -1).collect{|e| fingerprint(e)} * ",") << "]"
         
     | 
| 
       33 
38 
     | 
    
         
             
                  else
         
     | 
| 
       34 
39 
     | 
    
         
             
                    "[" << (obj.collect{|e| fingerprint(e) } * ", ") << "]"
         
     | 
| 
       35 
40 
     | 
    
         
             
                  end
         
     | 
| 
       36 
41 
     | 
    
         
             
                when Hash
         
     | 
| 
       37 
     | 
    
         
            -
                  if obj.length >  
     | 
| 
      
 42 
     | 
    
         
            +
                  if obj.length > FP_MAX_HASH
         
     | 
| 
       38 
43 
     | 
    
         
             
                    "H:{"<< fingerprint(obj.keys) << ";" << fingerprint(obj.values) << "}"
         
     | 
| 
       39 
44 
     | 
    
         
             
                  else
         
     | 
| 
       40 
45 
     | 
    
         
             
                    new = "{"
         
     | 
    
        data/lib/scout/meta_extension.rb
    CHANGED
    
    | 
         @@ -68,7 +68,8 @@ module MetaExtension 
     | 
|
| 
       68 
68 
     | 
    
         | 
| 
       69 
69 
     | 
    
         
             
                  if new.instance_variables.include?(:@extension_attrs)
         
     | 
| 
       70 
70 
     | 
    
         
             
                    new.instance_variable_get(:@extension_attrs).each do |a|
         
     | 
| 
       71 
     | 
    
         
            -
                       
     | 
| 
      
 71 
     | 
    
         
            +
                      var_name = "@#{a}".to_sym
         
     | 
| 
      
 72 
     | 
    
         
            +
                      new.remove_instance_variable(var_name) if new.instance_variables.include? var_name
         
     | 
| 
       72 
73 
     | 
    
         
             
                    end
         
     | 
| 
       73 
74 
     | 
    
         
             
                    new.remove_instance_variable("@extension_attrs")
         
     | 
| 
       74 
75 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/scout/misc/digest.rb
    CHANGED
    
    
    
        data/lib/scout/misc/monitor.rb
    CHANGED
    
    
    
        data/lib/scout/open/remote.rb
    CHANGED
    
    
    
        data/lib/scout/open/util.rb
    CHANGED
    
    | 
         @@ -114,6 +114,10 @@ module Open 
     | 
|
| 
       114 
114 
     | 
    
         
             
              end
         
     | 
| 
       115 
115 
     | 
    
         
             
              class << self; alias exist? exists? end
         
     | 
| 
       116 
116 
     | 
    
         | 
| 
      
 117 
     | 
    
         
            +
              def self.exist_or_link?(file)
         
     | 
| 
      
 118 
     | 
    
         
            +
                self.exists?(file) || File.symlink?(file)
         
     | 
| 
      
 119 
     | 
    
         
            +
              end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
       117 
121 
     | 
    
         
             
              def self.mv(source, target, options = {})
         
     | 
| 
       118 
122 
     | 
    
         
             
                target = target.find if Path === target
         
     | 
| 
       119 
123 
     | 
    
         
             
                source = source.find if Path === source
         
     | 
    
        data/lib/scout/path/find.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ require_relative '../indiferent_hash' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            module Path
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
4 
     | 
    
         
             
              def self.caller_lib_dir(file = nil, relative_to = ['lib', 'bin'])
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       6 
6 
     | 
    
         
             
                if file.nil?
         
     | 
| 
       7 
7 
     | 
    
         
             
                  caller_dup = caller.dup
         
     | 
| 
       8 
8 
     | 
    
         
             
                  while file = caller_dup.shift
         
     | 
| 
         @@ -41,7 +41,7 @@ module Path 
     | 
|
| 
       41 
41 
     | 
    
         
             
                  sub('{SUBPATH}', path._subpath).
         
     | 
| 
       42 
42 
     | 
    
         
             
                  sub('{BASENAME}', File.basename(path)).
         
     | 
| 
       43 
43 
     | 
    
         
             
                  sub('{PATH}', path).
         
     | 
| 
       44 
     | 
    
         
            -
                  sub('{LIBDIR}' 
     | 
| 
      
 44 
     | 
    
         
            +
                  sub('{LIBDIR}'){ path.libdir || (path.pkgdir.respond_to?(:libdir) && path.pkgdir.libdir) || Path.caller_lib_dir || "NOLIBDIR" }.
         
     | 
| 
       45 
45 
     | 
    
         
             
                  sub('{MAPNAME}', map_name.to_s).
         
     | 
| 
       46 
46 
     | 
    
         
             
                  sub('{REMOVE}/', '').
         
     | 
| 
       47 
47 
     | 
    
         
             
                  sub('{REMOVE}', '').gsub(/\/+/,'/')
         
     | 
    
        data/lib/scout/path/util.rb
    CHANGED
    
    
    
        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.1. 
     | 
| 
      
 5 
     | 
    
         
            +
            # stub: scout-essentials 1.1.1 ruby lib
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            Gem::Specification.new do |s|
         
     | 
| 
       8 
8 
     | 
    
         
             
              s.name = "scout-essentials".freeze
         
     | 
| 
       9 
     | 
    
         
            -
              s.version = "1.1. 
     | 
| 
      
 9 
     | 
    
         
            +
              s.version = "1.1.1"
         
     | 
| 
       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 = "2023- 
     | 
| 
      
 14 
     | 
    
         
            +
              s.date = "2023-08-01"
         
     | 
| 
       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 = [
         
     | 
| 
         @@ -88,6 +88,7 @@ Gem::Specification.new do |s| 
     | 
|
| 
       88 
88 
     | 
    
         
             
                "test/scout/indiferent_hash/test_case_insensitive.rb",
         
     | 
| 
       89 
89 
     | 
    
         
             
                "test/scout/indiferent_hash/test_options.rb",
         
     | 
| 
       90 
90 
     | 
    
         
             
                "test/scout/log/test_color.rb",
         
     | 
| 
      
 91 
     | 
    
         
            +
                "test/scout/log/test_fingerprint.rb",
         
     | 
| 
       91 
92 
     | 
    
         
             
                "test/scout/log/test_progress.rb",
         
     | 
| 
       92 
93 
     | 
    
         
             
                "test/scout/misc/test_digest.rb",
         
     | 
| 
       93 
94 
     | 
    
         
             
                "test/scout/misc/test_filesystem.rb",
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 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 TestFingerprint < Test::Unit::TestCase
         
     | 
| 
      
 5 
     | 
    
         
            +
              def test_str
         
     | 
| 
      
 6 
     | 
    
         
            +
                str = "Start-" + ("0123456789" * 20) + "-End"
         
     | 
| 
      
 7 
     | 
    
         
            +
                assert_equal 150, Log.fingerprint(str).length
         
     | 
| 
      
 8 
     | 
    
         
            +
              end
         
     | 
| 
      
 9 
     | 
    
         
            +
            end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: scout-essentials
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Miguel Vazquez
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2023- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2023-08-01 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: shoulda
         
     | 
| 
         @@ -185,6 +185,7 @@ files: 
     | 
|
| 
       185 
185 
     | 
    
         
             
            - test/scout/indiferent_hash/test_case_insensitive.rb
         
     | 
| 
       186 
186 
     | 
    
         
             
            - test/scout/indiferent_hash/test_options.rb
         
     | 
| 
       187 
187 
     | 
    
         
             
            - test/scout/log/test_color.rb
         
     | 
| 
      
 188 
     | 
    
         
            +
            - test/scout/log/test_fingerprint.rb
         
     | 
| 
       188 
189 
     | 
    
         
             
            - test/scout/log/test_progress.rb
         
     | 
| 
       189 
190 
     | 
    
         
             
            - test/scout/misc/test_digest.rb
         
     | 
| 
       190 
191 
     | 
    
         
             
            - test/scout/misc/test_filesystem.rb
         
     |