baza.rb 0.0.13 → 0.2.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/Gemfile +2 -0
- data/Gemfile.lock +28 -19
- data/Rakefile +12 -1
- data/baza.rb.gemspec +1 -1
- data/lib/baza-rb/fake.rb +74 -19
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +7 -2
- data/test/test__helper.rb +1 -0
- data/test/test_baza-rb.rb +2 -3
- data/test/test_fake.rb +20 -8
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ee76f53a0b65c13bb293ebcb18de358f7f7f0d0262b06e1b23c56b337ceefc
|
4
|
+
data.tar.gz: 064dbdd35e38b6fae3a53c8e2f17abe06927043d0234d182c2b161e1ffed97ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e76efbc00aa6c55fba368681dda4ec7560fb7f655f5824bd510bd2fc9da0c23405495f3e7a759655cedcc4dba9a650fc1cdbb9dc8aa0489d873b8f8a7718f0b6
|
7
|
+
data.tar.gz: 2b908d30e84c97e384e48f99f38dee3fc3f05889cc443711b57ef7dfaf749589a390da4fbb5027fc299d8c460861798e038b876a31a94f7bbdb0fef3a24e9756
|
data/Gemfile
CHANGED
@@ -11,6 +11,8 @@ gem 'factbase', '>0', require: false
|
|
11
11
|
gem 'minitest', '~>5.25', require: false
|
12
12
|
gem 'minitest-reporters', '~>1.7', require: false
|
13
13
|
gem 'net-ping', '~>2.0', require: false
|
14
|
+
gem 'os', '>0', require: false
|
15
|
+
gem 'qbash', '>0', require: false
|
14
16
|
gem 'rake', '~>13.2', require: false
|
15
17
|
gem 'random-port', '>0', require: false
|
16
18
|
gem 'rubocop', '~>1.73', require: false
|
data/Gemfile.lock
CHANGED
@@ -35,14 +35,15 @@ GEM
|
|
35
35
|
tago (> 0)
|
36
36
|
ethon (0.16.0)
|
37
37
|
ffi (>= 1.15.0)
|
38
|
-
factbase (0.9.
|
39
|
-
backtrace (
|
40
|
-
decoor (
|
38
|
+
factbase (0.9.10)
|
39
|
+
backtrace (~> 0.4)
|
40
|
+
decoor (~> 0.0)
|
41
41
|
json (~> 2.7)
|
42
|
-
|
42
|
+
logger (~> 1.0)
|
43
|
+
loog (~> 0.6)
|
43
44
|
nokogiri (~> 1.10)
|
44
|
-
others (
|
45
|
-
tago (
|
45
|
+
others (~> 0.0)
|
46
|
+
tago (~> 0.0)
|
46
47
|
yaml (~> 0.3)
|
47
48
|
faraday (2.12.2)
|
48
49
|
faraday-net_http (>= 2.0, < 3.5)
|
@@ -54,7 +55,7 @@ GEM
|
|
54
55
|
multipart-post (~> 2.0)
|
55
56
|
faraday-net_http (3.4.0)
|
56
57
|
net-http (>= 0.5.0)
|
57
|
-
faraday-retry (2.
|
58
|
+
faraday-retry (2.3.0)
|
58
59
|
faraday (~> 2.0)
|
59
60
|
ffi (1.17.1-arm64-darwin)
|
60
61
|
ffi (1.17.1-x64-mingw-ucrt)
|
@@ -77,21 +78,27 @@ GEM
|
|
77
78
|
net-http (0.6.0)
|
78
79
|
uri
|
79
80
|
net-ping (2.0.8)
|
80
|
-
nokogiri (1.18.
|
81
|
+
nokogiri (1.18.7-arm64-darwin)
|
81
82
|
racc (~> 1.4)
|
82
|
-
nokogiri (1.18.
|
83
|
+
nokogiri (1.18.7-x64-mingw-ucrt)
|
83
84
|
racc (~> 1.4)
|
84
|
-
nokogiri (1.18.
|
85
|
+
nokogiri (1.18.7-x86_64-darwin)
|
85
86
|
racc (~> 1.4)
|
86
|
-
nokogiri (1.18.
|
87
|
+
nokogiri (1.18.7-x86_64-linux-gnu)
|
87
88
|
racc (~> 1.4)
|
89
|
+
os (1.1.4)
|
88
90
|
others (0.0.3)
|
89
91
|
parallel (1.26.3)
|
90
|
-
parser (3.3.7.
|
92
|
+
parser (3.3.7.4)
|
91
93
|
ast (~> 2.4.1)
|
92
94
|
racc
|
93
95
|
prism (1.4.0)
|
94
96
|
public_suffix (6.0.1)
|
97
|
+
qbash (0.4.0)
|
98
|
+
backtrace (> 0)
|
99
|
+
elapsed (> 0)
|
100
|
+
loog (> 0)
|
101
|
+
tago (> 0)
|
95
102
|
racc (1.8.1)
|
96
103
|
rainbow (3.1.1)
|
97
104
|
rake (13.2.1)
|
@@ -100,7 +107,7 @@ GEM
|
|
100
107
|
regexp_parser (2.10.0)
|
101
108
|
retries (0.0.5)
|
102
109
|
rexml (3.4.1)
|
103
|
-
rubocop (1.75.
|
110
|
+
rubocop (1.75.2)
|
104
111
|
json (~> 2.3)
|
105
112
|
language_server-protocol (~> 3.17.0.2)
|
106
113
|
lint_roller (~> 1.1.0)
|
@@ -108,19 +115,19 @@ GEM
|
|
108
115
|
parser (>= 3.3.0.2)
|
109
116
|
rainbow (>= 2.2.2, < 4.0)
|
110
117
|
regexp_parser (>= 2.9.3, < 3.0)
|
111
|
-
rubocop-ast (>= 1.
|
118
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
112
119
|
ruby-progressbar (~> 1.7)
|
113
120
|
unicode-display_width (>= 2.4.0, < 4.0)
|
114
|
-
rubocop-ast (1.
|
121
|
+
rubocop-ast (1.44.0)
|
115
122
|
parser (>= 3.3.7.2)
|
116
123
|
prism (~> 1.4)
|
117
|
-
rubocop-minitest (0.
|
124
|
+
rubocop-minitest (0.38.0)
|
118
125
|
lint_roller (~> 1.1)
|
119
|
-
rubocop (>= 1.
|
126
|
+
rubocop (>= 1.75.0, < 2.0)
|
120
127
|
rubocop-ast (>= 1.38.0, < 2.0)
|
121
|
-
rubocop-performance (1.
|
128
|
+
rubocop-performance (1.25.0)
|
122
129
|
lint_roller (~> 1.1)
|
123
|
-
rubocop (>= 1.
|
130
|
+
rubocop (>= 1.75.0, < 2.0)
|
124
131
|
rubocop-ast (>= 1.38.0, < 2.0)
|
125
132
|
rubocop-rake (0.7.1)
|
126
133
|
lint_roller (~> 1.1)
|
@@ -167,6 +174,8 @@ DEPENDENCIES
|
|
167
174
|
minitest (~> 5.25)
|
168
175
|
minitest-reporters (~> 1.7)
|
169
176
|
net-ping (~> 2.0)
|
177
|
+
os (> 0)
|
178
|
+
qbash (> 0)
|
170
179
|
rake (~> 13.2)
|
171
180
|
random-port (> 0)
|
172
181
|
rubocop (~> 1.73)
|
data/Rakefile
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
|
4
4
|
# SPDX-License-Identifier: MIT
|
5
5
|
|
6
|
+
require 'os'
|
7
|
+
require 'qbash'
|
6
8
|
require 'rubygems'
|
7
9
|
require 'rake'
|
8
10
|
require 'rake/clean'
|
11
|
+
require 'shellwords'
|
9
12
|
|
10
13
|
def name
|
11
14
|
@name ||= File.basename(Dir['*.gemspec'].first, '.*')
|
@@ -17,7 +20,7 @@ end
|
|
17
20
|
|
18
21
|
ENV['RACK_ENV'] = 'test'
|
19
22
|
|
20
|
-
task default: %i[clean test rubocop yard]
|
23
|
+
task default: %i[clean test picks rubocop yard]
|
21
24
|
|
22
25
|
require 'rake/testtask'
|
23
26
|
desc 'Run all unit tests'
|
@@ -29,6 +32,14 @@ Rake::TestTask.new(:test) do |test|
|
|
29
32
|
test.verbose = false
|
30
33
|
end
|
31
34
|
|
35
|
+
desc 'Run them via Ruby, one by one'
|
36
|
+
task :picks do
|
37
|
+
next if OS.windows?
|
38
|
+
(Dir['test/**/*.rb'] + Dir['lib/**/*.rb']).each do |f|
|
39
|
+
qbash("bundle exec ruby #{Shellwords.escape(f)}", log: $stdout, env: { 'RACK_ENV' => 'picks' })
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
32
43
|
require 'yard'
|
33
44
|
desc 'Build Yard documentation'
|
34
45
|
YARD::Rake::YardocTask.new do |t|
|
data/baza.rb.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |s|
|
|
19
19
|
'and do everything else that is possible to do via the HTTP API.'
|
20
20
|
s.authors = ['Yegor Bugayenko']
|
21
21
|
s.email = 'yegor256@gmail.com'
|
22
|
-
s.homepage = '
|
22
|
+
s.homepage = 'https://github.com/zerocracy/baza.rb'
|
23
23
|
s.files = `git ls-files`.split($RS)
|
24
24
|
s.rdoc_options = ['--charset=UTF-8']
|
25
25
|
s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
|
data/lib/baza-rb/fake.rb
CHANGED
@@ -22,7 +22,10 @@ class BazaRb::Fake
|
|
22
22
|
# @param [Bytes] data The data to push to the server (binary)
|
23
23
|
# @param [Array<String>] meta List of metas, possibly empty
|
24
24
|
# @return [Integer] Job ID on the server
|
25
|
-
def push(
|
25
|
+
def push(name, data, meta)
|
26
|
+
assert_name(name)
|
27
|
+
raise 'The data must be non-empty' if data.empty?
|
28
|
+
raise 'The meta must be an array' unless meta.is_a?(Array)
|
26
29
|
42
|
27
30
|
end
|
28
31
|
|
@@ -30,7 +33,8 @@ class BazaRb::Fake
|
|
30
33
|
#
|
31
34
|
# @param [Integer] id The ID of the job on the server
|
32
35
|
# @return [Bytes] Binary data pulled
|
33
|
-
def pull(
|
36
|
+
def pull(id)
|
37
|
+
assert_id(id)
|
34
38
|
Factbase.new.export
|
35
39
|
end
|
36
40
|
|
@@ -38,7 +42,8 @@ class BazaRb::Fake
|
|
38
42
|
#
|
39
43
|
# @param [Integer] id The ID of the job on the server
|
40
44
|
# @return [Boolean] TRUE if the job is already finished
|
41
|
-
def finished?(
|
45
|
+
def finished?(id)
|
46
|
+
assert_id(id)
|
42
47
|
true
|
43
48
|
end
|
44
49
|
|
@@ -46,7 +51,8 @@ class BazaRb::Fake
|
|
46
51
|
#
|
47
52
|
# @param [Integer] id The ID of the job on the server
|
48
53
|
# @return [String] The stdout, as a text
|
49
|
-
def stdout(
|
54
|
+
def stdout(id)
|
55
|
+
assert_id(id)
|
50
56
|
'Fake stdout output'
|
51
57
|
end
|
52
58
|
|
@@ -54,7 +60,8 @@ class BazaRb::Fake
|
|
54
60
|
#
|
55
61
|
# @param [Integer] id The ID of the job on the server
|
56
62
|
# @return [Integer] The exit code
|
57
|
-
def exit_code(
|
63
|
+
def exit_code(id)
|
64
|
+
assert_id(id)
|
58
65
|
0
|
59
66
|
end
|
60
67
|
|
@@ -62,7 +69,8 @@ class BazaRb::Fake
|
|
62
69
|
#
|
63
70
|
# @param [Integer] id The ID of the job on the server
|
64
71
|
# @return [String] The verdict
|
65
|
-
def verified(
|
72
|
+
def verified(id)
|
73
|
+
assert_id(id)
|
66
74
|
'fake-verdict'
|
67
75
|
end
|
68
76
|
|
@@ -71,7 +79,8 @@ class BazaRb::Fake
|
|
71
79
|
# @param [String] name The name of the job on the server
|
72
80
|
# @param [String] owner The owner of the lock (any string)
|
73
81
|
def lock(name, owner)
|
74
|
-
|
82
|
+
assert_name(name)
|
83
|
+
assert_owner(owner)
|
75
84
|
end
|
76
85
|
|
77
86
|
# Unlock the name.
|
@@ -79,14 +88,16 @@ class BazaRb::Fake
|
|
79
88
|
# @param [String] name The name of the job on the server
|
80
89
|
# @param [String] owner The owner of the lock (any string)
|
81
90
|
def unlock(name, owner)
|
82
|
-
|
91
|
+
assert_name(name)
|
92
|
+
assert_owner(owner)
|
83
93
|
end
|
84
94
|
|
85
95
|
# Get the ID of the job by the name.
|
86
96
|
#
|
87
97
|
# @param [String] name The name of the job on the server
|
88
98
|
# @return [Integer] The ID of the job on the server
|
89
|
-
def recent(
|
99
|
+
def recent(name)
|
100
|
+
assert_name(name)
|
90
101
|
42
|
91
102
|
end
|
92
103
|
|
@@ -94,7 +105,8 @@ class BazaRb::Fake
|
|
94
105
|
#
|
95
106
|
# @param [String] name The name of the job on the server
|
96
107
|
# @return [Boolean] TRUE if such name exists
|
97
|
-
def name_exists?(
|
108
|
+
def name_exists?(name)
|
109
|
+
assert_name(name)
|
98
110
|
true
|
99
111
|
end
|
100
112
|
|
@@ -103,7 +115,8 @@ class BazaRb::Fake
|
|
103
115
|
# @param [String] jname The name of the job on the server
|
104
116
|
# @param [String] file The file name
|
105
117
|
def durable_place(jname, file)
|
106
|
-
|
118
|
+
assert_name(jname)
|
119
|
+
assert_file(file)
|
107
120
|
end
|
108
121
|
|
109
122
|
# Save a single durable from local file to server.
|
@@ -111,7 +124,8 @@ class BazaRb::Fake
|
|
111
124
|
# @param [Integer] id The ID of the durable
|
112
125
|
# @param [String] file The file to upload
|
113
126
|
def durable_save(id, file)
|
114
|
-
|
127
|
+
assert_id(id)
|
128
|
+
assert_file(file)
|
115
129
|
end
|
116
130
|
|
117
131
|
# Load a single durable from server to local file.
|
@@ -119,7 +133,8 @@ class BazaRb::Fake
|
|
119
133
|
# @param [Integer] id The ID of the durable
|
120
134
|
# @param [String] file The file to upload
|
121
135
|
def durable_load(id, file)
|
122
|
-
|
136
|
+
assert_id(id)
|
137
|
+
assert_file(file)
|
123
138
|
end
|
124
139
|
|
125
140
|
# Lock a single durable.
|
@@ -127,7 +142,8 @@ class BazaRb::Fake
|
|
127
142
|
# @param [Integer] id The ID of the durable
|
128
143
|
# @param [String] owner The owner of the lock
|
129
144
|
def durable_lock(id, owner)
|
130
|
-
|
145
|
+
assert_id(id)
|
146
|
+
assert_owner(owner)
|
131
147
|
end
|
132
148
|
|
133
149
|
# Unlock a single durable.
|
@@ -135,7 +151,8 @@ class BazaRb::Fake
|
|
135
151
|
# @param [Integer] id The ID of the durable
|
136
152
|
# @param [String] owner The owner of the lock
|
137
153
|
def durable_unlock(id, owner)
|
138
|
-
|
154
|
+
assert_id(id)
|
155
|
+
assert_owner(owner)
|
139
156
|
end
|
140
157
|
|
141
158
|
# Transfer some funds to another user.
|
@@ -143,7 +160,15 @@ class BazaRb::Fake
|
|
143
160
|
# @param [String] recipient GitHub name (e.g. "yegor256") of the recipient
|
144
161
|
# @param [Float] amount The amount in Z/USDT (not zents!)
|
145
162
|
# @param [String] summary The description of the payment
|
146
|
-
|
163
|
+
# @param [Integer] job The ID of the job or NIL
|
164
|
+
# @param [Integer] job The amount of points just rewarded
|
165
|
+
# @return [Integer] Receipt ID
|
166
|
+
def transfer(recipient, amount, summary, job: nil, points: nil)
|
167
|
+
raise "The receipient #{recipient.inspect} is not valid" unless recipient.match?(/^[a-zA-Z0-9-]+$/)
|
168
|
+
raise "The amount #{amount} must be a Float" unless amount.is_a?(Float)
|
169
|
+
raise "The amount #{amount} must be positive" unless amount.positive?
|
170
|
+
raise "The summary #{summary.inspect} is empty" if summary.empty?
|
171
|
+
raise 'The job must go together with points' if !job.nil? && points.nil?
|
147
172
|
42
|
148
173
|
end
|
149
174
|
|
@@ -152,7 +177,10 @@ class BazaRb::Fake
|
|
152
177
|
# @param [String] owner Who is acting (could be any text)
|
153
178
|
# @param [String] zip The path to ZIP archive to take
|
154
179
|
# @return [Boolean] TRUE if job taken, otherwise false
|
155
|
-
def pop(
|
180
|
+
def pop(owner, zip)
|
181
|
+
assert_owner(owner)
|
182
|
+
FileUtils.mkdir_p(File.dirname(zip))
|
183
|
+
FileUtils.touch(zip)
|
156
184
|
true
|
157
185
|
end
|
158
186
|
|
@@ -161,7 +189,8 @@ class BazaRb::Fake
|
|
161
189
|
# @param [Integer] id The ID of the job on the server
|
162
190
|
# @param [String] zip The path to the ZIP file with the content of the archive
|
163
191
|
def finish(id, zip)
|
164
|
-
|
192
|
+
assert_id(id)
|
193
|
+
assert_file(zip)
|
165
194
|
end
|
166
195
|
|
167
196
|
# Enter a valve.
|
@@ -171,7 +200,11 @@ class BazaRb::Fake
|
|
171
200
|
# @param [String] why The reason
|
172
201
|
# @param [nil|Integer] job The ID of the job
|
173
202
|
# @return [String] The result just calculated or retrieved
|
174
|
-
def enter(
|
203
|
+
def enter(name, badge, why, job)
|
204
|
+
assert_name(name)
|
205
|
+
raise "The badge '#{badge}' is not valid" unless badge.match?(/^[a-zA-Z0-9_-]+$/)
|
206
|
+
raise 'The reason cannot be empty' if why.empty?
|
207
|
+
assert_id(job) unless job.nil?
|
175
208
|
yield
|
176
209
|
end
|
177
210
|
|
@@ -180,4 +213,26 @@ class BazaRb::Fake
|
|
180
213
|
def csrf
|
181
214
|
'fake-csrf-token'
|
182
215
|
end
|
216
|
+
|
217
|
+
private
|
218
|
+
|
219
|
+
def assert_name(name)
|
220
|
+
raise "The name #{name.inspect} is not valid" unless name.match?(/^[a-z0-9-]+$/)
|
221
|
+
raise "The name #{name.inspect} is too long" if name.length > 32
|
222
|
+
end
|
223
|
+
|
224
|
+
def assert_id(id)
|
225
|
+
raise 'The ID must be an Integer' unless id.is_a?(Integer)
|
226
|
+
raise 'The ID must be positive' unless id.positive?
|
227
|
+
end
|
228
|
+
|
229
|
+
def assert_owner(owner)
|
230
|
+
raise "The owner #{owner.inspect} is not valid" unless owner.match?(/^[a-zA-Z0-9-]+$/)
|
231
|
+
raise "The owner #{owner.inspect} is too long" if owner.length > 64
|
232
|
+
end
|
233
|
+
|
234
|
+
def assert_file(file)
|
235
|
+
raise 'The file must exist' unless File.exist?(file)
|
236
|
+
raise 'The file must be non-empty' unless File.size(file).positive?
|
237
|
+
end
|
183
238
|
end
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
@@ -467,8 +467,9 @@ class BazaRb
|
|
467
467
|
# @param [Float] amount The amount in Z/USDT (not zents!)
|
468
468
|
# @param [String] summary The description of the payment
|
469
469
|
# @param [Integer] job The ID of the job or NIL
|
470
|
+
# @param [Integer] job The amount of points just rewarded
|
470
471
|
# @return [Integer] Receipt ID
|
471
|
-
def transfer(recipient, amount, summary, job: nil)
|
472
|
+
def transfer(recipient, amount, summary, job: nil, points: nil)
|
472
473
|
raise 'The "recipient" is nil' if recipient.nil?
|
473
474
|
raise 'The "amount" is nil' if amount.nil?
|
474
475
|
raise 'The "amount" must be Float' unless amount.is_a?(Float)
|
@@ -480,7 +481,11 @@ class BazaRb
|
|
480
481
|
'amount' => amount.to_s,
|
481
482
|
'summary' => summary
|
482
483
|
}
|
483
|
-
|
484
|
+
unless job.nil?
|
485
|
+
body['job'] = job
|
486
|
+
raise 'The "points" must be Integer' unless points.is_a?(Integer)
|
487
|
+
body['points'] = points.to_s
|
488
|
+
end
|
484
489
|
elapsed(@loog) do
|
485
490
|
ret =
|
486
491
|
with_retries(max_tries: @retries, rescue: TimedOut) do
|
data/test/test__helper.rb
CHANGED
data/test/test_baza-rb.rb
CHANGED
@@ -5,15 +5,14 @@
|
|
5
5
|
|
6
6
|
require 'factbase'
|
7
7
|
require 'loog'
|
8
|
-
require 'minitest/autorun'
|
9
8
|
require 'net/ping'
|
10
9
|
require 'random-port'
|
11
10
|
require 'securerandom'
|
12
11
|
require 'socket'
|
13
12
|
require 'stringio'
|
14
13
|
require 'wait_for'
|
15
|
-
require 'webmock/minitest'
|
16
14
|
require 'webrick'
|
15
|
+
require_relative 'test__helper'
|
17
16
|
require_relative '../lib/baza-rb'
|
18
17
|
|
19
18
|
# Test.
|
@@ -111,7 +110,7 @@ class TestBazaRb < Minitest::Test
|
|
111
110
|
stub_request(:post, 'https://example.org/account/transfer').to_return(
|
112
111
|
status: 302, headers: { 'X-Zerocracy-ReceiptId' => '42' }
|
113
112
|
)
|
114
|
-
id = BazaRb.new('example.org', 443, '000').transfer('jeff', 42.50, 'for fun', job: 555)
|
113
|
+
id = BazaRb.new('example.org', 443, '000').transfer('jeff', 42.50, 'for fun', job: 555, points: 88)
|
115
114
|
assert_equal(42, id)
|
116
115
|
end
|
117
116
|
|
data/test/test_fake.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
# SPDX-FileCopyrightText: Copyright (c) 2024-2025 Zerocracy
|
4
4
|
# SPDX-License-Identifier: MIT
|
5
5
|
|
6
|
+
require_relative 'test__helper'
|
6
7
|
require_relative '../lib/baza-rb/fake'
|
7
8
|
|
8
9
|
# Test fake object.
|
@@ -64,11 +65,15 @@ class TestFake < Minitest::Test
|
|
64
65
|
|
65
66
|
def test_durable_operations
|
66
67
|
baza = BazaRb::Fake.new
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
68
|
+
Dir.mktmpdir do |tmp|
|
69
|
+
f = File.join(tmp, 'test.bin')
|
70
|
+
File.write(f, 'hello')
|
71
|
+
baza.durable_place('test-job', f)
|
72
|
+
baza.durable_save(42, f)
|
73
|
+
baza.durable_load(42, f)
|
74
|
+
baza.durable_lock(42, 'test-owner')
|
75
|
+
baza.durable_unlock(42, 'test-owner')
|
76
|
+
end
|
72
77
|
end
|
73
78
|
|
74
79
|
def test_transfer
|
@@ -79,13 +84,20 @@ class TestFake < Minitest::Test
|
|
79
84
|
|
80
85
|
def test_pop
|
81
86
|
baza = BazaRb::Fake.new
|
82
|
-
|
83
|
-
|
87
|
+
Dir.mktmpdir do |tmp|
|
88
|
+
f = File.join(tmp, 'test.zip')
|
89
|
+
result = baza.pop('test-owner', f)
|
90
|
+
assert(result)
|
91
|
+
end
|
84
92
|
end
|
85
93
|
|
86
94
|
def test_finish
|
87
95
|
baza = BazaRb::Fake.new
|
88
|
-
|
96
|
+
Dir.mktmpdir do |tmp|
|
97
|
+
f = File.join(tmp, 'test.zip')
|
98
|
+
File.write(f, 'hello')
|
99
|
+
baza.finish(42, f)
|
100
|
+
end
|
89
101
|
end
|
90
102
|
|
91
103
|
def test_enter
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: baza.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yegor Bugayenko
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-04-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: backtrace
|
@@ -205,7 +205,7 @@ files:
|
|
205
205
|
- test/test__helper.rb
|
206
206
|
- test/test_baza-rb.rb
|
207
207
|
- test/test_fake.rb
|
208
|
-
homepage:
|
208
|
+
homepage: https://github.com/zerocracy/baza.rb
|
209
209
|
licenses:
|
210
210
|
- MIT
|
211
211
|
metadata:
|