judges 0.25.1 → 0.25.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9985ec7aa091bbab98e33915b990f49cc3d6370ab0949f0b6b2820f848430b52
4
- data.tar.gz: a15f89c6a0be6b38fb4d0d2dc6f0c89fcb9149920e02692d9bcd4112271dbf32
3
+ metadata.gz: 793749ccbd3ca4e609283aa272ccb8d47c0b1c67f6c2dc10b0282844aff12715
4
+ data.tar.gz: 8c02acf326f92a4819f6a4c8e76f956fa56a68623c0b9c1948ee87466b220566
5
5
  SHA512:
6
- metadata.gz: b0b6120abac3e27fb11609e1932d7cb5a1d0317572c1f57c9b9642fdd021ca7552b8305ec364056d1d8184c4782f38a74ed20d7016139512627af3d3c1868d37
7
- data.tar.gz: 3f55277c36cff1c75798c0b24cb44a9f9a71a96a3be552f449942b49971d4a4be7b95c05f200533d4e476f839cee80f1a343beef942e19ad3bd9a11dea83cedc
6
+ metadata.gz: bb5f2d0b72d068eeb686f4458e0a1b2241eeb0a54ff5dbf64025170f6607fcf8c840d7bb9ba53c4b43762256d99ceb479e3311094c55db6e66ed30225362911c
7
+ data.tar.gz: af19e76d102ff80655af90132aea9fa83d985e96a9c7ea5baab107d74baf6045efce82deb5df70277e0a3186a5bdddd303cb8288617d3df7de2a7d140af61b61
data/Gemfile.lock CHANGED
@@ -93,8 +93,8 @@ GEM
93
93
  bigdecimal
94
94
  cucumber-gherkin (27.0.0)
95
95
  cucumber-messages (>= 19.1.4, < 23)
96
- cucumber-html-formatter (21.6.0)
97
- cucumber-messages (> 19, < 25)
96
+ cucumber-html-formatter (21.7.0)
97
+ cucumber-messages (> 19, < 27)
98
98
  cucumber-messages (22.0.0)
99
99
  cucumber-tag-expressions (6.1.0)
100
100
  decoor (0.0.1)
@@ -104,7 +104,7 @@ GEM
104
104
  erubi (1.13.0)
105
105
  ethon (0.16.0)
106
106
  ffi (>= 1.15.0)
107
- factbase (0.3.0)
107
+ factbase (0.4.0)
108
108
  backtrace (> 0)
109
109
  decoor (> 0)
110
110
  json (~> 2.7)
data/bin/judges CHANGED
@@ -150,7 +150,7 @@ class JudgesGLI extend GLI::App
150
150
  run_it(c, 'test')
151
151
  end
152
152
 
153
- desc 'Push the factbase to the server'
153
+ desc 'Push the factbase to the server and unlock it over there'
154
154
  command :push do |c|
155
155
  c.desc 'Authentication token'
156
156
  c.flag([:token])
@@ -173,7 +173,7 @@ class JudgesGLI extend GLI::App
173
173
  run_it(c, 'push')
174
174
  end
175
175
 
176
- desc 'Pull the factbase from the server'
176
+ desc 'Pull the factbase from the server and lock it over there'
177
177
  command :pull do |c|
178
178
  c.desc 'Authentication token'
179
179
  c.flag([:token])
data/judges.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
26
26
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
27
  s.required_ruby_version = '>=3.2'
28
28
  s.name = 'judges'
29
- s.version = '0.25.1'
29
+ s.version = '0.25.2'
30
30
  s.license = 'MIT'
31
31
  s.summary = 'Command-Line Tool for a Factbase'
32
32
  s.description =
@@ -41,6 +41,9 @@ class Judges::Print
41
41
  @loog = loog
42
42
  end
43
43
 
44
+ # Run it (it is supposed to be called by the +bin/judges+ script.
45
+ # @param [Hash] opts Command line options (start with '--')
46
+ # @param [Array] args List of command line arguments
44
47
  def run(opts, args)
45
48
  raise 'At lease one argument required' if args.empty?
46
49
  f = args[0]
@@ -39,6 +39,9 @@ class Judges::Pull
39
39
  @loog = loog
40
40
  end
41
41
 
42
+ # Run it (it is supposed to be called by the +bin/judges+ script.
43
+ # @param [Hash] opts Command line options (start with '--')
44
+ # @param [Array] args List of command line arguments
42
45
  def run(opts, args)
43
46
  raise 'Exactly two arguments required' unless args.size == 2
44
47
  fb = Factbase.new
@@ -51,15 +54,20 @@ class Judges::Pull
51
54
  )
52
55
  name = args[0]
53
56
  elapsed(@loog) do
54
- baza.lock(name, opts['owner'])
55
57
  if baza.name_exists?(name)
56
- jid = baza.recent(name)
57
- unless baza.exit_code(jid).zero?
58
- @loog.warn("STDOUT of the job ##{jid} (from the server):\n#{baza.stdout(jid)}")
59
- raise "The job ##{jid} ('#{name}') is broken, maybe you should expire it"
58
+ baza.lock(name, opts['owner'])
59
+ begin
60
+ jid = baza.recent(name)
61
+ unless baza.exit_code(jid).zero?
62
+ @loog.warn("STDOUT of the job ##{jid} (from the server):\n#{baza.stdout(jid)}")
63
+ raise "The job ##{jid} ('#{name}') is broken, maybe you should expire it"
64
+ end
65
+ fb.import(baza.pull(wait(name, baza, jid, opts['wait'])))
66
+ Judges::Impex.new(@loog, args[1]).export(fb)
67
+ rescue StandardError => e
68
+ baza.unlock(name, opts['owner'])
69
+ raise e
60
70
  end
61
- fb.import(baza.pull(wait(name, baza, jid, opts['wait'])))
62
- Judges::Impex.new(@loog, args[1]).export(fb)
63
71
  throw :"Pulled #{fb.size} facts by the name '#{name}'"
64
72
  else
65
73
  throw :"There is nothing to pull, the name '#{name}' is absent on the server"
@@ -39,6 +39,9 @@ class Judges::Push
39
39
  @loog = loog
40
40
  end
41
41
 
42
+ # Run it (it is supposed to be called by the +bin/judges+ script.
43
+ # @param [Hash] opts Command line options (start with '--')
44
+ # @param [Array] args List of command line arguments
42
45
  def run(opts, args)
43
46
  raise 'Exactly two arguments required' unless args.size == 2
44
47
  name = args[0]
@@ -53,9 +56,12 @@ class Judges::Push
53
56
  )
54
57
  elapsed(@loog) do
55
58
  baza.lock(name, opts['owner'])
56
- id = baza.push(name, fb.export, opts['meta'] || [])
57
- baza.unlock(name, opts['owner'])
58
- throw :"Pushed #{fb.size} facts, job ID is #{id}"
59
+ begin
60
+ id = baza.push(name, fb.export, opts['meta'] || [])
61
+ throw :"Pushed #{fb.size} facts, job ID is #{id}"
62
+ ensure
63
+ baza.unlock(name, opts['owner'])
64
+ end
59
65
  end
60
66
  end
61
67
  end
@@ -45,6 +45,9 @@ class Judges::Test
45
45
  @loog = loog
46
46
  end
47
47
 
48
+ # Run it (it is supposed to be called by the +bin/judges+ script.
49
+ # @param [Hash] opts Command line options (start with '--')
50
+ # @param [Array] args List of command line arguments
48
51
  def run(opts, args)
49
52
  raise 'Exactly one argument required' unless args.size == 1
50
53
  dir = args[0]
@@ -38,6 +38,9 @@ class Judges::Trim
38
38
  @loog = loog
39
39
  end
40
40
 
41
+ # Run it (it is supposed to be called by the +bin/judges+ script.
42
+ # @param [Hash] opts Command line options (start with '--')
43
+ # @param [Array] args List of command line arguments
41
44
  def run(opts, args)
42
45
  raise 'Exactly one argument required' unless args.size == 1
43
46
  impex = Judges::Impex.new(@loog, args[0])
@@ -43,6 +43,9 @@ class Judges::Update
43
43
  @loog = loog
44
44
  end
45
45
 
46
+ # Run it (it is supposed to be called by the +bin/judges+ script.
47
+ # @param [Hash] opts Command line options (start with '--')
48
+ # @param [Array] args List of command line arguments
46
49
  def run(opts, args)
47
50
  raise 'Exactly two arguments required' unless args.size == 2
48
51
  dir = args[0]
data/lib/judges.rb CHANGED
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module Judges
28
- VERSION = '0.25.1'
28
+ VERSION = '0.25.2'
29
29
  end
@@ -39,6 +39,7 @@ class TestPull < Minitest::Test
39
39
  stub_request(:get, 'http://example.org/recent/foo.txt').to_return(body: '42')
40
40
  stub_request(:get, 'http://example.org/finished/42').to_return(body: 'yes')
41
41
  stub_request(:get, 'http://example.org/exit/42.txt').to_return(body: '0')
42
+ stub_request(:get, 'http://example.org/unlock/foo?owner=none').to_return(status: 302)
42
43
  fb = Factbase.new
43
44
  fb.insert.foo = 42
44
45
  stub_request(:get, 'http://example.org/pull/42.fb').to_return(body: fb.export)
@@ -68,6 +69,7 @@ class TestPull < Minitest::Test
68
69
  stub_request(:get, 'http://example.org/finished/42').to_return(body: 'yes')
69
70
  stub_request(:get, 'http://example.org/exit/42.txt').to_return(body: '1')
70
71
  stub_request(:get, 'http://example.org/stdout/42.txt').to_return(body: 'oops, some trouble here')
72
+ stub_request(:get, 'http://example.org/unlock/foo?owner=none').to_return(status: 302)
71
73
  Dir.mktmpdir do |d|
72
74
  file = File.join(d, 'base.fb')
73
75
  e =
@@ -60,6 +60,7 @@ class TestPush < Minitest::Test
60
60
  WebMock.disable_net_connect!
61
61
  stub_request(:get, 'http://example.org/lock/foo?owner=none').to_return(status: 302)
62
62
  stub_request(:put, 'http://example.org/push/foo').to_return(status: 500)
63
+ stub_request(:get, 'http://example.org/unlock/foo?owner=none').to_return(status: 302)
63
64
  Dir.mktmpdir do |d|
64
65
  file = File.join(d, 'base.fb')
65
66
  fb = Factbase.new
@@ -170,7 +170,7 @@ class TestTest < Minitest::Test
170
170
  expected_failure: true
171
171
  YAML
172
172
  )
173
- Judges::Test.new(Loog::VERBOSE).run({}, [d])
173
+ Judges::Test.new(Loog::NULL).run({}, [d])
174
174
  end
175
175
  end
176
176
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: judges
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.1
4
+ version: 0.25.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
11
+ date: 2024-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: backtrace