dragonfly-s3_data_store 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7958747f8087147274b566b9a03b588016e1951c
4
- data.tar.gz: baf40e36ace3f506553d1c227bfdae3e53a705ac
3
+ metadata.gz: 579ca4af3872e20c1c6f21531cedfee3f1bb56e9
4
+ data.tar.gz: fca80fb704e505bede803d25c1e8bdae5d0985e0
5
5
  SHA512:
6
- metadata.gz: 3a5a60312800230e4dcacd84486003e61114fab36c7a2922f28097f260dee1917b5f5f37de8fe930e32e12dcd298b56ebc65a079d1dba7f5134b72f1100f8763
7
- data.tar.gz: 6b8c30b5863c92c0485f91f4d4b492149e559525a990b9cd44473e610fe2bb63158022327e7d8c8df2e45ba87afd8371bd6c663a665b3822a6a91ad254d84336
6
+ metadata.gz: 95fe2ec3866d04d444821333e5acf1f9d84d6ad963ac119f4a2f4bfb61fc5be8367540312a5c53ec31377336cda1966043572cab2d5b4fcc963532ae4549a89b
7
+ data.tar.gz: 52ba953e4efcdfb49265b4f052cf51ce4bd58c50c3ffebb4cba7c4f1e051fa3a92811bfb0bd07de9fd91f9734d7229637240371f839d3370f346a8681bc41058
data/README.md CHANGED
@@ -38,6 +38,7 @@ end
38
38
  :url_host # defaults to "<bucket-name>.s3.amazonaws.com", or "s3.amazonaws.com/<bucket-name>" if not a valid subdomain
39
39
  :use_iam_profile # boolean - if true, no need for access_key_id or secret_access_key
40
40
  :root_path # store all content under a subdirectory - uids will be relative to this - defaults to nil
41
+ :fog_storage_options # hash for passing any extra options to Fog::Storage.new, e.g. {path_style: true}
41
42
  ```
42
43
 
43
44
  ### Per-storage options
@@ -1,5 +1,5 @@
1
1
  module Dragonfly
2
2
  class S3DataStore
3
- VERSION = "1.0.3"
3
+ VERSION = "1.0.4"
4
4
  end
5
5
  end
@@ -23,18 +23,19 @@ module Dragonfly
23
23
  SUBDOMAIN_PATTERN = /^[a-z0-9][a-z0-9.-]+[a-z0-9]$/
24
24
 
25
25
  def initialize(opts={})
26
- @bucket_name = opts[:bucket_name]
27
- @access_key_id = opts[:access_key_id]
26
+ @bucket_name = opts[:bucket_name]
27
+ @access_key_id = opts[:access_key_id]
28
28
  @secret_access_key = opts[:secret_access_key]
29
- @region = opts[:region]
30
- @storage_headers = opts[:storage_headers] || {'x-amz-acl' => 'public-read'}
31
- @url_scheme = opts[:url_scheme] || 'http'
32
- @url_host = opts[:url_host]
33
- @use_iam_profile = opts[:use_iam_profile]
34
- @root_path = opts[:root_path]
29
+ @region = opts[:region]
30
+ @storage_headers = opts[:storage_headers] || {'x-amz-acl' => 'public-read'}
31
+ @url_scheme = opts[:url_scheme] || 'http'
32
+ @url_host = opts[:url_host]
33
+ @use_iam_profile = opts[:use_iam_profile]
34
+ @root_path = opts[:root_path]
35
+ @fog_storage_options = opts[:fog_storage_options] || {}
35
36
  end
36
37
 
37
- attr_accessor :bucket_name, :access_key_id, :secret_access_key, :region, :storage_headers, :url_scheme, :url_host, :use_iam_profile, :root_path
38
+ attr_accessor :bucket_name, :access_key_id, :secret_access_key, :region, :storage_headers, :url_scheme, :url_host, :use_iam_profile, :root_path, :fog_storage_options
38
39
 
39
40
  def write(content, opts={})
40
41
  ensure_configured
@@ -85,13 +86,13 @@ module Dragonfly
85
86
 
86
87
  def storage
87
88
  @storage ||= begin
88
- storage = Fog::Storage.new({
89
+ storage = Fog::Storage.new(fog_storage_options.merge({
89
90
  :provider => 'AWS',
90
91
  :aws_access_key_id => access_key_id,
91
92
  :aws_secret_access_key => secret_access_key,
92
93
  :region => region,
93
94
  :use_iam_profile => use_iam_profile
94
- }.reject {|name, option| option.nil?})
95
+ }).reject {|name, option| option.nil?})
95
96
  storage.sync_clock
96
97
  storage
97
98
  end
@@ -333,4 +333,14 @@ describe Dragonfly::S3DataStore do
333
333
  end
334
334
  end
335
335
 
336
+ describe "fog_storage_options" do
337
+ it "adds options to Fog::Storage object" do
338
+ @data_store.fog_storage_options = {:random_option => 'look at me!'}
339
+ Fog::Storage.should_receive(:new).with do |hash|
340
+ hash[:random_option].should == 'look at me!'
341
+ hash[:aws_access_key_id].should match /\w+/
342
+ end.and_call_original
343
+ @data_store.storage
344
+ end
345
+ end
336
346
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly-s3_data_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Evans
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-07 00:00:00.000000000 Z
11
+ date: 2014-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dragonfly
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '2.0'
55
55
  description: S3 data store for Dragonfly
@@ -59,7 +59,7 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - .gitignore
62
+ - ".gitignore"
63
63
  - Gemfile
64
64
  - LICENSE.txt
65
65
  - README.md
@@ -79,17 +79,17 @@ require_paths:
79
79
  - lib
80
80
  required_ruby_version: !ruby/object:Gem::Requirement
81
81
  requirements:
82
- - - '>='
82
+ - - ">="
83
83
  - !ruby/object:Gem::Version
84
84
  version: '0'
85
85
  required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  requirements: []
91
91
  rubyforge_project:
92
- rubygems_version: 2.1.11
92
+ rubygems_version: 2.2.1
93
93
  signing_key:
94
94
  specification_version: 4
95
95
  summary: Data store for storing Dragonfly content (e.g. images) on S3