judges 0.42.1 ā 0.43.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/.github/workflows/eslint.yml +2 -3
- data/.github/workflows/markdown-lint.yml +1 -1
- data/.gitignore +1 -0
- data/Gemfile.lock +4 -2
- data/assets/index.js +3 -3
- data/bin/judges +47 -45
- data/features/import.feature +1 -1
- data/features/update.feature +5 -5
- data/judges.gemspec +1 -1
- data/lib/judges/commands/eval.rb +2 -2
- data/lib/judges/commands/import.rb +2 -2
- data/lib/judges/commands/inspect.rb +2 -2
- data/lib/judges/commands/join.rb +2 -2
- data/lib/judges/commands/print.rb +4 -3
- data/lib/judges/commands/pull.rb +5 -4
- data/lib/judges/commands/push.rb +3 -2
- data/lib/judges/commands/test.rb +2 -1
- data/lib/judges/commands/trim.rb +4 -3
- data/lib/judges/commands/update.rb +11 -3
- data/lib/judges/judge.rb +1 -1
- data/lib/judges.rb +1 -1
- data/package-lock.json +34 -915
- data/package.json +3 -2
- data/test/commands/test_update.rb +15 -0
- data/test/test__helper.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 9872185eca6e28654c9ee3395817985e8762408d022d961e189cbfcfab7c2ac8
         | 
| 4 | 
            +
              data.tar.gz: 0c83c8a61f2661a17f8473469920b7e7c493be4d30e8f2f1bca7f3afaf6e6049
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 76d8a0e542efee6b6e444857b4e1dbe3ff40ddb482f3f109e1170a8f9281021d5ff1952ac74d53aad513aaf3e87441f39080ec6c6adda0300c06566d37b85b9c
         | 
| 7 | 
            +
              data.tar.gz: 6222dc327c05ee568395feb6c0b05ba37a5a152ac7d4d51b2be71b7be0262617ac82160491e13b90330729b10e6104e11fd3f50ce3ff8ea3ed47598057a4b9a5
         | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -78,6 +78,7 @@ GEM | |
| 78 78 | 
             
                elapsed (0.0.1)
         | 
| 79 79 | 
             
                  loog (> 0)
         | 
| 80 80 | 
             
                  tago (> 0)
         | 
| 81 | 
            +
                erb (5.0.1)
         | 
| 81 82 | 
             
                ethon (0.16.0)
         | 
| 82 83 | 
             
                  ffi (>= 1.15.0)
         | 
| 83 84 | 
             
                factbase (0.10.2)
         | 
| @@ -111,7 +112,7 @@ GEM | |
| 111 112 | 
             
                ffi (1.17.2-x86_64-linux-gnu)
         | 
| 112 113 | 
             
                gli (2.22.2)
         | 
| 113 114 | 
             
                  ostruct
         | 
| 114 | 
            -
                hashdiff (1. | 
| 115 | 
            +
                hashdiff (1.2.0)
         | 
| 115 116 | 
             
                iri (0.10.0)
         | 
| 116 117 | 
             
                json (2.12.0)
         | 
| 117 118 | 
             
                language_server-protocol (3.17.0.5)
         | 
| @@ -172,7 +173,8 @@ GEM | |
| 172 173 | 
             
                rake (13.2.1)
         | 
| 173 174 | 
             
                random-port (0.7.5)
         | 
| 174 175 | 
             
                  tago (> 0)
         | 
| 175 | 
            -
                rdoc (6. | 
| 176 | 
            +
                rdoc (6.14.0)
         | 
| 177 | 
            +
                  erb
         | 
| 176 178 | 
             
                  psych (>= 4.0.0)
         | 
| 177 179 | 
             
                regexp_parser (2.10.0)
         | 
| 178 180 | 
             
                retries (0.0.5)
         | 
    
        data/assets/index.js
    CHANGED
    
    
    
        data/bin/judges
    CHANGED
    
    | @@ -23,7 +23,7 @@ class JudgesGLI extend GLI::App | |
| 23 23 | 
             
                  start = Time.now
         | 
| 24 24 | 
             
                  @@loog.debug("Running '#{ruby}' command...")
         | 
| 25 25 | 
             
                  Object.const_get("Judges::#{ruby.capitalize}").new(@@loog).run(options, args)
         | 
| 26 | 
            -
                  @@loog.debug("Command '#{ruby}'  | 
| 26 | 
            +
                  @@loog.debug("Command '#{ruby}' completed in #{start.ago}")
         | 
| 27 27 | 
             
                end
         | 
| 28 28 | 
             
              end
         | 
| 29 29 |  | 
| @@ -37,9 +37,9 @@ class JudgesGLI extend GLI::App | |
| 37 37 |  | 
| 38 38 | 
             
              subcommand_option_handling(:normal)
         | 
| 39 39 |  | 
| 40 | 
            -
              desc ' | 
| 40 | 
            +
              desc 'Enable verbose mode with maximum logging'
         | 
| 41 41 | 
             
              switch([:v, :verbose])
         | 
| 42 | 
            -
              desc ' | 
| 42 | 
            +
              desc 'Specify Factbase version to use'
         | 
| 43 43 | 
             
              flag([:factbase], type: String)
         | 
| 44 44 |  | 
| 45 45 | 
             
              pre do |global, command, options, args|
         | 
| @@ -61,36 +61,38 @@ class JudgesGLI extend GLI::App | |
| 61 61 | 
             
                true
         | 
| 62 62 | 
             
              end
         | 
| 63 63 |  | 
| 64 | 
            -
              desc 'Update the factbase by  | 
| 64 | 
            +
              desc 'Update the factbase by executing all judges sequentially'
         | 
| 65 65 | 
             
              command :update do |c|
         | 
| 66 | 
            -
                c.desc 'Options to pass to  | 
| 66 | 
            +
                c.desc 'Options to pass to each judge'
         | 
| 67 67 | 
             
                c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
         | 
| 68 | 
            -
                c.desc 'File  | 
| 68 | 
            +
                c.desc 'File containing options, one key=value pair per line'
         | 
| 69 69 | 
             
                c.flag([:'options-file'])
         | 
| 70 70 | 
             
                c.desc 'Name of the judge to run (directory name)'
         | 
| 71 71 | 
             
                c.flag([:judge], multiple: true)
         | 
| 72 | 
            -
                c.desc ' | 
| 72 | 
            +
                c.desc 'Location of a Ruby library (directory with .rb files to include)'
         | 
| 73 73 | 
             
                c.flag([:lib])
         | 
| 74 | 
            -
                c.desc 'Shuffle  | 
| 74 | 
            +
                c.desc 'Shuffle judges, except those starting with the specified prefix'
         | 
| 75 75 | 
             
                c.flag([:shuffle], default_value: '')
         | 
| 76 | 
            -
                c.desc ' | 
| 76 | 
            +
                c.desc 'Prioritize a judge to run before all others'
         | 
| 77 77 | 
             
                c.flag([:boost], multiple: true)
         | 
| 78 | 
            -
                c.desc 'Maximum time in seconds  | 
| 78 | 
            +
                c.desc 'Maximum time in seconds for the entire update cycle'
         | 
| 79 79 | 
             
                c.flag([:lifetime], default_value: 300, type: Integer)
         | 
| 80 | 
            -
                c.desc 'Maximum time in seconds  | 
| 80 | 
            +
                c.desc 'Maximum time in seconds for each judge (forcefully terminates if exceeded)'
         | 
| 81 81 | 
             
                c.flag([:timeout], default_value: 30, type: Integer)
         | 
| 82 82 | 
             
                c.desc 'Maximum number of update cycles to run'
         | 
| 83 83 | 
             
                c.flag([:'max-cycles'], default_value: 8, type: Integer)
         | 
| 84 | 
            -
                c.desc ' | 
| 84 | 
            +
                c.desc 'Suppress errors even when judges fail'
         | 
| 85 85 | 
             
                c.switch([:q, :quiet], default_value: false)
         | 
| 86 | 
            -
                c.desc ' | 
| 86 | 
            +
                c.desc 'Stop processing immediately after the first error'
         | 
| 87 | 
            +
                c.switch([:'fail-fast'], default_value: false)
         | 
| 88 | 
            +
                c.desc 'Add a summary fact to the factbase'
         | 
| 87 89 | 
             
                c.switch([:summary], default_value: false)
         | 
| 88 90 | 
             
                c.desc 'Use default logging facility'
         | 
| 89 91 | 
             
                c.switch([:log], default_value: true)
         | 
| 90 92 | 
             
                run_it(c, 'update')
         | 
| 91 93 | 
             
              end
         | 
| 92 94 |  | 
| 93 | 
            -
              desc 'Evaluate a single Ruby expression  | 
| 95 | 
            +
              desc 'Evaluate a single Ruby expression against the factbase'
         | 
| 94 96 | 
             
              command :eval do |c|
         | 
| 95 97 | 
             
                c.desc 'Use default logging facility'
         | 
| 96 98 | 
             
                c.switch([:log], default_value: true)
         | 
| @@ -109,40 +111,40 @@ class JudgesGLI extend GLI::App | |
| 109 111 | 
             
                run_it(c, 'import')
         | 
| 110 112 | 
             
              end
         | 
| 111 113 |  | 
| 112 | 
            -
              desc 'Remove  | 
| 114 | 
            +
              desc 'Remove outdated facts from the factbase'
         | 
| 113 115 | 
             
              command :trim do |c|
         | 
| 114 | 
            -
                c.desc ' | 
| 116 | 
            +
                c.desc 'Delete only facts matching the specified expression'
         | 
| 115 117 | 
             
                c.flag([:query], default_value: '(never)')
         | 
| 116 118 | 
             
                run_it(c, 'trim')
         | 
| 117 119 | 
             
              end
         | 
| 118 120 |  | 
| 119 | 
            -
              desc ' | 
| 121 | 
            +
              desc 'Convert the factbase to a human-readable format (YAML, JSON, etc.)'
         | 
| 120 122 | 
             
              command :print do |c|
         | 
| 121 123 | 
             
                c.desc 'Output format (xml, json, or yaml)'
         | 
| 122 124 | 
             
                c.flag([:format], default_value: 'yaml')
         | 
| 123 | 
            -
                c.desc ' | 
| 125 | 
            +
                c.desc 'Automatically generate the output filename'
         | 
| 124 126 | 
             
                c.switch([:auto], default_value: false)
         | 
| 125 | 
            -
                c.desc ' | 
| 127 | 
            +
                c.desc 'Document title to use'
         | 
| 126 128 | 
             
                c.flag([:title], default_value: 'summary')
         | 
| 127 | 
            -
                c.desc ' | 
| 129 | 
            +
                c.desc 'Print only facts matching the specified expression'
         | 
| 128 130 | 
             
                c.flag([:query], default_value: '(always)')
         | 
| 129 | 
            -
                c.desc 'Comma | 
| 131 | 
            +
                c.desc 'Comma-separated list of columns to display in HTML output (no spaces)'
         | 
| 130 132 | 
             
                c.flag([:columns], default_value: 'when,what')
         | 
| 131 | 
            -
                c.desc 'Comma | 
| 133 | 
            +
                c.desc 'Comma-separated list of columns to hide from rendering (no spaces)'
         | 
| 132 134 | 
             
                c.flag([:hidden], default_value: '_id,_time,_version,_job')
         | 
| 133 | 
            -
                c.desc ' | 
| 135 | 
            +
                c.desc 'Force printing even if the target file exists and is older than the factbase'
         | 
| 134 136 | 
             
                c.switch([:force], default_value: false)
         | 
| 135 137 | 
             
                run_it(c, 'print')
         | 
| 136 138 | 
             
              end
         | 
| 137 139 |  | 
| 138 | 
            -
              desc 'Inspect the factbase and  | 
| 140 | 
            +
              desc 'Inspect the factbase and display all available metadata'
         | 
| 139 141 | 
             
              command :inspect do |c|
         | 
| 140 142 | 
             
                run_it(c, 'inspect')
         | 
| 141 143 | 
             
              end
         | 
| 142 144 |  | 
| 143 145 | 
             
              desc 'Run automated tests for all judges'
         | 
| 144 146 | 
             
              command :test do |c|
         | 
| 145 | 
            -
                c.desc 'Options to pass to  | 
| 147 | 
            +
                c.desc 'Options to pass to each judge (may be overridden by YAML)'
         | 
| 146 148 | 
             
                c.flag([:o, :option], multiple: true, arg_name: '<key=value>')
         | 
| 147 149 | 
             
                c.desc 'Categories of tests to disable'
         | 
| 148 150 | 
             
                c.flag([:disable], multiple: true)
         | 
| @@ -150,57 +152,57 @@ class JudgesGLI extend GLI::App | |
| 150 152 | 
             
                c.flag([:enable], multiple: true)
         | 
| 151 153 | 
             
                c.desc 'Name of the judge to run (directory name)'
         | 
| 152 154 | 
             
                c.flag([:judge], multiple: true)
         | 
| 153 | 
            -
                c.desc ' | 
| 155 | 
            +
                c.desc 'Number of times to run the tests'
         | 
| 154 156 | 
             
                c.flag([:runs], type: Integer)
         | 
| 155 | 
            -
                c.desc ' | 
| 157 | 
            +
                c.desc 'Location of a Ruby library (directory with .rb files to include)'
         | 
| 156 158 | 
             
                c.flag([:lib])
         | 
| 157 | 
            -
                c.desc ' | 
| 159 | 
            +
                c.desc 'Suppress output even if tests fail or none are executed'
         | 
| 158 160 | 
             
                c.switch([:quiet], default_value: false)
         | 
| 159 161 | 
             
                c.desc 'Use default logging facility'
         | 
| 160 162 | 
             
                c.switch([:log], default_value: true)
         | 
| 161 163 | 
             
                run_it(c, 'test')
         | 
| 162 164 | 
             
              end
         | 
| 163 165 |  | 
| 164 | 
            -
              desc 'Push the factbase to the server and unlock it  | 
| 166 | 
            +
              desc 'Push the factbase to the server and unlock it remotely'
         | 
| 165 167 | 
             
              command :push do |c|
         | 
| 166 168 | 
             
                c.desc 'Authentication token'
         | 
| 167 169 | 
             
                c.flag([:token])
         | 
| 168 | 
            -
                c.desc ' | 
| 170 | 
            +
                c.desc 'Server IP/hostname'
         | 
| 169 171 | 
             
                c.flag([:host], default_value: 'api.zerocracy.com')
         | 
| 170 | 
            -
                c.desc ' | 
| 172 | 
            +
                c.desc 'Server TCP port number'
         | 
| 171 173 | 
             
                c.flag([:port], default_value: 443, type: Integer)
         | 
| 172 | 
            -
                c.desc 'Connection and read  | 
| 174 | 
            +
                c.desc 'Connection and read timeout in seconds'
         | 
| 173 175 | 
             
                c.flag([:timeout], default_value: 30, type: Integer)
         | 
| 174 | 
            -
                c.desc ' | 
| 176 | 
            +
                c.desc 'Enable SSL connection'
         | 
| 175 177 | 
             
                c.switch([:ssl], default_value: true)
         | 
| 176 | 
            -
                c.desc ' | 
| 178 | 
            +
                c.desc 'Unique identifier for lock/unlock operations'
         | 
| 177 179 | 
             
                c.flag([:owner], default_value: 'default', type: String)
         | 
| 178 | 
            -
                c.desc ' | 
| 180 | 
            +
                c.desc 'Additional metadata for the upload (key:value format)'
         | 
| 179 181 | 
             
                c.flag([:meta], type: String, multiple: true)
         | 
| 180 | 
            -
                c.desc ' | 
| 182 | 
            +
                c.desc 'Number of retry attempts'
         | 
| 181 183 | 
             
                c.flag([:retries], type: Integer, default_value: 3)
         | 
| 182 | 
            -
                c.desc ' | 
| 184 | 
            +
                c.desc 'Enable package compression'
         | 
| 183 185 | 
             
                c.switch([:zip], default_value: true)
         | 
| 184 186 | 
             
                run_it(c, 'push')
         | 
| 185 187 | 
             
              end
         | 
| 186 188 |  | 
| 187 | 
            -
              desc 'Pull the factbase from the server and lock it  | 
| 189 | 
            +
              desc 'Pull the factbase from the server and lock it remotely'
         | 
| 188 190 | 
             
              command :pull do |c|
         | 
| 189 191 | 
             
                c.desc 'Authentication token'
         | 
| 190 192 | 
             
                c.flag([:token])
         | 
| 191 | 
            -
                c.desc ' | 
| 193 | 
            +
                c.desc 'Maximum wait time in seconds'
         | 
| 192 194 | 
             
                c.flag([:wait], default_value: 10 * 60, arg_name: '<seconds>', type: Integer)
         | 
| 193 | 
            -
                c.desc ' | 
| 195 | 
            +
                c.desc 'Server IP/hostname'
         | 
| 194 196 | 
             
                c.flag([:host], default_value: 'api.zerocracy.com')
         | 
| 195 | 
            -
                c.desc ' | 
| 197 | 
            +
                c.desc 'Server TCP port number'
         | 
| 196 198 | 
             
                c.flag([:port], default_value: 443, type: Integer)
         | 
| 197 | 
            -
                c.desc 'Connection and read  | 
| 199 | 
            +
                c.desc 'Connection and read timeout in seconds'
         | 
| 198 200 | 
             
                c.flag([:timeout], default_value: 30, type: Integer)
         | 
| 199 | 
            -
                c.desc ' | 
| 201 | 
            +
                c.desc 'Enable SSL connection'
         | 
| 200 202 | 
             
                c.switch([:ssl], default_value: true)
         | 
| 201 | 
            -
                c.desc ' | 
| 203 | 
            +
                c.desc 'Unique identifier for lock/unlock operations'
         | 
| 202 204 | 
             
                c.flag([:owner], default_value: 'default', type: String)
         | 
| 203 | 
            -
                c.desc ' | 
| 205 | 
            +
                c.desc 'Number of retry attempts'
         | 
| 204 206 | 
             
                c.flag([:retries], type: Integer, default_value: 3)
         | 
| 205 207 | 
             
                run_it(c, 'pull')
         | 
| 206 208 | 
             
              end
         | 
    
        data/features/import.feature
    CHANGED
    
    
    
        data/features/update.feature
    CHANGED
    
    | @@ -15,7 +15,7 @@ Feature: Update | |
| 15 15 | 
             
                Then Stdout contains "FOO ā "
         | 
| 16 16 | 
             
                Then Stdout contains "BAR ā "
         | 
| 17 17 | 
             
                Then Stdout contains "1 judge(s) processed"
         | 
| 18 | 
            -
                Then Stdout contains "Update  | 
| 18 | 
            +
                Then Stdout contains "Update completed in 3 cycle(s), did 3i/0d/3a"
         | 
| 19 19 | 
             
                And Exit code is zero
         | 
| 20 20 |  | 
| 21 21 | 
             
              Scenario: Generate a summary fact, with errors
         | 
| @@ -39,7 +39,7 @@ Feature: Update | |
| 39 39 | 
             
                """
         | 
| 40 40 | 
             
                Then I run bin/judges with "--verbose update --quiet --lifetime 1 --max-cycles 5 . simple.fb"
         | 
| 41 41 | 
             
                Then Stdout contains "The 'simple' judge skipped, no time left"
         | 
| 42 | 
            -
                Then Stdout contains "Update  | 
| 42 | 
            +
                Then Stdout contains "Update completed in 2 cycle(s), did 1i/0d/0a"
         | 
| 43 43 | 
             
                And Exit code is zero
         | 
| 44 44 |  | 
| 45 45 | 
             
              Scenario: Use options from a file
         | 
| @@ -57,7 +57,7 @@ Feature: Update | |
| 57 57 | 
             
                Then Stdout contains "A1 ā "
         | 
| 58 58 | 
             
                Then Stdout contains "A2 ā "
         | 
| 59 59 | 
             
                Then Stdout contains "1 judge(s) processed"
         | 
| 60 | 
            -
                Then Stdout contains "Update  | 
| 60 | 
            +
                Then Stdout contains "Update completed"
         | 
| 61 61 | 
             
                And Exit code is zero
         | 
| 62 62 |  | 
| 63 63 | 
             
              Scenario: Simple run with a timeout for a judge
         | 
| @@ -71,7 +71,7 @@ Feature: Update | |
| 71 71 | 
             
                Then Stdout contains "execution expired"
         | 
| 72 72 | 
             
                Then Stdout contains "judge timed out after"
         | 
| 73 73 | 
             
                Then Stdout contains "1 judge(s) processed"
         | 
| 74 | 
            -
                Then Stdout contains "Update  | 
| 74 | 
            +
                Then Stdout contains "Update completed in 1 cycle(s), did 0i/0d/0a"
         | 
| 75 75 | 
             
                And Exit code is zero
         | 
| 76 76 |  | 
| 77 77 | 
             
              Scenario: Simple run of a few judges, with a lib
         | 
| @@ -87,7 +87,7 @@ Feature: Update | |
| 87 87 | 
             
                """
         | 
| 88 88 | 
             
                Then I run bin/judges with "update --lib mylib --max-cycles 1 mine simple.fb"
         | 
| 89 89 | 
             
                Then Stdout contains "1 judge(s) processed"
         | 
| 90 | 
            -
                Then Stdout contains "Update  | 
| 90 | 
            +
                Then Stdout contains "Update completed in 1 cycle(s)"
         | 
| 91 91 | 
             
                And Exit code is zero
         | 
| 92 92 |  | 
| 93 93 | 
             
              Scenario: The update fails when a bug in a judge
         | 
    
        data/judges.gemspec
    CHANGED
    
    | @@ -9,7 +9,7 @@ Gem::Specification.new do |s| | |
| 9 9 | 
             
              s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
         | 
| 10 10 | 
             
              s.required_ruby_version = '>=3.2'
         | 
| 11 11 | 
             
              s.name = 'judges'
         | 
| 12 | 
            -
              s.version = '0. | 
| 12 | 
            +
              s.version = '0.43.0'
         | 
| 13 13 | 
             
              s.license = 'MIT'
         | 
| 14 14 | 
             
              s.summary = 'Command-Line Tool for a Factbase'
         | 
| 15 15 | 
             
              s.description =
         | 
    
        data/lib/judges/commands/eval.rb
    CHANGED
    
    | @@ -22,7 +22,7 @@ class Judges::Eval | |
| 22 22 | 
             
                @loog = loog
         | 
| 23 23 | 
             
              end
         | 
| 24 24 |  | 
| 25 | 
            -
              # Run the eval command.
         | 
| 25 | 
            +
              # Run the eval command (called by the +bin/judges+ script).
         | 
| 26 26 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 27 27 | 
             
              # @param [Array] args List of command line arguments
         | 
| 28 28 | 
             
              # @raise [RuntimeError] If not exactly two arguments provided
         | 
| @@ -40,7 +40,7 @@ class Judges::Eval | |
| 40 40 | 
             
                  eval(expr)
         | 
| 41 41 | 
             
                  # rubocop:enable Security/Eval
         | 
| 42 42 | 
             
                  impex.export($fb)
         | 
| 43 | 
            -
                  throw :'Evaluated successfully'
         | 
| 43 | 
            +
                  throw :'š Evaluated successfully'
         | 
| 44 44 | 
             
                end
         | 
| 45 45 | 
             
              end
         | 
| 46 46 | 
             
            end
         | 
| @@ -24,7 +24,7 @@ class Judges::Import | |
| 24 24 | 
             
                @loog = loog
         | 
| 25 25 | 
             
              end
         | 
| 26 26 |  | 
| 27 | 
            -
              # Run the import command.
         | 
| 27 | 
            +
              # Run the import command (called by the +bin/judges+ script).
         | 
| 28 28 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 29 29 | 
             
              # @param [Array] args List of command line arguments
         | 
| 30 30 | 
             
              # @raise [RuntimeError] If not exactly two arguments provided or file not found
         | 
| @@ -47,7 +47,7 @@ class Judges::Import | |
| 47 47 | 
             
                    end
         | 
| 48 48 | 
             
                  end
         | 
| 49 49 | 
             
                  impex.export(fb)
         | 
| 50 | 
            -
                  throw :"Import of #{yaml.size} facts  | 
| 50 | 
            +
                  throw :"š Import of #{yaml.size} facts completed"
         | 
| 51 51 | 
             
                end
         | 
| 52 52 | 
             
              end
         | 
| 53 53 | 
             
            end
         | 
| @@ -21,12 +21,12 @@ class Judges::Inspect | |
| 21 21 | 
             
                @loog = loog
         | 
| 22 22 | 
             
              end
         | 
| 23 23 |  | 
| 24 | 
            -
              # Run the inspect command.
         | 
| 24 | 
            +
              # Run the inspect command (called by the +bin/judges+ script).
         | 
| 25 25 | 
             
              # @param [Hash] _opts Command line options (not used)
         | 
| 26 26 | 
             
              # @param [Array] args List of command line arguments
         | 
| 27 27 | 
             
              # @raise [RuntimeError] If no arguments provided
         | 
| 28 28 | 
             
              def run(_opts, args)
         | 
| 29 | 
            -
                raise 'At  | 
| 29 | 
            +
                raise 'At least one argument required' if args.empty?
         | 
| 30 30 | 
             
                fb = Judges::Impex.new(@loog, args[0]).import
         | 
| 31 31 | 
             
                @loog.info("Facts: #{fb.size}")
         | 
| 32 32 | 
             
              end
         | 
    
        data/lib/judges/commands/join.rb
    CHANGED
    
    | @@ -22,7 +22,7 @@ class Judges::Join | |
| 22 22 | 
             
                @loog = loog
         | 
| 23 23 | 
             
              end
         | 
| 24 24 |  | 
| 25 | 
            -
              # Run the join command.
         | 
| 25 | 
            +
              # Run the join command (called by the +bin/judges+ script).
         | 
| 26 26 | 
             
              # @param [Hash] _opts Command line options (not used)
         | 
| 27 27 | 
             
              # @param [Array] args List of command line arguments
         | 
| 28 28 | 
             
              # @raise [RuntimeError] If not exactly two arguments provided
         | 
| @@ -34,7 +34,7 @@ class Judges::Join | |
| 34 34 | 
             
                  fb = master.import
         | 
| 35 35 | 
             
                  slave.import_to(fb)
         | 
| 36 36 | 
             
                  master.export(fb)
         | 
| 37 | 
            -
                  throw :'Two factbases joined'
         | 
| 37 | 
            +
                  throw :'š Two factbases joined successfully'
         | 
| 38 38 | 
             
                end
         | 
| 39 39 | 
             
              end
         | 
| 40 40 | 
             
            end
         | 
| @@ -29,11 +29,12 @@ class Judges::Print | |
| 29 29 | 
             
                @loog = loog
         | 
| 30 30 | 
             
              end
         | 
| 31 31 |  | 
| 32 | 
            -
              # Run  | 
| 32 | 
            +
              # Run the print command (called by the +bin/judges+ script).
         | 
| 33 33 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 34 34 | 
             
              # @param [Array] args List of command line arguments
         | 
| 35 | 
            +
              # @raise [RuntimeError] If no arguments provided
         | 
| 35 36 | 
             
              def run(opts, args)
         | 
| 36 | 
            -
                raise 'At  | 
| 37 | 
            +
                raise 'At least one argument required' if args.empty?
         | 
| 37 38 | 
             
                f = args[0]
         | 
| 38 39 | 
             
                fb = Judges::Impex.new(@loog, f).import
         | 
| 39 40 | 
             
                fb.query("(not #{opts['query']})").delete! unless opts['query'].nil?
         | 
| @@ -70,7 +71,7 @@ class Judges::Print | |
| 70 71 | 
             
                        raise "Unknown format '#{fmt}'"
         | 
| 71 72 | 
             
                    end
         | 
| 72 73 | 
             
                  File.binwrite(o, output)
         | 
| 73 | 
            -
                  throw :"Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
         | 
| 74 | 
            +
                  throw :"š Factbase printed to #{o.to_rel} (#{File.size(o)} bytes)"
         | 
| 74 75 | 
             
                end
         | 
| 75 76 | 
             
              end
         | 
| 76 77 |  | 
    
        data/lib/judges/commands/pull.rb
    CHANGED
    
    | @@ -25,9 +25,10 @@ class Judges::Pull | |
| 25 25 | 
             
                @loog = loog
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 | 
            -
              # Run  | 
| 28 | 
            +
              # Run the pull command (called by the +bin/judges+ script).
         | 
| 29 29 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 30 30 | 
             
              # @param [Array] args List of command line arguments
         | 
| 31 | 
            +
              # @raise [RuntimeError] If not exactly two arguments provided
         | 
| 31 32 | 
             
              def run(opts, args)
         | 
| 32 33 | 
             
                raise 'Exactly two arguments required' unless args.size == 2
         | 
| 33 34 | 
             
                fb = Factbase.new
         | 
| @@ -54,9 +55,9 @@ class Judges::Pull | |
| 54 55 | 
             
                      baza.unlock(name, opts['owner'])
         | 
| 55 56 | 
             
                      raise e
         | 
| 56 57 | 
             
                    end
         | 
| 57 | 
            -
                    throw :"Pulled #{fb.size} facts by  | 
| 58 | 
            +
                    throw :"š Pulled #{fb.size} facts by name '#{name}'"
         | 
| 58 59 | 
             
                  else
         | 
| 59 | 
            -
                    throw :" | 
| 60 | 
            +
                    throw :"ā ļø Nothing to pull - name '#{name}' not found on server"
         | 
| 60 61 | 
             
                  end
         | 
| 61 62 | 
             
                end
         | 
| 62 63 | 
             
              end
         | 
| @@ -69,7 +70,7 @@ class Judges::Pull | |
| 69 70 | 
             
                loop do
         | 
| 70 71 | 
             
                  break if baza.finished?(id)
         | 
| 71 72 | 
             
                  sleep 1
         | 
| 72 | 
            -
                  raise "Time is over, the job ##{id} ('#{name}') is still not  | 
| 73 | 
            +
                  raise "Time is over, the job ##{id} ('#{name}') is still not completed" if Time.now - start > limit
         | 
| 73 74 | 
             
                  lapsed = Time.now - start
         | 
| 74 75 | 
             
                  @loog.debug("Still waiting for the job ##{id} ('#{name}') to finish... (#{format('%.2f', lapsed)}s already)")
         | 
| 75 76 | 
             
                end
         | 
    
        data/lib/judges/commands/push.rb
    CHANGED
    
    | @@ -25,9 +25,10 @@ class Judges::Push | |
| 25 25 | 
             
                @loog = loog
         | 
| 26 26 | 
             
              end
         | 
| 27 27 |  | 
| 28 | 
            -
              # Run  | 
| 28 | 
            +
              # Run the push command (called by the +bin/judges+ script).
         | 
| 29 29 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 30 30 | 
             
              # @param [Array] args List of command line arguments
         | 
| 31 | 
            +
              # @raise [RuntimeError] If not exactly two arguments provided
         | 
| 31 32 | 
             
              def run(opts, args)
         | 
| 32 33 | 
             
                raise 'Exactly two arguments required' unless args.size == 2
         | 
| 33 34 | 
             
                name = args[0]
         | 
| @@ -44,7 +45,7 @@ class Judges::Push | |
| 44 45 | 
             
                  baza.lock(name, opts['owner'])
         | 
| 45 46 | 
             
                  begin
         | 
| 46 47 | 
             
                    id = baza.push(name, fb.export, opts['meta'] || [])
         | 
| 47 | 
            -
                    throw :"Pushed #{fb.size} facts, job ID is #{id}"
         | 
| 48 | 
            +
                    throw :"š Pushed #{fb.size} facts, job ID is #{id}"
         | 
| 48 49 | 
             
                  ensure
         | 
| 49 50 | 
             
                    baza.unlock(name, opts['owner'])
         | 
| 50 51 | 
             
                  end
         | 
    
        data/lib/judges/commands/test.rb
    CHANGED
    
    | @@ -29,9 +29,10 @@ class Judges::Test | |
| 29 29 | 
             
                @loog = loog
         | 
| 30 30 | 
             
              end
         | 
| 31 31 |  | 
| 32 | 
            -
              # Run  | 
| 32 | 
            +
              # Run the test command (called by the +bin/judges+ script).
         | 
| 33 33 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 34 34 | 
             
              # @param [Array] args List of command line arguments
         | 
| 35 | 
            +
              # @raise [RuntimeError] If not exactly one argument provided
         | 
| 35 36 | 
             
              def run(opts, args)
         | 
| 36 37 | 
             
                raise 'Exactly one argument required' unless args.size == 1
         | 
| 37 38 | 
             
                dir = args[0]
         | 
    
        data/lib/judges/commands/trim.rb
    CHANGED
    
    | @@ -23,18 +23,19 @@ class Judges::Trim | |
| 23 23 | 
             
                @loog = loog
         | 
| 24 24 | 
             
              end
         | 
| 25 25 |  | 
| 26 | 
            -
              # Run  | 
| 26 | 
            +
              # Run the trim command (called by the +bin/judges+ script).
         | 
| 27 27 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 28 28 | 
             
              # @param [Array] args List of command line arguments
         | 
| 29 | 
            +
              # @raise [RuntimeError] If not exactly one argument provided
         | 
| 29 30 | 
             
              def run(opts, args)
         | 
| 30 31 | 
             
                raise 'Exactly one argument required' unless args.size == 1
         | 
| 31 32 | 
             
                impex = Judges::Impex.new(@loog, args[0])
         | 
| 32 33 | 
             
                fb = impex.import
         | 
| 33 34 | 
             
                elapsed(@loog, level: Logger::INFO) do
         | 
| 34 35 | 
             
                  deleted = fb.query(opts['query']).delete!
         | 
| 35 | 
            -
                  throw :'No facts deleted' if deleted.zero?
         | 
| 36 | 
            +
                  throw :'ā ļø No facts deleted' if deleted.zero?
         | 
| 36 37 | 
             
                  impex.export(fb)
         | 
| 37 | 
            -
                  throw :" | 
| 38 | 
            +
                  throw :"š #{deleted} fact(s) deleted"
         | 
| 38 39 | 
             
                end
         | 
| 39 40 | 
             
              end
         | 
| 40 41 | 
             
            end
         | 
| @@ -33,10 +33,10 @@ class Judges::Update | |
| 33 33 | 
             
                @start = Time.now
         | 
| 34 34 | 
             
              end
         | 
| 35 35 |  | 
| 36 | 
            -
              # Run  | 
| 37 | 
            -
              #
         | 
| 36 | 
            +
              # Run the update command (called by the +bin/judges+ script).
         | 
| 38 37 | 
             
              # @param [Hash] opts Command line options (start with '--')
         | 
| 39 38 | 
             
              # @param [Array] args List of command line arguments
         | 
| 39 | 
            +
              # @raise [RuntimeError] If not exactly two arguments provided or directory is missing
         | 
| 40 40 | 
             
              def run(opts, args)
         | 
| 41 41 | 
             
                raise 'Exactly two arguments required' unless args.size == 2
         | 
| 42 42 | 
             
                dir = args[0]
         | 
| @@ -81,9 +81,13 @@ class Judges::Update | |
| 81 81 | 
             
                      @loog.info("Too many cycles already, as set by --max-cycles=#{opts['max-cycles']}, breaking")
         | 
| 82 82 | 
             
                      break
         | 
| 83 83 | 
             
                    end
         | 
| 84 | 
            +
                    if opts['fail-fast'] && !errors.empty?
         | 
| 85 | 
            +
                      @loog.info("Due to #{errors.count} errors we must stop at the update cycle ##{c}")
         | 
| 86 | 
            +
                      break
         | 
| 87 | 
            +
                    end
         | 
| 84 88 | 
             
                    @loog.info("The cycle #{c} did #{delta}")
         | 
| 85 89 | 
             
                  end
         | 
| 86 | 
            -
                  throw :"Update  | 
| 90 | 
            +
                  throw :"š Update completed in #{c} cycle(s), did #{churn}"
         | 
| 87 91 | 
             
                end
         | 
| 88 92 | 
             
                return unless opts['summary']
         | 
| 89 93 | 
             
                summarize(fb, churn, errors, start, c)
         | 
| @@ -144,6 +148,10 @@ class Judges::Update | |
| 144 148 | 
             
                elapsed(@loog, level: Logger::INFO) do
         | 
| 145 149 | 
             
                  done =
         | 
| 146 150 | 
             
                    judges.each_with_index do |judge, i|
         | 
| 151 | 
            +
                      if opts['fail-fast'] && !errors.empty?
         | 
| 152 | 
            +
                        @loog.info("Not running #{judge.name.inspect} due to #{errors.count} errors above, in --fail-fast mode")
         | 
| 153 | 
            +
                        next
         | 
| 154 | 
            +
                      end
         | 
| 147 155 | 
             
                      next unless include?(opts, judge.name)
         | 
| 148 156 | 
             
                      @loog.info("\nš Running #{judge.name} (##{i}) at #{judge.dir.to_rel} (#{start.ago} already)...")
         | 
| 149 157 | 
             
                      elapsed(@loog, level: Logger::INFO) do
         | 
    
        data/lib/judges/judge.rb
    CHANGED
    
    | @@ -59,7 +59,7 @@ class Judges::Judge | |
| 59 59 | 
             
                end
         | 
| 60 60 | 
             
                s = File.join(@dir, script)
         | 
| 61 61 | 
             
                raise "Can't load '#{s}'" unless File.exist?(s)
         | 
| 62 | 
            -
                elapsed(@loog, intro: "#{$judge}  | 
| 62 | 
            +
                elapsed(@loog, intro: "#{$judge} completed", level: Logger::INFO) do
         | 
| 63 63 | 
             
                  load(s, true)
         | 
| 64 64 | 
             
                  $fb.churn
         | 
| 65 65 | 
             
                  # rubocop:disable Lint/RescueException
         | 
    
        data/lib/judges.rb
    CHANGED