anaconda 0.13.1 → 0.14.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +5 -0
- data/lib/anaconda/anaconda_for.rb +9 -5
- data/lib/anaconda/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8e43e86824ee752934096b93a75dec0677d7c25
|
4
|
+
data.tar.gz: 53fb76dfe71116cec739ce274896a5bf4bc04a3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6c4f6a74a9c8ea7b1721d6265021082e38d1309d5177733bc740e117448b41fe3e5e1e4ba21f4f2b648eeb6d9437bb7b2b809f3100e6edfa46b7b734b59a2b3f
|
7
|
+
data.tar.gz: c5187169a46d096c765eaf784d319002684c37a8d6b213be4b37f020952974b2d5e82fe99cab7da56a299612de7c4987517799d4df561e62029cce5462830424
|
data/README.markdown
CHANGED
@@ -176,9 +176,14 @@ We highly recommend the `figaro` gem [https://github.com/laserlemon/figaro](http
|
|
176
176
|
|
177
177
|
`asset_url` will return a signed S3 URL if the file is stored with an ACL of `private` and will return a non-signed URL if the file is stored with public access.
|
178
178
|
|
179
|
+
You may pass an options hash to the `asset_url` magic method. At this time, the only supported option is :protocol. Example: `asset_url({protocol: 'http'})` This will override the `protocol` option set in the model.
|
180
|
+
|
179
181
|
`asset_download_url` will return a signed S3 URL with content-disposition set to attachment so the file will be downloaded instead of opened in the browser.
|
180
182
|
|
181
183
|
## Changelog
|
184
|
+
* 0.14.0
|
185
|
+
* Add ability to specify protocol in the magic `asset_url` method
|
186
|
+
|
182
187
|
* 0.13.1
|
183
188
|
* Use UTC for timestamp in migration files.
|
184
189
|
|
@@ -75,7 +75,7 @@ module Anaconda
|
|
75
75
|
end
|
76
76
|
case checking_method
|
77
77
|
when :url
|
78
|
-
anaconda_url(checking_column)
|
78
|
+
anaconda_url(checking_column, *args)
|
79
79
|
when :download_url
|
80
80
|
anaconda_download_url(checking_column)
|
81
81
|
else
|
@@ -87,16 +87,19 @@ module Anaconda
|
|
87
87
|
end
|
88
88
|
|
89
89
|
private
|
90
|
-
def anaconda_url(column_name)
|
90
|
+
def anaconda_url(column_name, *args)
|
91
91
|
return nil unless send("#{column_name}_file_path").present?
|
92
|
+
options = args.extract_options!
|
93
|
+
logger.debug "Extracted Options:"
|
94
|
+
logger.debug(options)
|
92
95
|
|
93
96
|
if send("#{column_name}_stored_privately")
|
94
97
|
aws = Fog::Storage.new({:provider => 'AWS', :aws_access_key_id => Anaconda.aws[:aws_access_key], :aws_secret_access_key => Anaconda.aws[:aws_secret_key], :path_style => true})
|
95
98
|
aws.get_object_https_url(Anaconda.aws[:aws_bucket], send("#{column_name}_file_path"), 1.hour.from_now)
|
96
99
|
elsif self.anaconda_options[column_name.to_sym][:host]
|
97
|
-
"#{anaconda_protocol(column_name)}#{self.anaconda_options[column_name.to_sym][:host]}/#{send("#{column_name}_file_path")}"
|
100
|
+
"#{anaconda_protocol(column_name, options[:protocol])}#{self.anaconda_options[column_name.to_sym][:host]}/#{send("#{column_name}_file_path")}"
|
98
101
|
else
|
99
|
-
"#{anaconda_protocol(column_name)}s3.amazonaws.com/#{Anaconda.aws[:aws_bucket]}/#{send("#{column_name}_file_path")}"
|
102
|
+
"#{anaconda_protocol(column_name, options[:protocol])}s3.amazonaws.com/#{Anaconda.aws[:aws_bucket]}/#{send("#{column_name}_file_path")}"
|
100
103
|
end
|
101
104
|
end
|
102
105
|
|
@@ -109,7 +112,8 @@ module Anaconda
|
|
109
112
|
|
110
113
|
end
|
111
114
|
|
112
|
-
def anaconda_protocol(column_name)
|
115
|
+
def anaconda_protocol(column_name, override = nil)
|
116
|
+
return override if override
|
113
117
|
case self.anaconda_options[column_name.to_sym][:protocol]
|
114
118
|
when :auto
|
115
119
|
"//"
|
data/lib/anaconda/version.rb
CHANGED