bson 5.0.0-java → 5.0.1-java

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,41 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bson
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.0
4
+ version: 5.0.1
5
5
  platform: java
6
6
  authors:
7
7
  - The MongoDB Ruby Team
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIEeDCCAuCgAwIBAgIBATANBgkqhkiG9w0BAQsFADBBMREwDwYDVQQDDAhkYngt
14
- cnVieTEXMBUGCgmSJomT8ixkARkWB21vbmdvZGIxEzARBgoJkiaJk/IsZAEZFgNj
15
- b20wHhcNMjQwMjA5MTc0NzIyWhcNMjUwMjA4MTc0NzIyWjBBMREwDwYDVQQDDAhk
16
- YngtcnVieTEXMBUGCgmSJomT8ixkARkWB21vbmdvZGIxEzARBgoJkiaJk/IsZAEZ
17
- FgNjb20wggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC0/Veq9l47cTfX
18
- tQ+kHq2NOCwJuJGt1iXWQ/vH/yp7pZ/bLej7gPDl2CfIngAXRjM7r1FkR9ya7VAm
19
- IneBFcVU3HhpIXWi4ByXGjBOXFD1Dfbz4C4zedIWRk/hNzXa+rQY4KPwpOwG/hZg
20
- id+rSXWSbNlkyN97XfonweVh7JsIa9X/2JY9ADYjhCfEZF+b0+Wl7+jgwzLWb46I
21
- 0WH0bZBIZ0BbKAwUXIgvq5mQf9PzukmMVYCwnkJ/P4wrHO22HuwnbMyvJuGjVwqi
22
- j1NRp/2vjmKBFWxIfhlSXEIiqAmeEVNXzhPvTVeyo+rma+7R3Bo+4WHkcnPpXJJZ
23
- Jd63qXMvTB0GplEcMJPztWhrJOmcxIOVoQyigEPSQT8JpzFVXby4SGioizv2eT7l
24
- VYSiCHuc3yEDyq5M+98WGX2etbj6esYtzI3rDevpIAHPB6HQmtoJIA4dSl3gjFb+
25
- D+YQSuB2qYu021FI9zeY9sbZyWysEXBxhwrmTk+XUV0qz+OQZkMCAwEAAaN7MHkw
26
- CQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFH4nnr4tYlatU57RbExW
27
- jG86YM5nMB8GA1UdEQQYMBaBFGRieC1ydWJ5QG1vbmdvZGIuY29tMB8GA1UdEgQY
28
- MBaBFGRieC1ydWJ5QG1vbmdvZGIuY29tMA0GCSqGSIb3DQEBCwUAA4IBgQBKGtHA
29
- fpi3N/BL1J5O4CBsAjtF4jHDiw2r5MwK+66NzMh3uedjgPI7MoosemLy++SB+8BR
30
- SE8bDkb6gfDQQzrI6KSXXyqH2TbQXpY5Tac7/yqXRiu8G2qOrOj4czB/Hq7j09CV
31
- YoH88v6hL11i5jt6jPjFh8hXYG0hDQxhi3atRz5Wwd98tUf2DSbyJXJiRgCBeZjl
32
- rP7AnKsWMu0C+zPlL+nXtQr+nTFtkKXRWfUJMqePpBqtriQvgQ+Y1ItqYVTSLuiM
33
- iwUMcn/rGhdCMBSaKDXdFkIveCHQE2f2WBo2EdErrcTrgEKYYdNfzcb/43j7L1kx
34
- AUwyTtk+HFrviBynQbKN82rjbZE+5gukVea5c7idQPkqacPYsoU37DI+hTlUyJkV
35
- dcTtfEg44lLlfNukBslfiQf54r+uWbyB0m0rDUN/py7/Ghyzt5GLBU91uCO3dGoI
36
- 55uFRHMvEcJMTDeImC/nuucPCAiEGMHggr9+NPC0tqpxjGKTo7lS7GzUFjg=
37
- -----END CERTIFICATE-----
38
- date: 2024-02-13 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2024-07-23 00:00:00.000000000 Z
39
12
  dependencies: []
40
13
  description: A fully featured BSON specification implementation in Ruby
41
14
  email: dbx-ruby@mongodb.com
@@ -157,29 +130,6 @@ files:
157
130
  - spec/runners/common_driver.rb
158
131
  - spec/runners/corpus.rb
159
132
  - spec/runners/corpus_legacy.rb
160
- - spec/shared/LICENSE
161
- - spec/shared/bin/get-mongodb-download-url
162
- - spec/shared/bin/s3-copy
163
- - spec/shared/bin/s3-upload
164
- - spec/shared/lib/mrss/child_process_helper.rb
165
- - spec/shared/lib/mrss/cluster_config.rb
166
- - spec/shared/lib/mrss/constraints.rb
167
- - spec/shared/lib/mrss/docker_runner.rb
168
- - spec/shared/lib/mrss/eg_config_utils.rb
169
- - spec/shared/lib/mrss/event_subscriber.rb
170
- - spec/shared/lib/mrss/lite_constraints.rb
171
- - spec/shared/lib/mrss/server_version_registry.rb
172
- - spec/shared/lib/mrss/session_registry.rb
173
- - spec/shared/lib/mrss/session_registry_legacy.rb
174
- - spec/shared/lib/mrss/spec_organizer.rb
175
- - spec/shared/lib/mrss/utils.rb
176
- - spec/shared/share/Dockerfile.erb
177
- - spec/shared/share/haproxy-1.conf
178
- - spec/shared/share/haproxy-2.conf
179
- - spec/shared/shlib/config.sh
180
- - spec/shared/shlib/distro.sh
181
- - spec/shared/shlib/server.sh
182
- - spec/shared/shlib/set_env.sh
183
133
  - spec/spec_helper.rb
184
134
  - spec/spec_tests/common_driver_spec.rb
185
135
  - spec/spec_tests/corpus_legacy_spec.rb
@@ -271,147 +221,124 @@ required_rubygems_version: !ruby/object:Gem::Requirement
271
221
  - !ruby/object:Gem::Version
272
222
  version: 1.3.6
273
223
  requirements: []
274
- rubygems_version: 3.2.33
224
+ rubygems_version: 3.3.26
275
225
  signing_key:
276
226
  specification_version: 4
277
227
  summary: Ruby implementation of the BSON specification
278
228
  test_files:
279
229
  - spec/README.md
280
- - spec/spec_helper.rb
230
+ - spec/bson/array_spec.rb
231
+ - spec/bson/big_decimal_spec.rb
232
+ - spec/bson/binary_spec.rb
233
+ - spec/bson/binary_uuid_spec.rb
234
+ - spec/bson/boolean_spec.rb
235
+ - spec/bson/byte_buffer_read_spec.rb
236
+ - spec/bson/byte_buffer_spec.rb
237
+ - spec/bson/byte_buffer_write_spec.rb
238
+ - spec/bson/code_spec.rb
239
+ - spec/bson/code_with_scope_spec.rb
240
+ - spec/bson/config_spec.rb
241
+ - spec/bson/date_spec.rb
242
+ - spec/bson/date_time_spec.rb
243
+ - spec/bson/dbref_legacy_spec.rb
244
+ - spec/bson/dbref_spec.rb
245
+ - spec/bson/decimal128_spec.rb
246
+ - spec/bson/document_as_spec.rb
247
+ - spec/bson/document_spec.rb
248
+ - spec/bson/ext_json_parse_spec.rb
249
+ - spec/bson/false_class_spec.rb
250
+ - spec/bson/float_spec.rb
251
+ - spec/bson/hash_as_spec.rb
252
+ - spec/bson/hash_spec.rb
253
+ - spec/bson/int32_spec.rb
254
+ - spec/bson/int64_spec.rb
255
+ - spec/bson/integer_spec.rb
256
+ - spec/bson/json_spec.rb
257
+ - spec/bson/max_key_spec.rb
258
+ - spec/bson/min_key_spec.rb
259
+ - spec/bson/nil_class_spec.rb
260
+ - spec/bson/object_id_spec.rb
261
+ - spec/bson/object_spec.rb
262
+ - spec/bson/open_struct_spec.rb
263
+ - spec/bson/raw_spec.rb
264
+ - spec/bson/regexp_spec.rb
265
+ - spec/bson/registry_spec.rb
266
+ - spec/bson/string_spec.rb
267
+ - spec/bson/symbol_raw_spec.rb
268
+ - spec/bson/symbol_spec.rb
269
+ - spec/bson/time_spec.rb
270
+ - spec/bson/time_with_zone_spec.rb
271
+ - spec/bson/timestamp_spec.rb
272
+ - spec/bson/true_class_spec.rb
273
+ - spec/bson/undefined_spec.rb
281
274
  - spec/bson_spec.rb
282
- - spec/shared/LICENSE
283
- - spec/shared/share/Dockerfile.erb
284
- - spec/shared/share/haproxy-1.conf
285
- - spec/shared/share/haproxy-2.conf
286
- - spec/shared/bin/s3-copy
287
- - spec/shared/bin/s3-upload
288
- - spec/shared/bin/get-mongodb-download-url
289
- - spec/shared/shlib/server.sh
290
- - spec/shared/shlib/set_env.sh
291
- - spec/shared/shlib/config.sh
292
- - spec/shared/shlib/distro.sh
293
- - spec/shared/lib/mrss/docker_runner.rb
294
- - spec/shared/lib/mrss/eg_config_utils.rb
295
- - spec/shared/lib/mrss/session_registry.rb
296
- - spec/shared/lib/mrss/child_process_helper.rb
297
- - spec/shared/lib/mrss/utils.rb
298
- - spec/shared/lib/mrss/lite_constraints.rb
299
- - spec/shared/lib/mrss/constraints.rb
300
- - spec/shared/lib/mrss/server_version_registry.rb
301
- - spec/shared/lib/mrss/event_subscriber.rb
302
- - spec/shared/lib/mrss/cluster_config.rb
303
- - spec/shared/lib/mrss/spec_organizer.rb
304
- - spec/shared/lib/mrss/session_registry_legacy.rb
305
- - spec/runners/corpus_legacy.rb
306
275
  - spec/runners/common_driver.rb
307
276
  - spec/runners/corpus.rb
308
- - spec/spec_tests/corpus_legacy_spec.rb
277
+ - spec/runners/corpus_legacy.rb
278
+ - spec/spec_helper.rb
309
279
  - spec/spec_tests/common_driver_spec.rb
280
+ - spec/spec_tests/corpus_legacy_spec.rb
310
281
  - spec/spec_tests/corpus_spec.rb
311
- - spec/spec_tests/data/corpus/document.json
282
+ - spec/spec_tests/data/corpus/README.md
283
+ - spec/spec_tests/data/corpus/array.json
284
+ - spec/spec_tests/data/corpus/binary.json
285
+ - spec/spec_tests/data/corpus/boolean.json
286
+ - spec/spec_tests/data/corpus/code.json
287
+ - spec/spec_tests/data/corpus/code_w_scope.json
288
+ - spec/spec_tests/data/corpus/datetime.json
289
+ - spec/spec_tests/data/corpus/dbpointer.json
312
290
  - spec/spec_tests/data/corpus/dbref.json
313
- - spec/spec_tests/data/corpus/null.json
291
+ - spec/spec_tests/data/corpus/decimal128-1.json
292
+ - spec/spec_tests/data/corpus/decimal128-2.json
293
+ - spec/spec_tests/data/corpus/decimal128-3.json
314
294
  - spec/spec_tests/data/corpus/decimal128-4.json
315
- - spec/spec_tests/data/corpus/README.md
295
+ - spec/spec_tests/data/corpus/decimal128-5.json
316
296
  - spec/spec_tests/data/corpus/decimal128-6.json
297
+ - spec/spec_tests/data/corpus/decimal128-7.json
298
+ - spec/spec_tests/data/corpus/document.json
317
299
  - spec/spec_tests/data/corpus/double.json
318
- - spec/spec_tests/data/corpus/decimal128-5.json
319
- - spec/spec_tests/data/corpus/string.json
320
- - spec/spec_tests/data/corpus/minkey.json
321
- - spec/spec_tests/data/corpus/decimal128-1.json
322
- - spec/spec_tests/data/corpus/decimal128-2.json
323
- - spec/spec_tests/data/corpus/maxkey.json
324
- - spec/spec_tests/data/corpus/timestamp.json
325
- - spec/spec_tests/data/corpus/undefined.json
326
- - spec/spec_tests/data/corpus/oid.json
327
- - spec/spec_tests/data/corpus/top.json
300
+ - spec/spec_tests/data/corpus/int32.json
328
301
  - spec/spec_tests/data/corpus/int64.json
329
- - spec/spec_tests/data/corpus/code_w_scope.json
330
- - spec/spec_tests/data/corpus/binary.json
331
- - spec/spec_tests/data/corpus/datetime.json
332
- - spec/spec_tests/data/corpus/decimal128-3.json
333
- - spec/spec_tests/data/corpus/array.json
334
- - spec/spec_tests/data/corpus/multi-type.json
335
- - spec/spec_tests/data/corpus/boolean.json
302
+ - spec/spec_tests/data/corpus/maxkey.json
303
+ - spec/spec_tests/data/corpus/minkey.json
336
304
  - spec/spec_tests/data/corpus/multi-type-deprecated.json
337
- - spec/spec_tests/data/corpus/dbpointer.json
338
- - spec/spec_tests/data/corpus/int32.json
339
- - spec/spec_tests/data/corpus/symbol.json
340
- - spec/spec_tests/data/corpus/decimal128-7.json
341
- - spec/spec_tests/data/corpus/code.json
305
+ - spec/spec_tests/data/corpus/multi-type.json
306
+ - spec/spec_tests/data/corpus/null.json
307
+ - spec/spec_tests/data/corpus/oid.json
342
308
  - spec/spec_tests/data/corpus/regex.json
343
- - spec/spec_tests/data/decimal128/decimal128-4.json
344
- - spec/spec_tests/data/decimal128/decimal128-6.json
345
- - spec/spec_tests/data/decimal128/decimal128-5.json
346
- - spec/spec_tests/data/decimal128/decimal128-1.json
347
- - spec/spec_tests/data/decimal128/decimal128-2.json
348
- - spec/spec_tests/data/decimal128/decimal128-3.json
349
- - spec/spec_tests/data/decimal128/decimal128-7.json
350
- - spec/spec_tests/data/corpus_legacy/document.json
351
- - spec/spec_tests/data/corpus_legacy/null.json
352
- - spec/spec_tests/data/corpus_legacy/double.json
353
- - spec/spec_tests/data/corpus_legacy/string.json
354
- - spec/spec_tests/data/corpus_legacy/minkey.json
355
- - spec/spec_tests/data/corpus_legacy/maxkey.json
356
- - spec/spec_tests/data/corpus_legacy/timestamp.json
357
- - spec/spec_tests/data/corpus_legacy/undefined.json
358
- - spec/spec_tests/data/corpus_legacy/oid.json
359
- - spec/spec_tests/data/corpus_legacy/top.json
360
- - spec/spec_tests/data/corpus_legacy/code_w_scope.json
361
- - spec/spec_tests/data/corpus_legacy/binary.json
309
+ - spec/spec_tests/data/corpus/string.json
310
+ - spec/spec_tests/data/corpus/symbol.json
311
+ - spec/spec_tests/data/corpus/timestamp.json
312
+ - spec/spec_tests/data/corpus/top.json
313
+ - spec/spec_tests/data/corpus/undefined.json
362
314
  - spec/spec_tests/data/corpus_legacy/array.json
315
+ - spec/spec_tests/data/corpus_legacy/binary.json
363
316
  - spec/spec_tests/data/corpus_legacy/boolean.json
364
- - spec/spec_tests/data/corpus_legacy/int32.json
365
317
  - spec/spec_tests/data/corpus_legacy/code.json
366
- - spec/spec_tests/data/corpus_legacy/regex.json
367
- - spec/spec_tests/data/corpus_legacy/failures/int64.json
318
+ - spec/spec_tests/data/corpus_legacy/code_w_scope.json
319
+ - spec/spec_tests/data/corpus_legacy/document.json
320
+ - spec/spec_tests/data/corpus_legacy/double.json
368
321
  - spec/spec_tests/data/corpus_legacy/failures/datetime.json
369
322
  - spec/spec_tests/data/corpus_legacy/failures/dbpointer.json
323
+ - spec/spec_tests/data/corpus_legacy/failures/int64.json
370
324
  - spec/spec_tests/data/corpus_legacy/failures/symbol.json
371
- - spec/bson/object_id_spec.rb
372
- - spec/bson/time_with_zone_spec.rb
373
- - spec/bson/config_spec.rb
374
- - spec/bson/time_spec.rb
375
- - spec/bson/open_struct_spec.rb
376
- - spec/bson/registry_spec.rb
377
- - spec/bson/big_decimal_spec.rb
378
- - spec/bson/timestamp_spec.rb
379
- - spec/bson/date_spec.rb
380
- - spec/bson/byte_buffer_write_spec.rb
381
- - spec/bson/max_key_spec.rb
382
- - spec/bson/binary_uuid_spec.rb
383
- - spec/bson/regexp_spec.rb
384
- - spec/bson/float_spec.rb
385
- - spec/bson/code_spec.rb
386
- - spec/bson/byte_buffer_spec.rb
387
- - spec/bson/symbol_spec.rb
388
- - spec/bson/integer_spec.rb
389
- - spec/bson/int64_spec.rb
390
- - spec/bson/hash_spec.rb
391
- - spec/bson/object_spec.rb
392
- - spec/bson/raw_spec.rb
393
- - spec/bson/binary_spec.rb
394
- - spec/bson/json_spec.rb
395
- - spec/bson/min_key_spec.rb
396
- - spec/bson/date_time_spec.rb
397
- - spec/bson/int32_spec.rb
398
- - spec/bson/hash_as_spec.rb
399
- - spec/bson/symbol_raw_spec.rb
400
- - spec/bson/false_class_spec.rb
401
- - spec/bson/string_spec.rb
402
- - spec/bson/dbref_legacy_spec.rb
403
- - spec/bson/boolean_spec.rb
404
- - spec/bson/dbref_spec.rb
405
- - spec/bson/nil_class_spec.rb
406
- - spec/bson/ext_json_parse_spec.rb
407
- - spec/bson/true_class_spec.rb
408
- - spec/bson/byte_buffer_read_spec.rb
409
- - spec/bson/document_as_spec.rb
410
- - spec/bson/code_with_scope_spec.rb
411
- - spec/bson/undefined_spec.rb
412
- - spec/bson/array_spec.rb
413
- - spec/bson/document_spec.rb
414
- - spec/bson/decimal128_spec.rb
325
+ - spec/spec_tests/data/corpus_legacy/int32.json
326
+ - spec/spec_tests/data/corpus_legacy/maxkey.json
327
+ - spec/spec_tests/data/corpus_legacy/minkey.json
328
+ - spec/spec_tests/data/corpus_legacy/null.json
329
+ - spec/spec_tests/data/corpus_legacy/oid.json
330
+ - spec/spec_tests/data/corpus_legacy/regex.json
331
+ - spec/spec_tests/data/corpus_legacy/string.json
332
+ - spec/spec_tests/data/corpus_legacy/timestamp.json
333
+ - spec/spec_tests/data/corpus_legacy/top.json
334
+ - spec/spec_tests/data/corpus_legacy/undefined.json
335
+ - spec/spec_tests/data/decimal128/decimal128-1.json
336
+ - spec/spec_tests/data/decimal128/decimal128-2.json
337
+ - spec/spec_tests/data/decimal128/decimal128-3.json
338
+ - spec/spec_tests/data/decimal128/decimal128-4.json
339
+ - spec/spec_tests/data/decimal128/decimal128-5.json
340
+ - spec/spec_tests/data/decimal128/decimal128-6.json
341
+ - spec/spec_tests/data/decimal128/decimal128-7.json
415
342
  - spec/support/shared_examples.rb
416
- - spec/support/utils.rb
417
343
  - spec/support/spec_config.rb
344
+ - spec/support/utils.rb
checksums.yaml.gz.sig DELETED
Binary file
data/spec/shared/LICENSE DELETED
@@ -1,20 +0,0 @@
1
- Copyright (c) 2020 MongoDB, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- desired_version, arch = ARGV
4
- if arch.nil?
5
- STDERR.puts "Usage: get-mongodb-download-url desired-version arch"
6
- exit 1
7
- end
8
-
9
- $: << File.join(File.dirname(__FILE__), '../lib')
10
- require 'mrss/server_version_registry'
11
-
12
- begin
13
- puts Mrss::ServerVersionRegistry.new(desired_version, arch).download_url
14
- rescue Mrss::ServerVersionRegistry::Error => exc
15
- STDERR.puts "Error: #{exc}"
16
- exit 2
17
- end
@@ -1,45 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'aws-sdk-s3'
5
-
6
- options = {}
7
- OptionParser.new do |opts|
8
- opts.banner = "Usage: s3-copy options"
9
-
10
- opts.on("-r", "--region=REGION", "AWS region to use (default us-east-1)") do |v|
11
- options[:region] = v
12
- end
13
-
14
- opts.on("-p", "--param=KEY=VALUE", "Specify parameter for new files") do |v|
15
- options[:params] ||= {}
16
- k, v = v.split('=', 2)
17
- options[:params][k.to_sym] = v
18
- end
19
-
20
- opts.on("-f", "--from=BUCKET:PATH", "Bucket name and key (or path) to copy from") do |v|
21
- options[:from] = v
22
- end
23
-
24
- opts.on("-t", "--to=BUCKET:PATH", "Bucket name and key (or path) to write to (may be specified more than once)") do |v|
25
- options[:to] ||= []
26
- options[:to] << v
27
- end
28
- end.parse!
29
-
30
- ENV['AWS_REGION'] ||= options[:region] || 'us-east-1'
31
-
32
- bucket, key = options.fetch(:from).split(':', 2)
33
-
34
- s3 = Aws::S3::Client.new
35
-
36
- options.fetch(:to).each do |dest|
37
- STDERR.puts "Copying to #{dest}"
38
- dbucket, dkey = dest.split(':', 2)
39
- s3.copy_object(
40
- bucket: dbucket,
41
- key: dkey,
42
- copy_source: "/#{bucket}/#{key}",
43
- **options[:params] || {},
44
- )
45
- end
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'optparse'
4
- require 'aws-sdk-s3'
5
-
6
- options = {}
7
- OptionParser.new do |opts|
8
- opts.banner = "Usage: s3-upload options"
9
-
10
- opts.on("-r", "--region=REGION", "AWS region to use (default us-east-1)") do |v|
11
- options[:region] = v
12
- end
13
-
14
- opts.on("-p", "--param=KEY=VALUE", "Specify parameter for S3 upload") do |v|
15
- options[:params] ||= {}
16
- k, v = v.split('=', 2)
17
- options[:params][k.to_sym] = v
18
- end
19
-
20
- opts.on("-f", "--file=PATH", "Path to the file to upload, - to upload standard input") do |v|
21
- options[:file] = v
22
- end
23
-
24
- opts.on("-w", "--write=BUCKET:PATH", "Bucket name and key (or path) to upload to") do |v|
25
- options[:write] = v
26
- end
27
-
28
- opts.on("-c", "--copy=BUCKET:PATH", "Bucket name and key (or path) to copy to (may be specified more than once)") do |v|
29
- options[:copy] ||= []
30
- options[:copy] << v
31
- end
32
- end.parse!
33
-
34
- ENV['AWS_REGION'] ||= options[:region] || 'us-east-1'
35
-
36
- def upload(f, options)
37
- s3 = Aws::S3::Client.new
38
- write = options.fetch(:write)
39
- STDERR.puts "Writing #{write}"
40
- bucket, key = write.split(':', 2)
41
- s3.put_object(
42
- body: f.read,
43
- bucket: bucket,
44
- key: key,
45
- **options[:params] || {},
46
- )
47
- if copy = options[:copy]
48
- copy.each do |dest|
49
- STDERR.puts "Copying to #{dest}"
50
- dbucket, dkey = dest.split(':', 2)
51
- s3.copy_object(
52
- bucket: dbucket,
53
- key: dkey,
54
- copy_source: "/#{bucket}/#{key}",
55
- **options[:params] || {},
56
- )
57
- end
58
- end
59
- end
60
-
61
- if options[:file] == '-'
62
- upload(STDIN, options)
63
- elsif options[:file]
64
- File.open(options[:file]) do |f|
65
- upload(f, options)
66
- end
67
- else
68
- upload(STDIN, options)
69
- end
@@ -1,80 +0,0 @@
1
- # frozen_string_literal: true
2
- # encoding: utf-8
3
-
4
- autoload :ChildProcess, 'childprocess'
5
- autoload :Tempfile, 'tempfile'
6
-
7
- module Mrss
8
- module ChildProcessHelper
9
- class SpawnError < StandardError; end
10
-
11
- module_function def call(cmd, env: nil, cwd: nil)
12
- process = ChildProcess.new(*cmd)
13
- process.io.inherit!
14
- if cwd
15
- process.cwd = cwd
16
- end
17
- if env
18
- env.each do |k, v|
19
- process.environment[k.to_s] = v
20
- end
21
- end
22
- process.start
23
- process.wait
24
- process
25
- end
26
-
27
- module_function def check_call(cmd, env: nil, cwd: nil)
28
- process = call(cmd, env: env, cwd: cwd)
29
- unless process.exit_code == 0
30
- raise SpawnError, "Failed to execute: #{cmd}"
31
- end
32
- end
33
-
34
- module_function def get_output(cmd, env: nil, cwd: nil)
35
- process = ChildProcess.new(*cmd)
36
- process.io.inherit!
37
- if cwd
38
- process.cwd = cwd
39
- end
40
- if env
41
- env.each do |k, v|
42
- process.environment[k.to_s] = v
43
- end
44
- end
45
-
46
- output = ''
47
- r, w = IO.pipe
48
-
49
- begin
50
- process.io.stdout = w
51
- process.start
52
- w.close
53
-
54
- thread = Thread.new do
55
- begin
56
- loop do
57
- output << r.readpartial(16384)
58
- end
59
- rescue EOFError
60
- end
61
- end
62
-
63
- process.wait
64
- thread.join
65
- ensure
66
- r.close
67
- end
68
-
69
- [process, output]
70
- end
71
-
72
- module_function def check_output(*args)
73
- process, output = get_output(*args)
74
- unless process.exit_code == 0
75
- raise SpawnError,"Failed to execute: #{args}"
76
- end
77
- output
78
- end
79
- end
80
- end