judges 0.11.0 ā 0.12.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/bin/judges +4 -0
- data/judges.gemspec +1 -1
- data/lib/judges/baza.rb +30 -0
- data/lib/judges/commands/pull.rb +1 -0
- data/lib/judges/commands/push.rb +2 -0
- data/lib/judges/commands/update.rb +1 -1
- data/lib/judges.rb +1 -1
- data/test/commands/test_pull.rb +3 -1
- data/test/commands/test_push.rb +7 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fdaaebbfb61ca792443a79d06439a3946f92bf9fdeb46fdf89ab0f702f0a2176
|
4
|
+
data.tar.gz: 617dce64bda23eb2d4987ef45b60987766248d48ee5770b6c4f35964d4f73cdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e0cfe9f3488ed3e67f687400a2d4ab7bd6ccae47985d0eec8681bca3aac61c9bdbef4025ca974adff07e7aadb9a6ab594bc1765f2fccaabc7fa23d0c250201e
|
7
|
+
data.tar.gz: 8148daa02d6d83ddcc6dcd6093108cbe051cd205876a924c65590a02b52e861b9d9517cef775e4e86e7ff007cc040379ce11d86c4e1b758a7a4eff6aa82ec327
|
data/bin/judges
CHANGED
@@ -167,6 +167,8 @@ class App
|
|
167
167
|
c.flag([:timeout], default_value: 30, type: Integer)
|
168
168
|
c.desc 'Shall SSL be used?'
|
169
169
|
c.switch([:ssl], default_value: true)
|
170
|
+
c.desc 'A unique name to use for a lock/unlock'
|
171
|
+
c.flag([:owner], default_value: 'default', type: String)
|
170
172
|
c.action do |global, options, args|
|
171
173
|
require_relative '../lib/judges/commands/push'
|
172
174
|
Judges::Push.new(loog).run(options, args)
|
@@ -187,6 +189,8 @@ class App
|
|
187
189
|
c.flag([:timeout], default_value: 30, type: Integer)
|
188
190
|
c.desc 'Shall SSL be used?'
|
189
191
|
c.switch([:ssl], default_value: true)
|
192
|
+
c.desc 'A unique name to use for a lock/unlock'
|
193
|
+
c.flag([:owner], default_value: 'default', type: String)
|
190
194
|
c.action do |global, options, args|
|
191
195
|
require_relative '../lib/judges/commands/pull'
|
192
196
|
Judges::Pull.new(loog).run(options, args)
|
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.
|
29
|
+
s.version = '0.12.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
data/lib/judges/baza.rb
CHANGED
@@ -110,6 +110,36 @@ class Judges::Baza
|
|
110
110
|
finished
|
111
111
|
end
|
112
112
|
|
113
|
+
# Lock the name.
|
114
|
+
def lock(name, owner)
|
115
|
+
elapsed(@loog) do
|
116
|
+
with_retries do
|
117
|
+
checked(
|
118
|
+
Typhoeus::Request.get(
|
119
|
+
home.append('lock').append(name).add(owner:).to_s,
|
120
|
+
headers:
|
121
|
+
),
|
122
|
+
302
|
123
|
+
)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
# Unlock the name.
|
129
|
+
def unlock(name, owner)
|
130
|
+
elapsed(@loog) do
|
131
|
+
with_retries do
|
132
|
+
checked(
|
133
|
+
Typhoeus::Request.get(
|
134
|
+
home.append('unlock').append(name).add(owner:).to_s,
|
135
|
+
headers:
|
136
|
+
),
|
137
|
+
302
|
138
|
+
)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
113
143
|
def recent(name)
|
114
144
|
job = 0
|
115
145
|
elapsed(@loog) do
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -47,6 +47,7 @@ class Judges::Pull
|
|
47
47
|
name = args[0]
|
48
48
|
elapsed(@loog) do
|
49
49
|
if baza.name_exists?(name)
|
50
|
+
baza.lock(name, opts['owner'])
|
50
51
|
fb.import(baza.pull(wait(baza, baza.recent(name), opts['wait'])))
|
51
52
|
Judges::Impex.new(@loog, args[1]).export(fb)
|
52
53
|
throw :"Pulled #{fb.size} facts by the name '#{name}'"
|
data/lib/judges/commands/push.rb
CHANGED
@@ -84,7 +84,7 @@ class Judges::Update
|
|
84
84
|
global = {}
|
85
85
|
elapsed(@loog) do
|
86
86
|
done = judges.each_with_index do |p, i|
|
87
|
-
@loog.info("\n
|
87
|
+
@loog.info("\nš Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
|
88
88
|
elapsed(@loog) do
|
89
89
|
c = one_judge(fb, p, global, options)
|
90
90
|
churn += c
|
data/lib/judges.rb
CHANGED
data/test/commands/test_pull.rb
CHANGED
@@ -34,6 +34,7 @@ require_relative '../../lib/judges/commands/pull'
|
|
34
34
|
class TestPull < Minitest::Test
|
35
35
|
def test_pull_simple_factbase
|
36
36
|
WebMock.disable_net_connect!
|
37
|
+
stub_request(:get, 'http://example.org/lock/foo?owner=none').to_return(status: 302)
|
37
38
|
stub_request(:get, 'http://example.org/exists/foo').to_return(body: 'yes')
|
38
39
|
stub_request(:get, 'http://example.org/recent/foo.txt').to_return(body: '42')
|
39
40
|
stub_request(:get, 'http://example.org/finished/42').to_return(body: 'yes')
|
@@ -48,7 +49,8 @@ class TestPull < Minitest::Test
|
|
48
49
|
'host' => 'example.org',
|
49
50
|
'port' => 80,
|
50
51
|
'ssl' => false,
|
51
|
-
'wait' => 10
|
52
|
+
'wait' => 10,
|
53
|
+
'owner' => 'none'
|
52
54
|
},
|
53
55
|
['foo', file]
|
54
56
|
)
|
data/test/commands/test_push.rb
CHANGED
@@ -33,6 +33,8 @@ require_relative '../../lib/judges/commands/push'
|
|
33
33
|
class TestPush < Minitest::Test
|
34
34
|
def test_push_simple_factbase
|
35
35
|
WebMock.disable_net_connect!
|
36
|
+
stub_request(:get, 'https://example.org/lock/foo?owner=none').to_return(status: 302)
|
37
|
+
stub_request(:get, 'https://example.org/unlock/foo?owner=none').to_return(status: 302)
|
36
38
|
stub_request(:put, 'https://example.org/push/foo').to_return(
|
37
39
|
status: 200, body: '42'
|
38
40
|
)
|
@@ -46,7 +48,8 @@ class TestPush < Minitest::Test
|
|
46
48
|
'token' => '000',
|
47
49
|
'host' => 'example.org',
|
48
50
|
'port' => 443,
|
49
|
-
'ssl' => true
|
51
|
+
'ssl' => true,
|
52
|
+
'owner' => 'none'
|
50
53
|
},
|
51
54
|
['foo', file]
|
52
55
|
)
|
@@ -55,6 +58,7 @@ class TestPush < Minitest::Test
|
|
55
58
|
|
56
59
|
def test_fails_on_http_error
|
57
60
|
WebMock.disable_net_connect!
|
61
|
+
stub_request(:get, 'http://example.org/lock/foo?owner=none').to_return(status: 302)
|
58
62
|
stub_request(:put, 'http://example.org/push/foo').to_return(status: 500)
|
59
63
|
Dir.mktmpdir do |d|
|
60
64
|
file = File.join(d, 'base.fb')
|
@@ -67,7 +71,8 @@ class TestPush < Minitest::Test
|
|
67
71
|
'token' => '000',
|
68
72
|
'host' => 'example.org',
|
69
73
|
'port' => 80,
|
70
|
-
'ssl' => false
|
74
|
+
'ssl' => false,
|
75
|
+
'owner' => 'none'
|
71
76
|
},
|
72
77
|
['foo', file]
|
73
78
|
)
|
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.
|
4
|
+
version: 0.12.0
|
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-06-
|
11
|
+
date: 2024-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: backtrace
|