lalala 4.0.0.dev.74 → 4.0.0.dev.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/initializers/carrierwave.rb +15 -54
- data/lib/lalala/development.rb +4 -0
- data/lib/lalala/ext_better_errors/middleware.rb +15 -0
- data/lib/lalala/ext_better_errors.rb +10 -0
- data/lib/lalala/uploaders/image.rb +13 -1
- data/lib/lalala/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eca214b570a80c6ef65081749a0411536cbe2d80
|
4
|
+
data.tar.gz: 16afe6226f571dbfbba05f2169142f99af4b91ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357b20d0754a830fc69307e156a6b7c12cc24e10165417262afcd51e5c47b74ff55ecfcaeb92137d3fb38d6868bf6a54c770bf1a5e38fee335d8020781765d04
|
7
|
+
data.tar.gz: c38ce6259edc9fe7ce8594e3093abcfa382ecb0d71407265f349ae11b75e34cb04576b0dfe8025cd67f732e2a090e27bd12e11731340140015e2ee360b141aaa
|
@@ -1,65 +1,26 @@
|
|
1
|
-
def storage_config
|
2
|
-
path = File.join(Rails.root.to_s, 'config/filesystem.yml')
|
3
|
-
unless File.file?(path)
|
4
|
-
return nil
|
5
|
-
end
|
6
|
-
|
7
|
-
config = YAML::load(ERB.new(File.read(path)).result)
|
8
|
-
unless Hash === config
|
9
|
-
return nil
|
10
|
-
end
|
11
|
-
|
12
|
-
config = config[Rails.env.to_s]
|
13
|
-
unless Hash === config
|
14
|
-
return nil
|
15
|
-
end
|
16
|
-
|
17
|
-
config
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
1
|
#
|
23
|
-
#
|
2
|
+
# Carrier Wave configuration block
|
24
3
|
#
|
25
|
-
|
26
|
-
config.storage = :fog
|
27
|
-
config.root = Rails.root.join('tmp')
|
28
|
-
config.cache_dir = 'uploads'
|
29
|
-
|
30
|
-
credentials = {
|
31
|
-
provider: 'AWS',
|
32
|
-
aws_access_key_id: s3['access_key_id'],
|
33
|
-
aws_secret_access_key: s3['secret_access_key'],
|
34
|
-
region: 'eu-west-1'
|
35
|
-
}
|
36
|
-
|
37
|
-
if s3['vhost']
|
38
|
-
config.asset_host = "http://#{s3['vhost']}"
|
39
|
-
elsif s3['bucket'] and s3['bucket'].index(".")
|
40
|
-
config.asset_host = "http://#{s3['bucket']}.s3.amazonaws.com"
|
41
|
-
end
|
4
|
+
CarrierWave.configure do |config|
|
42
5
|
|
43
|
-
|
44
|
-
config.fog_directory = s3['vhost'] || s3['bucket']
|
45
|
-
end
|
6
|
+
if Rails.env.production? or Rails.env.staging?
|
46
7
|
|
8
|
+
config.storage = :fog
|
9
|
+
config.root = Rails.root.join('tmp')
|
10
|
+
config.cache_dir = 'uploads'
|
47
11
|
|
48
|
-
|
49
|
-
|
50
|
-
|
12
|
+
config.fog_credentials = {
|
13
|
+
provider: 'AWS',
|
14
|
+
aws_access_key_id: ENV["LALALA_S3_ACCESS_KEY"],
|
15
|
+
aws_secret_access_key: ENV["LALALA_S3_SECRET_KEY"]
|
16
|
+
}
|
51
17
|
|
18
|
+
config.fog_directory = ENV["LALALA_S3_BUCKET"]
|
19
|
+
config.fog_attributes = {'Cache-Control'=>'max-age=315576000'}
|
52
20
|
|
53
21
|
|
54
|
-
#
|
55
|
-
|
56
|
-
#
|
57
|
-
CarrierWave.configure do |config|
|
58
|
-
s3 = storage_config
|
22
|
+
else # dev
|
23
|
+
config.storage = :file
|
59
24
|
|
60
|
-
if s3
|
61
|
-
configure_s3(config, s3)
|
62
|
-
else
|
63
|
-
configure_filesystem(config)
|
64
25
|
end
|
65
26
|
end
|
data/lib/lalala/development.rb
CHANGED
@@ -5,7 +5,19 @@ class Lalala::Uploaders::Image < CarrierWave::Uploader::Base
|
|
5
5
|
include Sprockets::Helpers::IsolatedHelper
|
6
6
|
|
7
7
|
def store_dir
|
8
|
-
|
8
|
+
if Rails.env.production? or Rails.env.staging?
|
9
|
+
"#{model.class.to_s.underscore}/#{model.id}"
|
10
|
+
else
|
11
|
+
"uploads/#{model.class.to_s.underscore}/#{model.id}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def url(*)
|
16
|
+
if Rails.env.production? or Rails.env.staging?
|
17
|
+
File.join("/store/assets", super)
|
18
|
+
else
|
19
|
+
super
|
20
|
+
end
|
9
21
|
end
|
10
22
|
|
11
23
|
def extension_white_list
|
data/lib/lalala/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lalala
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.dev.
|
4
|
+
version: 4.0.0.dev.77
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Menke
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2013-04-
|
16
|
+
date: 2013-04-15 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: carrierwave
|
@@ -1469,6 +1469,8 @@ files:
|
|
1469
1469
|
- lib/lalala/ext_active_record/schema.rb
|
1470
1470
|
- lib/lalala/ext_active_record/schema/join_table.rb
|
1471
1471
|
- lib/lalala/ext_active_record/schema/join_table_inverter.rb
|
1472
|
+
- lib/lalala/ext_better_errors.rb
|
1473
|
+
- lib/lalala/ext_better_errors/middleware.rb
|
1472
1474
|
- lib/lalala/ext_i18n.rb
|
1473
1475
|
- lib/lalala/ext_i18n/input_helper.rb
|
1474
1476
|
- lib/lalala/ext_i18n/negotiation_adapter.rb
|