dragonfly-dreamobjects_data_store 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 415b1f19d21f31b87b000ec7e5f130e32972a249
4
+ data.tar.gz: b6db7bca0ef9bbd22664f44aaf8212119efd8982
5
+ SHA512:
6
+ metadata.gz: 2c7e01f6fff175a5fd6d2446f0eae3cd1108c404c3b1e3919ea53ba14ac2537224f94848d029ea2d177f72c6b4e465ecf67bfcb5afa22eea129426ab0cf1eeff
7
+ data.tar.gz: 6e33035098af475e2be56a66295d1287602254aa817d2509f2d0b77f22a0fbff84faa2785575bc4c151402fef86ee5b2449a95d90b920d13af31ed572fc27a7e
data/.gitignore ADDED
@@ -0,0 +1,35 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /test/tmp/
9
+ /test/version_tmp/
10
+ /tmp/
11
+
12
+ ## Specific to RubyMotion:
13
+ .dat*
14
+ .repl_history
15
+ build/
16
+
17
+ ## Documentation cache and generated files:
18
+ /.yardoc/
19
+ /_yardoc/
20
+ /doc/
21
+ /rdoc/
22
+
23
+ ## Environment normalisation:
24
+ /.bundle/
25
+ /lib/bundler/man/
26
+
27
+ # for a library or gem, you might want to ignore these files since the code is
28
+ # intended to run in multiple environments; otherwise, check them in:
29
+ # Gemfile.lock
30
+ # .ruby-version
31
+ # .ruby-gemset
32
+
33
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
34
+ .rvmrc
35
+ .s3_spec.yml
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
3
+
4
+ gem 'pry'
data/Gemfile.lock ADDED
@@ -0,0 +1,54 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ dragonfly-dreamobjects_data_store (0.0.1)
5
+ aws-sdk
6
+ dragonfly (~> 1.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ addressable (2.3.6)
12
+ aws-sdk (1.59.0)
13
+ aws-sdk-v1 (= 1.59.0)
14
+ aws-sdk-v1 (1.59.0)
15
+ json (~> 1.4)
16
+ nokogiri (>= 1.4.4)
17
+ coderay (1.1.0)
18
+ diff-lcs (1.2.5)
19
+ dragonfly (1.0.7)
20
+ addressable (~> 2.3)
21
+ multi_json (~> 1.0)
22
+ rack
23
+ json (1.8.1)
24
+ method_source (0.8.2)
25
+ mini_portile (0.6.1)
26
+ multi_json (1.10.1)
27
+ nokogiri (1.6.4.1)
28
+ mini_portile (~> 0.6.0)
29
+ pry (0.10.1)
30
+ coderay (~> 1.1.0)
31
+ method_source (~> 0.8.1)
32
+ slop (~> 3.4)
33
+ rack (1.5.2)
34
+ rspec (3.1.0)
35
+ rspec-core (~> 3.1.0)
36
+ rspec-expectations (~> 3.1.0)
37
+ rspec-mocks (~> 3.1.0)
38
+ rspec-core (3.1.7)
39
+ rspec-support (~> 3.1.0)
40
+ rspec-expectations (3.1.2)
41
+ diff-lcs (>= 1.2.0, < 2.0)
42
+ rspec-support (~> 3.1.0)
43
+ rspec-mocks (3.1.3)
44
+ rspec-support (~> 3.1.0)
45
+ rspec-support (3.1.2)
46
+ slop (3.6.0)
47
+
48
+ PLATFORMS
49
+ ruby
50
+
51
+ DEPENDENCIES
52
+ dragonfly-dreamobjects_data_store!
53
+ pry
54
+ rspec (~> 3.0)
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Gabriel Rios
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,39 @@
1
+ # Dragonfly::S3DataStore
2
+
3
+ Dreamobjects data store for use with the [Dragonfly](http://github.com/markevans/dragonfly) gem.
4
+
5
+ Heavily inspired on [Dragonfly::S3DataStore](http://github.com/markevans/dragonfly-s3_data_storage) gem
6
+
7
+ ## Gemfile
8
+
9
+ ```ruby
10
+ gem 'dragonfly-dreamobjects_data_store'
11
+ ```
12
+
13
+ ## Usage
14
+ Configuration (remember the require)
15
+
16
+ ```ruby
17
+ require 'dragonfly/s3_data_store'
18
+
19
+ Dragonfly.app.configure do
20
+ # ...
21
+
22
+ datastore :dreamobjects,
23
+ bucket_name: 'my-bucket',
24
+ access_key_id: 'blahblahblah',
25
+ secret_access_key: 'blublublublu'
26
+
27
+ # ...
28
+ end
29
+ ```
30
+
31
+ ### Available configuration options
32
+
33
+ ```ruby
34
+ :bucket_name
35
+ :access_key_id
36
+ :secret_access_key
37
+ :endpoint # Dreamobjects Server URL
38
+ ```
39
+
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'dragonfly/dreamobjects_data_store/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "dragonfly-dreamobjects_data_store"
8
+ spec.version = Dragonfly::DreamobjectsDataStore::VERSION
9
+ spec.authors = ["Gabriel Rios"]
10
+ spec.email = ["gabrielfalcaorios@gmail.com"]
11
+ spec.description = %q{Dreamobjects data store for Dragonfly}
12
+ spec.summary = %q{Data store for storing Dragonfly content (e.g. images) on S3}
13
+ spec.homepage = "https://github.com/gabrielrios/dragonfly-dreamobjects_data_store"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{ˆ(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_runtime_dependency "dragonfly", "~> 1.0"
22
+ spec.add_runtime_dependency "aws-sdk"
23
+ spec.add_development_dependency "rspec", "~> 3.0"
24
+ end
@@ -0,0 +1,71 @@
1
+ require 'aws'
2
+ require 'pry'
3
+ require 'dragonfly'
4
+
5
+ Dragonfly::App.register_datastore(:dreamobjects) { Dragonfly::DreamobjectsDataStore }
6
+
7
+ module Dragonfly
8
+ class DreamobjectsDataStore
9
+ def initialize(options = {})
10
+ @bucket_name = options[:bucket_name]
11
+ @access_key_id = options[:access_key_id]
12
+ @secret_access_key = options[:secret_access_key]
13
+ @endpoint = options.fetch(:endpoint, 'objects.dreamhost.com')
14
+ end
15
+
16
+ def write(content, opts={})
17
+ uid = opts[:path] || generate_uid(content.name || 'file')
18
+ bucket.objects[uid].write(content.data,
19
+ metadata: { json: Serializer.json_encode(content.meta)})
20
+ uid
21
+ end
22
+
23
+ # # Retrieve the data and meta as a 2-item array
24
+ def read(uid)
25
+ object = bucket.objects[uid]
26
+ data = object.read
27
+ meta = Serializer.json_decode(object.metadata[:json])
28
+ [
29
+ data, # can be a String, File, Pathname, Tempfile
30
+ meta # the same meta Hash that was stored with write
31
+ ]
32
+ end
33
+
34
+ def destroy(uid)
35
+ bucket.objects[uid].delete
36
+ end
37
+
38
+ def create_bucket(name)
39
+ storage.buckets.create(name)
40
+ end
41
+
42
+ private
43
+ def storage
44
+ @storage ||= AWS::S3.new(access_key_id: @access_key_id,
45
+ secret_access_key: @secret_access_key,
46
+ s3_endpoint: @endpoint,
47
+ use_ssl: false,
48
+ s3_force_path_style: true)
49
+ end
50
+
51
+ def bucket
52
+ @bucket ||= storage.buckets[@bucket_name]
53
+ end
54
+
55
+ def ensure_configured
56
+ unless @configured
57
+ [:bucket_name, :access_key_id, :secret_access_key].each do |attr|
58
+ if send(attr).nil?
59
+ raise NotConfigured, "You need to configure #{self.class.name} with #{attr}"
60
+ end
61
+ end
62
+ end
63
+ @configured = true
64
+ end
65
+
66
+ def generate_uid(name)
67
+ "#{Time.now.strftime '%Y/%m/%d/%H/%M/%S'}/#{rand(1000)}/#{name.gsub(/[^\w.]+/, '_')}"
68
+ end
69
+ end
70
+ end
71
+
@@ -0,0 +1,5 @@
1
+ module Dragonfly
2
+ class DreamobjectsDataStore
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,343 @@
1
+ require 'spec_helper'
2
+ require 'dragonfly/spec/data_store_examples'
3
+ require 'yaml'
4
+ require 'dragonfly/dreamobjects_data_store'
5
+
6
+ describe Dragonfly::DreamobjectsDataStore do
7
+ # To run these tests, put a file ".dreamobjects_spec.yml" in the dragonfly root dir, like this:
8
+ # key: XXXXXXXXXX
9
+ # secret: XXXXXXXXXX
10
+ # enabled: true
11
+ if File.exist?(file = File.expand_path('../../.s3_spec.yml', __FILE__))
12
+ config = YAML.load_file(file)
13
+ KEY = config['key']
14
+ SECRET = config['secret']
15
+ enabled = config['enabled']
16
+ else
17
+ enabled = false
18
+ end
19
+
20
+ if enabled
21
+
22
+ # Make sure it's a new bucket name
23
+ BUCKET_NAME = "dragonfly-test-#{Time.now.to_i.to_s(36)}"
24
+
25
+ before(:each) do
26
+ @data_store = Dragonfly::DreamobjectsDataStore.new(
27
+ :bucket_name => BUCKET_NAME,
28
+ :access_key_id => KEY,
29
+ :secret_access_key => SECRET,
30
+ )
31
+ @data_store.create_bucket(BUCKET_NAME)
32
+ end
33
+
34
+ else
35
+ BUCKET_NAME = 'test-bucket'
36
+
37
+ before(:each) do
38
+ @data_store = Dragonfly::DreamobjectsDataStore.new(
39
+ :bucket_name => BUCKET_NAME,
40
+ :access_key_id => 'XXXXXXXXX',
41
+ :secret_access_key => 'XXXXXXXXX',
42
+ )
43
+ @data_store.create_bucket(BUCKET_NAME)
44
+ end
45
+
46
+ end
47
+
48
+ it_should_behave_like 'data_store'
49
+
50
+ let (:app) { Dragonfly.app }
51
+ let (:content) { Dragonfly::Content.new(app, "eggheads") }
52
+ let (:new_content) { Dragonfly::Content.new(app) }
53
+
54
+ describe "registering with a symbol" do
55
+ it "registers a symbol for configuring" do
56
+ app.configure do
57
+ datastore :dreamobjects
58
+ end
59
+ expect(app.datastore).to be_a(Dragonfly::DreamobjectsDataStore)
60
+ end
61
+ end
62
+
63
+ # describe "write" do
64
+ # it "should use the name from the content if set" do
65
+ # content.name = 'doobie.doo'
66
+ # uid = @data_store.write(content)
67
+ # uid.should =~ /doobie\.doo$/
68
+ # new_content.update(*@data_store.read(uid))
69
+ # new_content.data.should == 'eggheads'
70
+ # end
71
+
72
+ # it "should work ok with files with funny names" do
73
+ # content.name = "A Picture with many spaces in its name (at 20:00 pm).png"
74
+ # uid = @data_store.write(content)
75
+ # uid.should =~ /A_Picture_with_many_spaces_in_its_name_at_20_00_pm_\.png$/
76
+ # new_content.update(*@data_store.read(uid))
77
+ # new_content.data.should == 'eggheads'
78
+ # end
79
+
80
+ # it "should allow for setting the path manually" do
81
+ # uid = @data_store.write(content, :path => 'hello/there')
82
+ # uid.should == 'hello/there'
83
+ # new_content.update(*@data_store.read(uid))
84
+ # new_content.data.should == 'eggheads'
85
+ # end
86
+
87
+ # if enabled # Fog.mock! doesn't act consistently here
88
+ # it "should reset the connection and try again if Fog throws a socket EOFError" do
89
+ # @data_store.storage.should_receive(:put_object).exactly(:once).and_raise(Excon::Errors::SocketError.new(EOFError.new))
90
+ # @data_store.storage.should_receive(:put_object).with(BUCKET_NAME, anything, anything, hash_including)
91
+ # @data_store.write(content)
92
+ # end
93
+
94
+ # it "should just let it raise if Fog throws a socket EOFError again" do
95
+ # @data_store.storage.should_receive(:put_object).and_raise(Excon::Errors::SocketError.new(EOFError.new))
96
+ # @data_store.storage.should_receive(:put_object).and_raise(Excon::Errors::SocketError.new(EOFError.new))
97
+ # expect{
98
+ # @data_store.write(content)
99
+ # }.to raise_error(Excon::Errors::SocketError)
100
+ # end
101
+ # end
102
+ # end
103
+
104
+ # describe "domain" do
105
+ # it "should default to the US" do
106
+ # @data_store.region = nil
107
+ # @data_store.domain.should == 'dreamobjects.amazonaws.com'
108
+ # end
109
+
110
+ # it "should return the correct domain" do
111
+ # @data_store.region = 'eu-west-1'
112
+ # @data_store.domain.should == 'dreamobjects-eu-west-1.amazonaws.com'
113
+ # end
114
+
115
+ # it "does raise an error if an unknown region is given" do
116
+ # @data_store.region = 'latvia-central'
117
+ # lambda{
118
+ # @data_store.domain
119
+ # }.should raise_error
120
+ # end
121
+ # end
122
+
123
+ # describe "not configuring stuff properly" do
124
+ # it "should require a bucket name on write" do
125
+ # @data_store.bucket_name = nil
126
+ # proc{ @data_store.write(content) }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
127
+ # end
128
+
129
+ # it "should require an access_key_id on write" do
130
+ # @data_store.access_key_id = nil
131
+ # proc{ @data_store.write(content) }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
132
+ # end
133
+
134
+ # it "should require a secret access key on write" do
135
+ # @data_store.secret_access_key = nil
136
+ # proc{ @data_store.write(content) }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
137
+ # end
138
+
139
+ # it "should require a bucket name on read" do
140
+ # @data_store.bucket_name = nil
141
+ # proc{ @data_store.read('asdf') }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
142
+ # end
143
+
144
+ # it "should require an access_key_id on read" do
145
+ # @data_store.access_key_id = nil
146
+ # proc{ @data_store.read('asdf') }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
147
+ # end
148
+
149
+ # it "should require a secret access key on read" do
150
+ # @data_store.secret_access_key = nil
151
+ # proc{ @data_store.read('asdf') }.should raise_error(Dragonfly::DreamobjectsDataStore::NotConfigured)
152
+ # end
153
+
154
+ # if !enabled #this will fail since the specs are not running on an ec2 instance with an iam role defined
155
+ # it 'should allow missing secret key and access key on write if iam profiles are allowed' do
156
+ # # This is slightly brittle but it's annoying waiting for fog doing stuff
157
+ # @data_store.storage.stub(:get_bucket_location => nil, :put_object => nil)
158
+
159
+ # @data_store.use_iam_profile = true
160
+ # @data_store.secret_access_key = nil
161
+ # @data_store.access_key_id = nil
162
+ # expect{ @data_store.write(content) }.not_to raise_error
163
+ # end
164
+ # end
165
+ # end
166
+
167
+ # describe "root_path" do
168
+ # before do
169
+ # content.name = "something.png"
170
+ # @data_store.root_path = "some/path"
171
+ # end
172
+
173
+ # it "stores files in the provided sub directory" do
174
+ # @data_store.storage.should_receive(:put_object).with(BUCKET_NAME, /^some\/path\/.*\/something\.png$/, anything, anything)
175
+ # @data_store.write(content)
176
+ # end
177
+
178
+ # it "finds files in the provided sub directory" do
179
+ # mock_response = double("response", body: "", headers: {})
180
+ # uid = @data_store.write(content)
181
+ # @data_store.storage.should_receive(:get_object).with(BUCKET_NAME, /^some\/path\/.*\/something\.png$/).and_return(mock_response)
182
+ # @data_store.read(uid)
183
+ # end
184
+
185
+ # it "does not alter the uid" do
186
+ # uid = @data_store.write(content)
187
+ # uid.should include("something.png")
188
+ # uid.should_not include("some/path")
189
+ # end
190
+
191
+ # it "destroys files in the provided sub directory" do
192
+ # uid = @data_store.write(content)
193
+ # @data_store.storage.should_receive(:delete_object).with(BUCKET_NAME, /^some\/path\/.*\/something\.png$/)
194
+ # @data_store.destroy(uid)
195
+ # end
196
+
197
+ # describe "url_for" do
198
+ # before do
199
+ # @uid = @data_store.write(content)
200
+ # end
201
+
202
+ # it "returns the uid prefixed with the root_path" do
203
+ # @data_store.url_for(@uid).should =~ /some\/path\/.*\/something\.png/
204
+ # end
205
+
206
+ # it "gives an expiring url" do
207
+ # @data_store.url_for(@uid, :expires => 1301476942).should =~ /\/some\/path\/.*\/something\.png\?AWSAccessKeyId=/
208
+ # end
209
+ # end
210
+ # end
211
+
212
+ # describe "autocreating the bucket" do
213
+ # it "should create the bucket on write if it doesn't exist" do
214
+ # @data_store.bucket_name = "dragonfly-test-blah-blah-#{rand(100000000)}"
215
+ # @data_store.write(content)
216
+ # end
217
+
218
+ # it "should not try to create the bucket on read if it doesn't exist" do
219
+ # @data_store.bucket_name = "dragonfly-test-blah-blah-#{rand(100000000)}"
220
+ # @data_store.send(:storage).should_not_receive(:put_bucket)
221
+ # @data_store.read("gungle").should be_nil
222
+ # end
223
+ # end
224
+
225
+ # describe "headers" do
226
+ # before(:each) do
227
+ # @data_store.storage_headers = {'x-amz-foo' => 'biscuithead'}
228
+ # end
229
+
230
+ # it "should allow configuring globally" do
231
+ # @data_store.storage.should_receive(:put_object).with(BUCKET_NAME, anything, anything,
232
+ # hash_including('x-amz-foo' => 'biscuithead')
233
+ # )
234
+ # @data_store.write(content)
235
+ # end
236
+
237
+ # it "should allow adding per-store" do
238
+ # @data_store.storage.should_receive(:put_object).with(BUCKET_NAME, anything, anything,
239
+ # hash_including('x-amz-foo' => 'biscuithead', 'hello' => 'there')
240
+ # )
241
+ # @data_store.write(content, :headers => {'hello' => 'there'})
242
+ # end
243
+
244
+ # it "should let the per-store one take precedence" do
245
+ # @data_store.storage.should_receive(:put_object).with(BUCKET_NAME, anything, anything,
246
+ # hash_including('x-amz-foo' => 'override!')
247
+ # )
248
+ # @data_store.write(content, :headers => {'x-amz-foo' => 'override!'})
249
+ # end
250
+
251
+ # it "should write setting the content type" do
252
+ # @data_store.storage.should_receive(:put_object) do |_, __, ___, headers|
253
+ # headers['Content-Type'].should == 'image/png'
254
+ # end
255
+ # content.name = 'egg.png'
256
+ # @data_store.write(content)
257
+ # end
258
+
259
+ # it "allow overriding the content type" do
260
+ # @data_store.storage.should_receive(:put_object) do |_, __, ___, headers|
261
+ # headers['Content-Type'].should == 'text/plain'
262
+ # end
263
+ # content.name = 'egg.png'
264
+ # @data_store.write(content, :headers => {'Content-Type' => 'text/plain'})
265
+ # end
266
+ # end
267
+
268
+ # describe "urls for serving directly" do
269
+
270
+ # before(:each) do
271
+ # @uid = 'some/path/on/dreamobjects'
272
+ # end
273
+
274
+ # it "should use the bucket subdomain" do
275
+ # @data_store.url_for(@uid).should == "http://#{BUCKET_NAME}.dreamobjects.amazonaws.com/some/path/on/dreamobjects"
276
+ # end
277
+
278
+ # it "should use path style if the bucket is not a valid dreamobjects subdomain" do
279
+ # bucket_name = BUCKET_NAME.upcase
280
+ # @data_store.bucket_name = bucket_name
281
+ # @data_store.url_for(@uid).should == "http://dreamobjects.amazonaws.com/#{bucket_name}/some/path/on/dreamobjects"
282
+ # end
283
+
284
+ # it "should use the bucket subdomain for other regions too" do
285
+ # @data_store.region = 'eu-west-1'
286
+ # @data_store.url_for(@uid).should == "http://#{BUCKET_NAME}.dreamobjects.amazonaws.com/some/path/on/dreamobjects"
287
+ # end
288
+
289
+ # it "should give an expiring url" do
290
+ # @data_store.url_for(@uid, :expires => 1301476942).should =~
291
+ # %r{^https://#{BUCKET_NAME}\.#{@data_store.domain}/some/path/on/dreamobjects\?AWSAccessKeyId=#{@data_store.access_key_id}&Signature=[\w%/]+&Expires=1301476942$}
292
+ # end
293
+
294
+ # it "should allow for using https" do
295
+ # @data_store.url_for(@uid, :scheme => 'https').should == "https://#{BUCKET_NAME}.dreamobjects.amazonaws.com/some/path/on/dreamobjects"
296
+ # end
297
+
298
+ # it "should allow for always using https" do
299
+ # @data_store.url_scheme = 'https'
300
+ # @data_store.url_for(@uid).should == "https://#{BUCKET_NAME}.dreamobjects.amazonaws.com/some/path/on/dreamobjects"
301
+ # end
302
+
303
+ # it "should allow for customizing the host" do
304
+ # @data_store.url_for(@uid, :host => 'customised.domain.com/and/path').should == "http://customised.domain.com/and/path/some/path/on/dreamobjects"
305
+ # end
306
+
307
+ # it "should allow the url_host to be customised permanently" do
308
+ # url_host = 'customised.domain.com/and/path'
309
+ # @data_store.url_host = url_host
310
+ # @data_store.url_for(@uid).should == "http://#{url_host}/some/path/on/dreamobjects"
311
+ # end
312
+
313
+ # end
314
+
315
+ # describe "meta" do
316
+ # it "uses the x-amz-meta-json header for meta" do
317
+ # uid = @data_store.write(content, :headers => {'x-amz-meta-json' => Dragonfly::Serializer.json_encode({'potato' => 44})})
318
+ # c, meta = @data_store.read(uid)
319
+ # meta['potato'].should == 44
320
+ # end
321
+
322
+ # it "works with the deprecated x-amz-meta-extra header (but stringifies its keys)" do
323
+ # uid = @data_store.write(content, :headers => {
324
+ # 'x-amz-meta-extra' => Dragonfly::Serializer.marshal_b64_encode(:some => 'meta', :wo => 4),
325
+ # 'x-amz-meta-json' => nil
326
+ # })
327
+ # c, meta = @data_store.read(uid)
328
+ # meta['some'].should == 'meta'
329
+ # meta['wo'].should == 4
330
+ # end
331
+ # end
332
+
333
+ # describe "fog_storage_options" do
334
+ # it "adds options to Fog::Storage object" do
335
+ # @data_store.fog_storage_options = {:random_option => 'look at me!'}
336
+ # Fog::Storage.should_receive(:new).with do |hash|
337
+ # hash[:random_option].should == 'look at me!'
338
+ # hash[:aws_access_key_id].should match /\w+/
339
+ # end.and_call_original
340
+ # @data_store.storage
341
+ # end
342
+ # end
343
+ end
@@ -0,0 +1,5 @@
1
+ RSpec.configure do |config|
2
+ config.run_all_when_everything_filtered = true
3
+ config.filter_run :focus
4
+ config.order = :random
5
+ end
metadata ADDED
@@ -0,0 +1,98 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dragonfly-dreamobjects_data_store
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Gabriel Rios
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-26 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: dragonfly
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: aws-sdk
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ description: Dreamobjects data store for Dragonfly
56
+ email:
57
+ - gabrielfalcaorios@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE
66
+ - README.md
67
+ - Rakefile
68
+ - dragonfly-dreamobjects_data_store.gemspec
69
+ - lib/dragonfly/dreamobjects_data_store.rb
70
+ - lib/dragonfly/dreamobjects_data_store/version.rb
71
+ - spec/dreamobjects_data_store_spec.rb
72
+ - spec/spec_helper.rb
73
+ homepage: https://github.com/gabrielrios/dragonfly-dreamobjects_data_store
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.2.2
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Data store for storing Dragonfly content (e.g. images) on S3
97
+ test_files: []
98
+ has_rdoc: