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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbf0f41182685c5c91f623dcbd13be5443360e45
4
- data.tar.gz: e385b24daef3931fd1f8a106dc7adf2dc455247c
3
+ metadata.gz: eca214b570a80c6ef65081749a0411536cbe2d80
4
+ data.tar.gz: 16afe6226f571dbfbba05f2169142f99af4b91ae
5
5
  SHA512:
6
- metadata.gz: dbeca1d4d11adfc22e88bd7c173546f795d718b61fdf1d4bad97203b218c2437a846b4366d95b7f80d9603b557adc30a35ed3685878d93cd09ed14ec9c6725d2
7
- data.tar.gz: e312e92cf0b2b31ed69d7bde78770f65cfa752ea2c3231dd6d67ff84533d230c3bb4da9ad420dbee90e4468e10ed6c57fc509af4a73034c24c90fb2a0e9f41ef
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
- # Configuration types
2
+ # Carrier Wave configuration block
24
3
  #
25
- def configure_s3(config, s3)
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
- config.fog_credentials = credentials
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
- def configure_filesystem(config)
49
- config.storage = :file
50
- end
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
- # Carrier Wave configuration block
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
@@ -5,6 +5,10 @@ module Lalala
5
5
  require 'pry-rails'
6
6
  require 'better_errors'
7
7
 
8
+ autoload :ExtBetterErrors
9
+
10
+ Lalala::ExtBetterErrors.patch!
11
+
8
12
  end
9
13
 
10
14
  if defined?(Rails::Generators)
@@ -0,0 +1,15 @@
1
+ module Lalala::ExtBetterErrors::Middleware
2
+ extend ActiveSupport::Concern
3
+
4
+ included do
5
+ remove_method :allow_ip?
6
+ alias_method :allow_ip?, :_ng_allow_ip?
7
+ end
8
+
9
+ private
10
+
11
+ def _ng_allow_ip?(env)
12
+ true
13
+ end
14
+
15
+ end
@@ -0,0 +1,10 @@
1
+ module Lalala::ExtBetterErrors
2
+ extend ActiveSupport::Autoload
3
+
4
+ autoload :Middleware
5
+
6
+ def self.patch!
7
+ BetterErrors::Middleware.send :include, Lalala::ExtBetterErrors::Middleware
8
+ end
9
+
10
+ end
@@ -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
- "uploads/#{model.class.to_s.underscore}/#{model.id}"
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
@@ -1,6 +1,6 @@
1
1
  module Lalala
2
2
  VERSION = "4.0.0"
3
- BUILD = "74"
3
+ BUILD = "77"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
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.74
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-12 00:00:00.000000000 Z
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