effective_assets 1.4.9 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 683799595ae295b197a44f02b02a769932610fcc
|
4
|
+
data.tar.gz: 28505119bba096a4952d6ddff8331dde8420bc6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8d0188295ccac3909e171064047f844ec53f841f9139a8739adcd2288482a01b595c34b355418b567771a45354d46ce68a4b3311452f2bb282901a44b34ce24
|
7
|
+
data.tar.gz: a0902359371838357880728816d299a6fb23225cff4ef62ad456582e437ed20bf6dabf6c585374628c63e972666940e4d5ebde7c253c265cefe87517217a1482
|
@@ -140,7 +140,7 @@ module Effective
|
|
140
140
|
end
|
141
141
|
|
142
142
|
def authenticated_url(version = nil, expire_in = 60.minutes)
|
143
|
-
data.
|
143
|
+
data.aws_authenticated_url_expiration = expire_in
|
144
144
|
version.present? ? data.send(version).file.authenticated_url : data.file.authenticated_url
|
145
145
|
end
|
146
146
|
|
@@ -172,19 +172,17 @@ module Effective
|
|
172
172
|
title
|
173
173
|
end
|
174
174
|
|
175
|
-
def
|
175
|
+
def process!
|
176
176
|
begin
|
177
|
-
Rails.logger.info "
|
178
|
-
print "
|
179
|
-
|
180
|
-
raise 'must be processed first before reprocessed' unless processed?
|
177
|
+
Rails.logger.info "Processing ##{id}..."
|
178
|
+
print "Processing ##{id}..."
|
181
179
|
|
182
180
|
data.cache_stored_file!
|
183
181
|
data.retrieve_from_cache!(data.cache_name)
|
184
182
|
data.recreate_versions!
|
185
183
|
save!
|
186
184
|
|
187
|
-
Rails.logger.info "Successfully
|
185
|
+
Rails.logger.info "Successfully processed ##{id}"
|
188
186
|
print "success"; puts ''
|
189
187
|
true
|
190
188
|
rescue => e
|
@@ -193,6 +191,7 @@ module Effective
|
|
193
191
|
false
|
194
192
|
end
|
195
193
|
end
|
194
|
+
alias_method :reprocess!, :process!
|
196
195
|
|
197
196
|
protected
|
198
197
|
|
@@ -1,6 +1,5 @@
|
|
1
1
|
class EffectiveAssetsUploader < CarrierWave::Uploader::Base
|
2
2
|
include CarrierWave::MiniMagick
|
3
|
-
storage :fog
|
4
3
|
|
5
4
|
def store_dir
|
6
5
|
"#{EffectiveAssets.aws_path.chomp('/')}/#{model.id.to_i}"
|
@@ -12,16 +11,16 @@ class EffectiveAssetsUploader < CarrierWave::Uploader::Base
|
|
12
11
|
@versions_info ||= calculate_versions_info
|
13
12
|
end
|
14
13
|
|
15
|
-
def
|
14
|
+
def aws_public
|
16
15
|
model.aws_acl == 'public-read' rescue true
|
17
16
|
end
|
18
17
|
|
19
|
-
def
|
20
|
-
@
|
18
|
+
def aws_authenticated_url_expiration
|
19
|
+
@aws_authenticated_url_expiration || 10.minutes
|
21
20
|
end
|
22
21
|
|
23
|
-
def
|
24
|
-
@
|
22
|
+
def aws_authenticated_url_expiration=(expires_in)
|
23
|
+
@aws_authenticated_url_expiration = expires_in
|
25
24
|
end
|
26
25
|
|
27
26
|
protected
|
data/lib/effective_assets.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require "effective_assets/engine"
|
2
|
-
require 'carrierwave'
|
2
|
+
require 'carrierwave-aws'
|
3
3
|
require 'delayed_job_active_record'
|
4
4
|
require 'migrant' # Required for rspec to run properly
|
5
5
|
require 'jquery-fileupload-rails'
|
@@ -45,16 +45,22 @@ module EffectiveAssets
|
|
45
45
|
def self.configure_carrierwave
|
46
46
|
if (@carrierwave_configured != true) && EffectiveAssets.uploader.present? && EffectiveAssets.aws_bucket.present?
|
47
47
|
CarrierWave.configure do |config|
|
48
|
-
config.
|
49
|
-
|
50
|
-
|
51
|
-
:aws_secret_access_key => EffectiveAssets.aws_secret_access_key,
|
52
|
-
:region => EffectiveAssets.aws_region.presence || 'us-east-1'
|
53
|
-
}
|
54
|
-
config.fog_directory = EffectiveAssets.aws_bucket
|
55
|
-
config.fog_public = EffectiveAssets.aws_acl.to_s.include?('public')
|
56
|
-
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
|
48
|
+
config.storage = :aws
|
49
|
+
config.aws_bucket = EffectiveAssets.aws_bucket
|
50
|
+
config.aws_acl = EffectiveAssets.aws_acl.presence || 'public-read'
|
57
51
|
config.cache_dir = "#{Rails.root}/tmp/uploads" # For heroku
|
52
|
+
|
53
|
+
config.aws_credentials = {
|
54
|
+
:access_key_id => EffectiveAssets.aws_access_key_id,
|
55
|
+
:secret_access_key => EffectiveAssets.aws_secret_access_key,
|
56
|
+
:region => EffectiveAssets.aws_region.presence || 'us-east-1'
|
57
|
+
}
|
58
|
+
|
59
|
+
config.aws_attributes = {
|
60
|
+
:cache_control => 'max-age=315576000',
|
61
|
+
:expires => 1.year.from_now.httpdate
|
62
|
+
}
|
63
|
+
|
58
64
|
end
|
59
65
|
|
60
66
|
@carrierwave_configured = true
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_assets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: carrierwave
|
28
|
+
name: carrierwave-aws
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -66,20 +66,6 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: fog
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.20.0
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.20.0
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: jquery-rails
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|