scout-camp 0.1.12 → 0.1.13
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/VERSION +1 -1
- data/lib/scout/aws/s3.rb +19 -1
- data/scout-camp.gemspec +2 -2
- data/test/scout/aws/test_s3.rb +9 -0
- 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: b67e89dae365eb1464f34a19d600247a18d9698de5a8337d5cda677b1623396a
|
4
|
+
data.tar.gz: f5f37fce02c5a92ef3d370fd4f1e0367955bcaffc993ba5a963dca94f4ec255c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50d5d0ee70db54470257f49ad6b5595beb0b1d5be73df1471088fc336800a075b2d723082834f6dc6252abf1867b95323b84a3e09dd975c6be1ed2a129e2e46a
|
7
|
+
data.tar.gz: 6908c7789074017d48612f538878657dab8165a286ac8468fd5c243549ff1cbe599ef2868e2d5f88ef8df4f859c57aaa95c3fcd9b9603729fd662756c7faefc5
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
data/lib/scout/aws/s3.rb
CHANGED
@@ -65,8 +65,26 @@ module Open
|
|
65
65
|
|
66
66
|
def self.touch(uri)
|
67
67
|
if self.exists?(uri)
|
68
|
-
else
|
69
68
|
self.cp(uri, uri)
|
69
|
+
else
|
70
|
+
self.write(uri, '')
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.size(uri)
|
75
|
+
begin
|
76
|
+
bucket, key = parse_s3_uri(uri)
|
77
|
+
|
78
|
+
s3 = Aws::S3::Client.new
|
79
|
+
|
80
|
+
resp = s3.head_object(bucket: bucket, key: key)
|
81
|
+
return resp.content_length
|
82
|
+
rescue Aws::S3::Errors::NotFound
|
83
|
+
puts "Object not found: #{bucket_name}/#{object_key}"
|
84
|
+
return nil
|
85
|
+
rescue => e
|
86
|
+
puts "Error retrieving object size: #{e.message}"
|
87
|
+
return nil
|
70
88
|
end
|
71
89
|
end
|
72
90
|
|
data/scout-camp.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: scout-camp 0.1.
|
5
|
+
# stub: scout-camp 0.1.13 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "scout-camp".freeze
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.13".freeze
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
data/test/scout/aws/test_s3.rb
CHANGED
@@ -21,6 +21,15 @@ class TestS3 < Test::Unit::TestCase
|
|
21
21
|
Open.rm uri
|
22
22
|
end
|
23
23
|
|
24
|
+
def test_touch_size
|
25
|
+
uri = "s3://herlab/tmp/foo.txt"
|
26
|
+
|
27
|
+
Open.rm uri
|
28
|
+
Open.touch uri
|
29
|
+
assert_equal 0, Open.size(uri)
|
30
|
+
Open.rm uri
|
31
|
+
end
|
32
|
+
|
24
33
|
def test_write_io
|
25
34
|
uri = "s3://herlab/tmp/foo.txt"
|
26
35
|
|