attachie 1.1.2 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/CHANGELOG.md +4 -0
- data/attachie.gemspec +1 -0
- data/lib/attachie/fake_driver.rb +6 -6
- data/lib/attachie/version.rb +1 -1
- data/spec/attachie/fake_driver_spec.rb +6 -2
- data/spec/spec_helper.rb +1 -0
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2eb19de73f237ed0298861ef6b69bd4fdb0ca87b6fb4e30fdd26a3e594f25954
|
4
|
+
data.tar.gz: 3b2f115036c310943864d0732d369f9e796c784aa125a23ec85136c1e0956fdc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3094cc9dbf755c8c942ee0e8903a99e364180415f16b7fb69e959d01d8f4c34110722f77acc5f2585e5686b58c0a9553505a7843fd7bbe244ef2cc68cbfc861d
|
7
|
+
data.tar.gz: a976071b69c6a5429d53dc9b3f7427ab1fd3a2f5df665058f2325ae873478b3eb86a86aff71d24bdcd5c4b03cf6439f4954291f0496106f6483200cf3fd948ec
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/attachie.gemspec
CHANGED
data/lib/attachie/fake_driver.rb
CHANGED
@@ -49,8 +49,8 @@ module Attachie
|
|
49
49
|
def info(name, bucket)
|
50
50
|
synchronize do
|
51
51
|
{
|
52
|
-
last_modified:
|
53
|
-
content_length: objects(bucket)[name].size,
|
52
|
+
last_modified: objects(bucket)[name][:last_modified],
|
53
|
+
content_length: objects(bucket)[name][:data].size,
|
54
54
|
content_type: MIME::Types.of(name).first&.to_s
|
55
55
|
}
|
56
56
|
end
|
@@ -62,13 +62,13 @@ module Attachie
|
|
62
62
|
|
63
63
|
def store(name, data_or_io, bucket, options = {})
|
64
64
|
synchronize do
|
65
|
-
objects(bucket)[name] = data_or_io.respond_to?(:read) ? data_or_io.read : data_or_io
|
65
|
+
objects(bucket)[name] = { data: data_or_io.respond_to?(:read) ? data_or_io.read : data_or_io, last_modified: Time.now.utc }
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
69
|
def store_multipart(name, bucket, options = {}, &block)
|
70
70
|
synchronize do
|
71
|
-
objects(bucket)[name] = FakeMultipartUpload.new(name, bucket, options, &block).data
|
71
|
+
objects(bucket)[name] = { data: FakeMultipartUpload.new(name, bucket, options, &block).data, last_modified: Time.now.utc }
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
@@ -86,9 +86,9 @@ module Attachie
|
|
86
86
|
|
87
87
|
def value(name, bucket)
|
88
88
|
synchronize do
|
89
|
-
raise(ItemNotFound) unless objects(bucket).key?(name)
|
89
|
+
raise(ItemNotFound, "Object #{ name } does not exist in bucket #{ bucket }") unless objects(bucket).key?(name)
|
90
90
|
|
91
|
-
objects(bucket)[name]
|
91
|
+
objects(bucket)[name][:data]
|
92
92
|
end
|
93
93
|
end
|
94
94
|
|
data/lib/attachie/version.rb
CHANGED
@@ -85,12 +85,16 @@ RSpec.describe Attachie::FakeDriver do
|
|
85
85
|
|
86
86
|
describe "#info" do
|
87
87
|
it "returns info about the object" do
|
88
|
-
|
88
|
+
timestamp = Time.now.utc
|
89
|
+
|
90
|
+
Timecop.freeze timestamp do
|
91
|
+
driver.store("name.txt", "blob", "bucket")
|
92
|
+
end
|
89
93
|
|
90
94
|
expect(driver.info("name.txt", "bucket")).to eq(
|
91
95
|
content_length: 4,
|
92
96
|
content_type: "text/plain",
|
93
|
-
last_modified:
|
97
|
+
last_modified: timestamp
|
94
98
|
)
|
95
99
|
end
|
96
100
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attachie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin Vetter
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -122,6 +122,20 @@ dependencies:
|
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: timecop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
125
139
|
description: Declarative and flexible attachments
|
126
140
|
email:
|
127
141
|
- vetter@plainpicture.de
|
@@ -154,7 +168,7 @@ homepage: ''
|
|
154
168
|
licenses:
|
155
169
|
- MIT
|
156
170
|
metadata: {}
|
157
|
-
post_install_message:
|
171
|
+
post_install_message:
|
158
172
|
rdoc_options: []
|
159
173
|
require_paths:
|
160
174
|
- lib
|
@@ -169,8 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
183
|
- !ruby/object:Gem::Version
|
170
184
|
version: '0'
|
171
185
|
requirements: []
|
172
|
-
rubygems_version: 3.
|
173
|
-
signing_key:
|
186
|
+
rubygems_version: 3.3.3
|
187
|
+
signing_key:
|
174
188
|
specification_version: 4
|
175
189
|
summary: Declarative and flexible attachments
|
176
190
|
test_files:
|