judges 0.4.0 ā 0.5.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 +6 -4
- data/features/pull.feature +1 -1
- data/judges.gemspec +1 -1
- data/lib/judges/commands/pull.rb +5 -3
- data/lib/judges/commands/test.rb +3 -3
- data/lib/judges/commands/update.rb +6 -4
- data/lib/judges.rb +1 -1
- data/test/commands/test_pull.rb +2 -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: 8eed10a2293bdfe6ddfc33e7623d7eb8f905428f60fd002c55e7eb75afdcd96f
|
4
|
+
data.tar.gz: df6b6941021d0c4fbcdb22d4608d41365ca7e537104eda09909f56cb4dd8dd3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07a943829af24cf0388303f9804f8b476449e3feea10ec3fa3703278ffb96e3b8c7a342d06e611e99168a8711397c380fdb70e8504fecaa22be48a6db0627550
|
7
|
+
data.tar.gz: 605f4d9c1598a4950098837ae6d8a8a432b882d1d4da75f93df78e530a584101642fbed0eb76d3df728f7dae4adbe30fb86c517ded6c16ff13f907b89ee4f797
|
data/bin/judges
CHANGED
@@ -155,9 +155,9 @@ class App
|
|
155
155
|
c.desc 'The IP/hostname of the server'
|
156
156
|
c.flag([:host], default_value: 'www.zerocracy.com')
|
157
157
|
c.desc 'The TCP port number of the server'
|
158
|
-
c.flag([:port], default_value: 443)
|
158
|
+
c.flag([:port], default_value: 443, type: Integer)
|
159
159
|
c.desc 'Connection and read time in seconds'
|
160
|
-
c.flag([:timeout], default_value: 30)
|
160
|
+
c.flag([:timeout], default_value: 30, type: Integer)
|
161
161
|
c.desc 'Shall SSL be used?'
|
162
162
|
c.switch([:ssl], default_value: true)
|
163
163
|
c.action do |global, options, args|
|
@@ -170,12 +170,14 @@ class App
|
|
170
170
|
command :pull do |c|
|
171
171
|
c.desc 'Authentication token'
|
172
172
|
c.flag([:token])
|
173
|
+
c.desc 'How many seconds to wait'
|
174
|
+
c.flag([:wait], default_value: 10 * 60, arg_name: '<seconds>', type: Integer)
|
173
175
|
c.desc 'The IP/hostname of the server'
|
174
176
|
c.flag([:host], default_value: 'www.zerocracy.com')
|
175
177
|
c.desc 'The TCP port number of the server'
|
176
|
-
c.flag([:port], default_value: 443)
|
178
|
+
c.flag([:port], default_value: 443, type: Integer)
|
177
179
|
c.desc 'Connection and read time in seconds'
|
178
|
-
c.flag([:timeout], default_value: 30)
|
180
|
+
c.flag([:timeout], default_value: 30, type: Integer)
|
179
181
|
c.desc 'Shall SSL be used?'
|
180
182
|
c.switch([:ssl], default_value: true)
|
181
183
|
c.action do |global, options, args|
|
data/features/pull.feature
CHANGED
@@ -4,7 +4,7 @@ Feature: Pull
|
|
4
4
|
Scenario: Pull a small factbase
|
5
5
|
Given We are online
|
6
6
|
Given I make a temp directory
|
7
|
-
Then I run bin/judges with "--verbose pull --token 00000000-0000-0000-0000-000000000000 simple simple.fb"
|
7
|
+
Then I run bin/judges with "--verbose pull --token 00000000-0000-0000-0000-000000000000 --wait=15 simple simple.fb"
|
8
8
|
Then Stdout contains "Pulled"
|
9
9
|
And Exit code is zero
|
10
10
|
Then I run bin/judges with "inspect simple.fb"
|
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.5.0'
|
30
30
|
s.license = 'MIT'
|
31
31
|
s.summary = 'Command-Line Tool for a Factbase'
|
32
32
|
s.description =
|
data/lib/judges/commands/pull.rb
CHANGED
@@ -47,7 +47,7 @@ class Judges::Pull
|
|
47
47
|
name = args[0]
|
48
48
|
elapsed(@loog) do
|
49
49
|
if baza.name_exists?(name)
|
50
|
-
fb.import(baza.pull(wait(baza, baza.recent(name))))
|
50
|
+
fb.import(baza.pull(wait(baza, baza.recent(name), opts['wait'])))
|
51
51
|
Judges::Impex.new(@loog, args[1]).export(fb)
|
52
52
|
throw :"Pulled #{fb.size} facts by the name '#{name}'"
|
53
53
|
else
|
@@ -58,12 +58,14 @@ class Judges::Pull
|
|
58
58
|
|
59
59
|
private
|
60
60
|
|
61
|
-
def wait(baza, id)
|
61
|
+
def wait(baza, id, limit)
|
62
|
+
raise 'Waiting time is nil' if limit.nil?
|
62
63
|
start = Time.now
|
63
64
|
loop do
|
64
65
|
break if baza.finished?(id)
|
65
66
|
sleep 1
|
66
|
-
raise 'Time is over, the job is still not finished' if Time.now - start >
|
67
|
+
raise 'Time is over, the job is still not finished' if Time.now - start > limit
|
68
|
+
@loog.debug("Still waiting for the job ##{id} to finish... (#{format('%.2f', Time.now - start)}s already)")
|
67
69
|
end
|
68
70
|
id
|
69
71
|
end
|
data/lib/judges/commands/test.rb
CHANGED
@@ -69,7 +69,7 @@ class Judges::Test
|
|
69
69
|
end
|
70
70
|
@loog.info("š ļø Testing #{f.to_rel}:")
|
71
71
|
begin
|
72
|
-
test_one(opts, p, yaml)
|
72
|
+
test_one(opts, p, tname, yaml)
|
73
73
|
tests += 1
|
74
74
|
rescue StandardError => e
|
75
75
|
@loog.warn(Backtrace.new(e))
|
@@ -106,7 +106,7 @@ class Judges::Test
|
|
106
106
|
judges.any? { |n| n.match?(%r{^#{name}(/#{tre})?$}) }
|
107
107
|
end
|
108
108
|
|
109
|
-
def test_one(opts, judge, yaml)
|
109
|
+
def test_one(opts, judge, tname, yaml)
|
110
110
|
fb = Factbase.new
|
111
111
|
inputs = yaml['input']
|
112
112
|
inputs&.each do |i|
|
@@ -127,7 +127,7 @@ class Judges::Test
|
|
127
127
|
return if xpaths.nil?
|
128
128
|
xml = Nokogiri::XML.parse(Factbase::ToXML.new(fb).xml)
|
129
129
|
xpaths.each do |xp|
|
130
|
-
raise "#{judge.
|
130
|
+
raise "#{judge.name}/#{tname} doesn't match '#{xp}':\n#{xml}" if xml.xpath(xp).empty?
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
@@ -82,7 +82,7 @@ class Judges::Update
|
|
82
82
|
end
|
83
83
|
|
84
84
|
def to_s
|
85
|
-
"#{
|
85
|
+
"#{@added}/-#{@removed}"
|
86
86
|
end
|
87
87
|
|
88
88
|
def zero?
|
@@ -105,8 +105,10 @@ class Judges::Update
|
|
105
105
|
elapsed(@loog) do
|
106
106
|
done = judges.each_with_index do |p, i|
|
107
107
|
@loog.info("\nš Running #{p.name} (##{i}) at #{p.dir.to_rel}...")
|
108
|
-
|
109
|
-
|
108
|
+
elapsed(@loog) do
|
109
|
+
churn += one_judge(fb, p, global, options)
|
110
|
+
throw :"š The judge #{p.name} modified #{churn} facts\n"
|
111
|
+
end
|
110
112
|
rescue StandardError, SyntaxError => e
|
111
113
|
@loog.warn(Backtrace.new(e))
|
112
114
|
errors << p.script
|
@@ -132,7 +134,7 @@ class Judges::Update
|
|
132
134
|
if diff.positive?
|
133
135
|
Churn.new(diff, 0)
|
134
136
|
else
|
135
|
-
Churn.new(0, diff)
|
137
|
+
Churn.new(0, -diff)
|
136
138
|
end
|
137
139
|
end
|
138
140
|
end
|
data/lib/judges.rb
CHANGED
data/test/commands/test_pull.rb
CHANGED