dragonfly-s3_data_store 1.2 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -1
- data/dragonfly-s3_data_store.gemspec +0 -8
- data/lib/dragonfly/s3_data_store.rb +6 -23
- data/lib/dragonfly/s3_data_store/version.rb +1 -1
- data/spec/s3_data_store_spec.rb +9 -6
- metadata +5 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 044ae3caafc588b999b25a91cb115f2395736d43
|
4
|
+
data.tar.gz: 174b9b095ac2177938457642948d17b73b886f0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86ec01a50a2dd00af9c7dcc2db8da6db15f30e49c08e699011a3a4d299c96ffad2822cdf537b9a68e996892ad34b2805ee5654b5da331b5bf04795bc130d7c19
|
7
|
+
data.tar.gz: b6f05e5104cba3f9041ca3efef8e3998b188127c689fa7eb76a079b5fec2bffac724fe93337af8495118868b88c01a0cea0db3d82fa75cc2e30f4bd06b7031b2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
1.3.0 (2017-05-06)
|
2
|
+
==================
|
3
|
+
Changes
|
4
|
+
-------
|
5
|
+
- No longer validate the region, so it's now up to the user to get it right (this way we don't have to keep in sync with Amazon every time they add regions)
|
6
|
+
|
7
|
+
1.2 (2015-08-04)
|
8
|
+
================
|
9
|
+
Changes
|
10
|
+
-------
|
11
|
+
- Save files into a different directory structure, e.g. '2015/08/03/5bccfdd8-0de2-4efc-b3f3-f4e96bcc4afa/file.png' rather than '2015/08/03/12/03/24/492/file.png'. This does not affect any functionality and won't break any of your old content! It's just more robust. (df7453a0)
|
data/README.md
CHANGED
@@ -37,7 +37,7 @@ end
|
|
37
37
|
:bucket_name
|
38
38
|
:access_key_id
|
39
39
|
:secret_access_key
|
40
|
-
:region # default 'us-east-1', see
|
40
|
+
:region # default 'us-east-1', see http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region for options
|
41
41
|
:storage_headers # defaults to {'x-amz-acl' => 'public-read'}, can be overridden per-write - see below
|
42
42
|
:url_scheme # defaults to "http"
|
43
43
|
:url_host # defaults to "<bucket-name>.s3.amazonaws.com", or "s3.amazonaws.com/<bucket-name>" if not a valid subdomain
|
@@ -21,12 +21,4 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_runtime_dependency "dragonfly", "~> 1.0"
|
22
22
|
spec.add_runtime_dependency "fog-aws"
|
23
23
|
spec.add_development_dependency "rspec", "~> 2.0"
|
24
|
-
|
25
|
-
spec.post_install_message = <<-POST_INSTALL_MESSAGE
|
26
|
-
=====================================================
|
27
|
-
Thanks for installing dragonfly-s3_data_store!!
|
28
|
-
If you have any fog compatibility problems, please be aware that
|
29
|
-
it now depends on the 'fog-aws' gem rather than the 'fog' gem.
|
30
|
-
=====================================================
|
31
|
-
POST_INSTALL_MESSAGE
|
32
24
|
end
|
@@ -11,18 +11,6 @@ module Dragonfly
|
|
11
11
|
# Exceptions
|
12
12
|
class NotConfigured < RuntimeError; end
|
13
13
|
|
14
|
-
REGIONS = {
|
15
|
-
'us-east-1' => 's3.amazonaws.com', #default
|
16
|
-
'us-west-1' => 's3-us-west-1.amazonaws.com',
|
17
|
-
'us-west-2' => 's3-us-west-2.amazonaws.com',
|
18
|
-
'ap-northeast-1' => 's3-ap-northeast-1.amazonaws.com',
|
19
|
-
'ap-southeast-1' => 's3-ap-southeast-1.amazonaws.com',
|
20
|
-
'ap-southeast-2' => 's3-ap-southeast-2.amazonaws.com',
|
21
|
-
'eu-west-1' => 's3-eu-west-1.amazonaws.com',
|
22
|
-
'eu-central-1' => 's3-eu-central-1.amazonaws.com',
|
23
|
-
'sa-east-1' => 's3-sa-east-1.amazonaws.com'
|
24
|
-
}
|
25
|
-
|
26
14
|
SUBDOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]+[a-z0-9]$/
|
27
15
|
|
28
16
|
def initialize(opts={})
|
@@ -84,7 +72,12 @@ module Dragonfly
|
|
84
72
|
end
|
85
73
|
|
86
74
|
def domain
|
87
|
-
|
75
|
+
case region
|
76
|
+
when 'us-east-1', nil
|
77
|
+
's3.amazonaws.com'
|
78
|
+
else
|
79
|
+
"s3-#{region}.amazonaws.com"
|
80
|
+
end
|
88
81
|
end
|
89
82
|
|
90
83
|
def storage
|
@@ -130,12 +123,6 @@ module Dragonfly
|
|
130
123
|
end
|
131
124
|
end
|
132
125
|
|
133
|
-
def get_region
|
134
|
-
reg = region || 'us-east-1'
|
135
|
-
raise "Invalid region #{reg} - should be one of #{valid_regions.join(', ')}" unless valid_regions.include?(reg)
|
136
|
-
reg
|
137
|
-
end
|
138
|
-
|
139
126
|
def generate_uid(name)
|
140
127
|
"#{Time.now.strftime '%Y/%m/%d/%H/%M/%S'}/#{SecureRandom.uuid}/#{name}"
|
141
128
|
end
|
@@ -162,10 +149,6 @@ module Dragonfly
|
|
162
149
|
{'x-amz-meta-json' => Serializer.json_encode(meta)}
|
163
150
|
end
|
164
151
|
|
165
|
-
def valid_regions
|
166
|
-
REGIONS.keys
|
167
|
-
end
|
168
|
-
|
169
152
|
def rescuing_socket_errors(&block)
|
170
153
|
yield
|
171
154
|
rescue Excon::Errors::SocketError => e
|
data/spec/s3_data_store_spec.rb
CHANGED
@@ -5,6 +5,11 @@ require 'dragonfly/s3_data_store'
|
|
5
5
|
|
6
6
|
describe Dragonfly::S3DataStore do
|
7
7
|
|
8
|
+
# This used to exist in dragonfly as Dragonfly::Serializer.marshal_b64_encode
|
9
|
+
def deprecated_marshal_b64_encode(meta)
|
10
|
+
Base64.encode64(Marshal.dump(meta)).tr("\n=", '')
|
11
|
+
end
|
12
|
+
|
8
13
|
# To run these tests, put a file ".s3_spec.yml" in the dragonfly root dir, like this:
|
9
14
|
# key: XXXXXXXXXX
|
10
15
|
# secret: XXXXXXXXXX
|
@@ -115,11 +120,9 @@ describe Dragonfly::S3DataStore do
|
|
115
120
|
@data_store.domain.should == 's3-eu-west-1.amazonaws.com'
|
116
121
|
end
|
117
122
|
|
118
|
-
it "
|
119
|
-
@data_store.region = '
|
120
|
-
|
121
|
-
@data_store.domain
|
122
|
-
}.should raise_error
|
123
|
+
it "use the default one if us-east-1" do
|
124
|
+
@data_store.region = 'us-east-1'
|
125
|
+
@data_store.domain.should == 's3.amazonaws.com'
|
123
126
|
end
|
124
127
|
end
|
125
128
|
|
@@ -315,7 +318,7 @@ describe Dragonfly::S3DataStore do
|
|
315
318
|
|
316
319
|
it "works with the deprecated x-amz-meta-extra header (but stringifies its keys)" do
|
317
320
|
uid = @data_store.write(content, :headers => {
|
318
|
-
'x-amz-meta-extra' =>
|
321
|
+
'x-amz-meta-extra' => deprecated_marshal_b64_encode(:some => 'meta', :wo => 4),
|
319
322
|
'x-amz-meta-json' => ""
|
320
323
|
})
|
321
324
|
c, meta = @data_store.read(uid)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dragonfly-s3_data_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Evans
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-05-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dragonfly
|
@@ -60,6 +60,7 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|
@@ -73,12 +74,7 @@ homepage: https://github.com/markevans/dragonfly-s3_data_store
|
|
73
74
|
licenses:
|
74
75
|
- MIT
|
75
76
|
metadata: {}
|
76
|
-
post_install_message:
|
77
|
-
=====================================================
|
78
|
-
Thanks for installing dragonfly-s3_data_store!!
|
79
|
-
If you have any fog compatibility problems, please be aware that
|
80
|
-
it now depends on the 'fog-aws' gem rather than the 'fog' gem.
|
81
|
-
=====================================================
|
77
|
+
post_install_message:
|
82
78
|
rdoc_options: []
|
83
79
|
require_paths:
|
84
80
|
- lib
|
@@ -94,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
90
|
version: '0'
|
95
91
|
requirements: []
|
96
92
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.
|
93
|
+
rubygems_version: 2.6.7
|
98
94
|
signing_key:
|
99
95
|
specification_version: 4
|
100
96
|
summary: Data store for storing Dragonfly content (e.g. images) on S3
|