s3_file_field 1.2.1 → 1.3.0

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: ef07352fc0b375de126dd7c8a7ce16c49b795a21
4
- data.tar.gz: 879af5858f21cf7d2786fa61bca981fad2d83f86
3
+ metadata.gz: 834aede7c4a79df6f4904aff97935bcb1fd62a21
4
+ data.tar.gz: 1a2cf2be6867f2b38e29c848841f949599bd5ff0
5
5
  SHA512:
6
- metadata.gz: cb1fa63304886f3b2942984b5f0d026ff5c49f4221713dd1d30fe8d1499a23cbb9b35a5e169cc52721fbc139e6ea083810e0fc5270859c2181381ca1fa81429a
7
- data.tar.gz: 2e08953e3a376cfceea449b584630bbc16227f9d0ec7c730ddacbc8968d611d328f9c78914f418a8088e0031c330b03a5d47264188ad5253f2f535fa4f34a2ae
6
+ metadata.gz: de5f03bc8f889e79965610ef29e6617c79b4e912b7d67859334db82b7bd6f9a03aa725cab5d7517cabddb57ef3f0c0af9e17bd72ab110cae8e26f4d7c5e42879
7
+ data.tar.gz: 13c57184bd54a499aa16ac41f38df6ee2ce137ffaa3f17aca28ee7aceeb6a7bb2020ddaefbfce49702cc5e13fb87f5bc163d881c1bd4bda1bf3c4c5d17488bce
data/README.md CHANGED
@@ -32,6 +32,7 @@ S3FileField.config do |c|
32
32
  # c.max_file_size = 500.megabytes
33
33
  # c.conditions = []
34
34
  # c.key_starts_with = 'uploads/
35
+ # c.ssl = true # if unset or false, will default to current server settings
35
36
  end
36
37
  ```
37
38
 
@@ -4,7 +4,16 @@ module S3FileField
4
4
  class Config
5
5
  include Singleton
6
6
 
7
- ATTRIBUTES = [:access_key_id, :secret_access_key, :bucket, :prefix_to_clean, :region, :url, :key_starts_with]
7
+ ATTRIBUTES = [
8
+ :access_key_id,
9
+ :secret_access_key,
10
+ :bucket,
11
+ :prefix_to_clean,
12
+ :region,
13
+ :key_starts_with,
14
+ :ssl,
15
+ :url
16
+ ]
8
17
 
9
18
  attr_accessor *ATTRIBUTES
10
19
  end
@@ -13,6 +22,7 @@ module S3FileField
13
22
  if block_given?
14
23
  yield Config.instance
15
24
  end
25
+
16
26
  Config.instance
17
27
  end
18
28
  end
@@ -13,7 +13,9 @@ module S3FileField
13
13
  max_file_size: 500.megabytes,
14
14
  conditions: [],
15
15
  key_starts_with: S3FileField.config.key_starts_with || 'uploads/',
16
- region: S3FileField.config.region || 's3'
16
+ region: S3FileField.config.region || 's3',
17
+ url: S3FileField.config.url,
18
+ ssl: S3FileField.config.ssl
17
19
  }
18
20
 
19
21
  @key = original_options[:key]
@@ -33,8 +35,8 @@ module S3FileField
33
35
  raise Error.new("Please configure secret_access_key option.")
34
36
  end
35
37
 
36
- unless @options[:bucket]
37
- raise Error.new("Please configure bucket name.")
38
+ if @options[:bucket].nil? && @options[:url].nil?
39
+ raise Error.new("Please configure bucket name or url.")
38
40
  end
39
41
  end
40
42
 
@@ -60,7 +62,15 @@ module S3FileField
60
62
  end
61
63
 
62
64
  def url
63
- "//#{@options[:bucket]}.#{@options[:region]}.amazonaws.com/"
65
+ @url ||=
66
+ if @options[:url]
67
+ @options[:url]
68
+ else
69
+ protocol = @options[:ssl] == true ? "https" : @options[:ssl] == false ? "http" : nil
70
+ subdomain = "#{@options[:bucket]}.#{@options[:region]}"
71
+ domain = "//#{subdomain}.amazonaws.com/"
72
+ [protocol, domain].compact.join(":")
73
+ end
64
74
  end
65
75
 
66
76
  def policy
@@ -1,3 +1,3 @@
1
1
  module S3FileField
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
3
3
  end
metadata CHANGED
@@ -1,125 +1,125 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: s3_file_field
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Stankiewicz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-13 00:00:00.000000000 Z
11
+ date: 2014-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.2'
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: '3.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: coffee-rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 3.2.1
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: 3.2.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sass-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 3.2.5
48
48
  type: :runtime
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: 3.2.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jquery-fileupload-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.4.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.4.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.3'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.3'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: pry
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  description: jQuery File Upload extension for direct uploading to Amazon S3 using
@@ -149,17 +149,17 @@ require_paths:
149
149
  - lib
150
150
  required_ruby_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - '>='
152
+ - - ">="
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
- - - '>='
157
+ - - ">="
158
158
  - !ruby/object:Gem::Version
159
159
  version: '0'
160
160
  requirements: []
161
161
  rubyforge_project:
162
- rubygems_version: 2.2.1
162
+ rubygems_version: 2.4.1
163
163
  signing_key:
164
164
  specification_version: 4
165
165
  summary: jQuery File Upload extension for direct uploading to Amazon S3 using CORS