cloudinary 1.11.1 → 1.12.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 +4 -4
- data/.gitignore +6 -1
- data/.travis.yml +12 -6
- data/CHANGELOG.md +30 -0
- data/cloudinary.gemspec +2 -0
- data/lib/active_storage/blob_key.rb +20 -0
- data/lib/active_storage/service/cloudinary_service.rb +181 -0
- data/lib/cloudinary.rb +9 -4
- data/lib/cloudinary/api.rb +17 -4
- data/lib/cloudinary/auth_token.rb +6 -4
- data/lib/cloudinary/uploader.rb +4 -4
- data/lib/cloudinary/utils.rb +62 -29
- data/lib/cloudinary/version.rb +1 -1
- data/spec/active_storage/Gemfile +12 -0
- data/spec/active_storage/application_system_test_case.rb +5 -0
- data/spec/active_storage/database/create_users_migration.rb +9 -0
- data/spec/active_storage/database/setup.rb +7 -0
- data/spec/active_storage/dummy/Rakefile +5 -0
- data/spec/active_storage/dummy/app/assets/config/manifest.js +3 -0
- data/spec/active_storage/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/active_storage/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/active_storage/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/active_storage/dummy/app/helpers/application_helper.rb +4 -0
- data/spec/active_storage/dummy/app/jobs/application_job.rb +4 -0
- data/spec/active_storage/dummy/app/models/application_record.rb +5 -0
- data/spec/active_storage/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/active_storage/dummy/bin/bundle +5 -0
- data/spec/active_storage/dummy/bin/rails +6 -0
- data/spec/active_storage/dummy/bin/rake +6 -0
- data/spec/active_storage/dummy/bin/yarn +11 -0
- data/spec/active_storage/dummy/config.ru +7 -0
- data/spec/active_storage/dummy/config/application.rb +22 -0
- data/spec/active_storage/dummy/config/boot.rb +7 -0
- data/spec/active_storage/dummy/config/database.yml +25 -0
- data/spec/active_storage/dummy/config/environment.rb +7 -0
- data/spec/active_storage/dummy/config/environments/development.rb +52 -0
- data/spec/active_storage/dummy/config/environments/production.rb +83 -0
- data/spec/active_storage/dummy/config/environments/test.rb +38 -0
- data/spec/active_storage/dummy/config/initializers/application_controller_renderer.rb +7 -0
- data/spec/active_storage/dummy/config/initializers/assets.rb +16 -0
- data/spec/active_storage/dummy/config/initializers/backtrace_silencers.rb +8 -0
- data/spec/active_storage/dummy/config/initializers/cookies_serializer.rb +7 -0
- data/spec/active_storage/dummy/config/initializers/filter_parameter_logging.rb +6 -0
- data/spec/active_storage/dummy/config/initializers/inflections.rb +17 -0
- data/spec/active_storage/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/active_storage/dummy/config/initializers/wrap_parameters.rb +16 -0
- data/spec/active_storage/dummy/config/routes.rb +4 -0
- data/spec/active_storage/dummy/config/secrets.yml +32 -0
- data/spec/active_storage/dummy/config/spring.rb +8 -0
- data/spec/active_storage/dummy/config/storage.yml +3 -0
- data/spec/active_storage/dummy/config/webpacker.yml +72 -0
- data/spec/active_storage/dummy/package.json +5 -0
- data/spec/active_storage/dummy/public/404.html +67 -0
- data/spec/active_storage/dummy/public/422.html +67 -0
- data/spec/active_storage/dummy/public/500.html +66 -0
- data/spec/active_storage/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/active_storage/dummy/public/apple-touch-icon.png +0 -0
- data/spec/active_storage/dummy/public/favicon.ico +0 -0
- data/spec/active_storage/fixtures/files/colors.bmp +0 -0
- data/spec/active_storage/fixtures/files/empty_file.txt +0 -0
- data/spec/active_storage/fixtures/files/favicon.ico +0 -0
- data/spec/active_storage/fixtures/files/icon.psd +0 -0
- data/spec/active_storage/fixtures/files/icon.svg +13 -0
- data/spec/active_storage/fixtures/files/image.gif +0 -0
- data/spec/active_storage/fixtures/files/racecar.jpg +0 -0
- data/spec/active_storage/fixtures/files/racecar.tif +0 -0
- data/spec/active_storage/fixtures/files/racecar_rotated.jpg +0 -0
- data/spec/active_storage/fixtures/files/report.pdf +0 -0
- data/spec/active_storage/fixtures/files/rotated_video.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_with_rectangular_samples.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 +0 -0
- data/spec/active_storage/fixtures/files/video_without_video_stream.mp4 +0 -0
- data/spec/active_storage/service/cloudinary_service_spec.rb +92 -0
- data/spec/active_storage/service/configurations.yml +4 -0
- data/spec/active_storage/test_helper.rb +43 -0
- data/spec/api_spec.rb +68 -12
- data/spec/archive_spec.rb +17 -1
- data/spec/cloudinary_helper_spec.rb +2 -0
- data/spec/cloudinary_spec.rb +30 -6
- data/spec/movie.mp4 +0 -0
- data/spec/spec_helper.rb +9 -2
- data/spec/uploader_spec.rb +20 -3
- data/spec/utils_methods_spec.rb +29 -2
- data/spec/utils_spec.rb +93 -11
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +31 -1
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +24 -4
- data/vendor/assets/javascripts/cloudinary/jquery.ui.widget.js +741 -561
- data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
- metadata +161 -3
data/lib/cloudinary/utils.rb
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
# Copyright Cloudinary
|
|
2
|
+
|
|
3
|
+
# frozen_string_literal: true
|
|
2
4
|
require 'digest/sha1'
|
|
3
5
|
require 'zlib'
|
|
4
6
|
require 'uri'
|
|
@@ -24,7 +26,8 @@ class Cloudinary::Utils
|
|
|
24
26
|
"*" => 'mul',
|
|
25
27
|
"/" => 'div',
|
|
26
28
|
"+" => 'add',
|
|
27
|
-
"-" => 'sub'
|
|
29
|
+
"-" => 'sub',
|
|
30
|
+
"^" => 'pow'
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
PREDEFINED_VARS = {
|
|
@@ -42,6 +45,27 @@ class Cloudinary::Utils
|
|
|
42
45
|
"width" => "w"
|
|
43
46
|
}
|
|
44
47
|
|
|
48
|
+
SIMPLE_TRANSFORMATION_PARAMS = {
|
|
49
|
+
:ac => :audio_codec,
|
|
50
|
+
:af => :audio_frequency,
|
|
51
|
+
:br => :bit_rate,
|
|
52
|
+
:cs => :color_space,
|
|
53
|
+
:d => :default_image,
|
|
54
|
+
:dl => :delay,
|
|
55
|
+
:dn => :density,
|
|
56
|
+
:du => :duration,
|
|
57
|
+
:eo => :end_offset,
|
|
58
|
+
:f => :fetch_format,
|
|
59
|
+
:g => :gravity,
|
|
60
|
+
:ki => :keyframe_interval,
|
|
61
|
+
:p => :prefix,
|
|
62
|
+
:pg => :page,
|
|
63
|
+
:so => :start_offset,
|
|
64
|
+
:sp => :streaming_profile,
|
|
65
|
+
:vc => :video_codec,
|
|
66
|
+
:vs => :video_sampling
|
|
67
|
+
}.freeze
|
|
68
|
+
|
|
45
69
|
URL_KEYS = %w[
|
|
46
70
|
api_secret
|
|
47
71
|
auth_token
|
|
@@ -113,6 +137,8 @@ class Cloudinary::Utils
|
|
|
113
137
|
zoom
|
|
114
138
|
].map(&:to_sym)
|
|
115
139
|
|
|
140
|
+
REMOTE_URL_REGEX = %r(^ftp:|^https?:|^s3:|^gs:|^data:([\w-]+\/[\w-]+)?(;[\w-]+=[\w-]+)*;base64,([a-zA-Z0-9\/+\n=]+)$)
|
|
141
|
+
|
|
116
142
|
def self.extract_config_params(options)
|
|
117
143
|
options.select{|k,v| URL_KEYS.include?(k)}
|
|
118
144
|
end
|
|
@@ -216,7 +242,7 @@ class Cloudinary::Utils
|
|
|
216
242
|
:l => overlay,
|
|
217
243
|
:o => normalize_expression(options.delete(:opacity)),
|
|
218
244
|
:q => normalize_expression(options.delete(:quality)),
|
|
219
|
-
:r =>
|
|
245
|
+
:r => process_radius(options.delete(:radius)),
|
|
220
246
|
:t => named_transformation,
|
|
221
247
|
:u => underlay,
|
|
222
248
|
:w => normalize_expression(width),
|
|
@@ -224,26 +250,7 @@ class Cloudinary::Utils
|
|
|
224
250
|
:y => normalize_expression(options.delete(:y)),
|
|
225
251
|
:z => normalize_expression(options.delete(:zoom))
|
|
226
252
|
}
|
|
227
|
-
|
|
228
|
-
:ac => :audio_codec,
|
|
229
|
-
:af => :audio_frequency,
|
|
230
|
-
:br => :bit_rate,
|
|
231
|
-
:cs => :color_space,
|
|
232
|
-
:d => :default_image,
|
|
233
|
-
:dl => :delay,
|
|
234
|
-
:dn => :density,
|
|
235
|
-
:du => :duration,
|
|
236
|
-
:eo => :end_offset,
|
|
237
|
-
:f => :fetch_format,
|
|
238
|
-
:g => :gravity,
|
|
239
|
-
:ki => :keyframe_interval,
|
|
240
|
-
:p => :prefix,
|
|
241
|
-
:pg => :page,
|
|
242
|
-
:so => :start_offset,
|
|
243
|
-
:sp => :streaming_profile,
|
|
244
|
-
:vc => :video_codec,
|
|
245
|
-
:vs => :video_sampling
|
|
246
|
-
}.each do
|
|
253
|
+
SIMPLE_TRANSFORMATION_PARAMS.each do
|
|
247
254
|
|param, option|
|
|
248
255
|
params[param] = options.delete(option)
|
|
249
256
|
end
|
|
@@ -305,7 +312,9 @@ class Cloudinary::Utils
|
|
|
305
312
|
EXP_REPLACEMENT = PREDEFINED_VARS.merge(CONDITIONAL_OPERATORS)
|
|
306
313
|
|
|
307
314
|
def self.normalize_expression(expression)
|
|
308
|
-
if expression
|
|
315
|
+
if expression.nil?
|
|
316
|
+
''
|
|
317
|
+
elsif expression.is_a?( String) && expression =~ /^!.+!$/ # quoted string
|
|
309
318
|
expression
|
|
310
319
|
else
|
|
311
320
|
expression.to_s.gsub(EXP_REGEXP,EXP_REPLACEMENT).gsub(/[ _]+/, "_")
|
|
@@ -375,6 +384,17 @@ class Cloudinary::Utils
|
|
|
375
384
|
end
|
|
376
385
|
private_class_method :process_layer
|
|
377
386
|
|
|
387
|
+
# Parse radius options
|
|
388
|
+
# @return [string] radius transformation string
|
|
389
|
+
# @private
|
|
390
|
+
def self.process_radius(radius)
|
|
391
|
+
if radius.is_a?(Array) && !radius.length.between?(1, 4)
|
|
392
|
+
raise(CloudinaryException, "Invalid radius parameter")
|
|
393
|
+
end
|
|
394
|
+
Array(radius).map { |r| normalize_expression(r) }.join(":")
|
|
395
|
+
end
|
|
396
|
+
private_class_method :process_radius
|
|
397
|
+
|
|
378
398
|
LAYER_KEYWORD_PARAMS =[
|
|
379
399
|
[:font_weight ,"normal"],
|
|
380
400
|
[:font_style ,"normal"],
|
|
@@ -395,6 +415,10 @@ class Cloudinary::Utils
|
|
|
395
415
|
keywords.push("letter_spacing_#{letter_spacing}") unless letter_spacing.blank?
|
|
396
416
|
line_spacing = layer[:line_spacing]
|
|
397
417
|
keywords.push("line_spacing_#{line_spacing}") unless line_spacing.blank?
|
|
418
|
+
font_antialiasing = layer[:font_antialiasing]
|
|
419
|
+
keywords.push("antialias_#{font_antialiasing}") unless font_antialiasing.blank?
|
|
420
|
+
font_hinting = layer[:font_hinting]
|
|
421
|
+
keywords.push("hinting_#{font_hinting}") unless font_hinting.blank?
|
|
398
422
|
if !font_size.blank? || !font_family.blank? || !keywords.empty?
|
|
399
423
|
raise(CloudinaryException, "Must supply font_family for text in overlay/underlay") if font_family.blank?
|
|
400
424
|
raise(CloudinaryException, "Must supply font_size for text in overlay/underlay") if font_size.blank?
|
|
@@ -455,6 +479,7 @@ class Cloudinary::Utils
|
|
|
455
479
|
|
|
456
480
|
resource_type = options.delete(:resource_type)
|
|
457
481
|
version = options.delete(:version)
|
|
482
|
+
force_version = config_option_consume(options, :force_version, true)
|
|
458
483
|
format = options.delete(:format)
|
|
459
484
|
cloud_name = config_option_consume(options, :cloud_name) || raise(CloudinaryException, "Must supply cloud_name in tag or in configuration")
|
|
460
485
|
|
|
@@ -505,7 +530,12 @@ class Cloudinary::Utils
|
|
|
505
530
|
resource_type, type = finalize_resource_type(resource_type, type, url_suffix, use_root_path, shorten)
|
|
506
531
|
source, source_to_sign = finalize_source(source, format, url_suffix)
|
|
507
532
|
|
|
508
|
-
|
|
533
|
+
if version.nil? && force_version &&
|
|
534
|
+
source_to_sign.include?("/") &&
|
|
535
|
+
!source_to_sign.match(/^v[0-9]+/) &&
|
|
536
|
+
!source_to_sign.match(/^https?:\//)
|
|
537
|
+
version = 1
|
|
538
|
+
end
|
|
509
539
|
version &&= "v#{version}"
|
|
510
540
|
|
|
511
541
|
transformation = transformation.gsub(%r(([^:])//), '\1/')
|
|
@@ -811,7 +841,7 @@ class Cloudinary::Utils
|
|
|
811
841
|
end
|
|
812
842
|
end
|
|
813
843
|
|
|
814
|
-
IMAGE_FORMATS = %w(ai bmp bpg djvu eps eps3 flif gif hdp hpx ico j2k jp2 jpc jpe jpg miff pdf png psd svg tif tiff wdp webp zip )
|
|
844
|
+
IMAGE_FORMATS = %w(ai bmp bpg djvu eps eps3 flif gif hdp hpx ico j2k jp2 jpc jpe jpeg jpg miff pdf png psd svg tif tiff wdp webp zip )
|
|
815
845
|
|
|
816
846
|
AUDIO_FORMATS = %w(aac aifc aiff flac m4a mp3 ogg wav)
|
|
817
847
|
|
|
@@ -831,10 +861,8 @@ class Cloudinary::Utils
|
|
|
831
861
|
case
|
|
832
862
|
when self.supported_format?(format, IMAGE_FORMATS)
|
|
833
863
|
'image'
|
|
834
|
-
when self.supported_format?(format, VIDEO_FORMATS)
|
|
864
|
+
when self.supported_format?(format, VIDEO_FORMATS), self.supported_format?(format, AUDIO_FORMATS)
|
|
835
865
|
'video'
|
|
836
|
-
when self.supported_format?(format, AUDIO_FORMATS)
|
|
837
|
-
'audio'
|
|
838
866
|
else
|
|
839
867
|
'raw'
|
|
840
868
|
end
|
|
@@ -842,7 +870,8 @@ class Cloudinary::Utils
|
|
|
842
870
|
|
|
843
871
|
def self.config_option_consume(options, option_name, default_value = nil)
|
|
844
872
|
return options.delete(option_name) if options.include?(option_name)
|
|
845
|
-
|
|
873
|
+
option_value = Cloudinary.config.send(option_name)
|
|
874
|
+
option_value.nil? ? default_value : option_value
|
|
846
875
|
end
|
|
847
876
|
|
|
848
877
|
def self.as_bool(value)
|
|
@@ -928,6 +957,7 @@ class Cloudinary::Utils
|
|
|
928
957
|
:keep_derived=>Cloudinary::Utils.as_safe_bool(options[:keep_derived]),
|
|
929
958
|
:tags=>options[:tags] && Cloudinary::Utils.build_array(options[:tags]),
|
|
930
959
|
:public_ids=>options[:public_ids] && Cloudinary::Utils.build_array(options[:public_ids]),
|
|
960
|
+
:fully_qualified_public_ids=>options[:fully_qualified_public_ids] && Cloudinary::Utils.build_array(options[:fully_qualified_public_ids]),
|
|
931
961
|
:prefixes=>options[:prefixes] && Cloudinary::Utils.build_array(options[:prefixes]),
|
|
932
962
|
:expires_at=>options[:expires_at],
|
|
933
963
|
:transformations => build_eager(options[:transformations]),
|
|
@@ -1096,4 +1126,7 @@ class Cloudinary::Utils
|
|
|
1096
1126
|
end
|
|
1097
1127
|
end
|
|
1098
1128
|
|
|
1129
|
+
def self.is_remote?(url)
|
|
1130
|
+
REMOTE_URL_REGEX === url
|
|
1131
|
+
end
|
|
1099
1132
|
end
|
data/lib/cloudinary/version.rb
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
source "https://rubygems.org"
|
|
4
|
+
|
|
5
|
+
gem 'rails', '~> 5.2'
|
|
6
|
+
gem 'actionpack', '~> 5.2'
|
|
7
|
+
gem 'activejob', '~> 5.2'
|
|
8
|
+
gem 'activerecord', '~> 5.2'
|
|
9
|
+
gem 'sqlite3'
|
|
10
|
+
gem 'marcel', '~> 0.3.1'
|
|
11
|
+
gem 'cloudinary', path: '../../../'
|
|
12
|
+
gem 'rspec'
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file. JavaScript code in this file should be added after the last require_* statement.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
|
11
|
+
* It is generally better to create a new file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
VENDOR_PATH = File.expand_path("..", __dir__)
|
|
5
|
+
Dir.chdir(VENDOR_PATH) do
|
|
6
|
+
exec "yarnpkg #{ARGV.join(" ")}"
|
|
7
|
+
rescue Errno::ENOENT
|
|
8
|
+
$stderr.puts "Yarn executable was not detected in the system."
|
|
9
|
+
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
|
|
10
|
+
exit 1
|
|
11
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# require_relative "boot"
|
|
4
|
+
|
|
5
|
+
require "rails"
|
|
6
|
+
require "active_model/railtie"
|
|
7
|
+
require "active_job/railtie"
|
|
8
|
+
require "active_record/railtie"
|
|
9
|
+
require "action_controller/railtie"
|
|
10
|
+
require "action_view/railtie"
|
|
11
|
+
# require "sprockets/railtie"
|
|
12
|
+
require "active_storage/engine"
|
|
13
|
+
|
|
14
|
+
Bundler.require(*Rails.groups)
|
|
15
|
+
|
|
16
|
+
module Dummy
|
|
17
|
+
class Application < Rails::Application
|
|
18
|
+
config.load_defaults 5.2
|
|
19
|
+
|
|
20
|
+
config.active_storage.service = :local
|
|
21
|
+
end
|
|
22
|
+
end
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Set up gems listed in the Gemfile.
|
|
4
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__)
|
|
5
|
+
|
|
6
|
+
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
|
|
7
|
+
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# SQLite version 3.x
|
|
2
|
+
# gem install sqlite3
|
|
3
|
+
#
|
|
4
|
+
# Ensure the SQLite 3 gem is defined in your Gemfile
|
|
5
|
+
# gem 'sqlite3'
|
|
6
|
+
#
|
|
7
|
+
default: &default
|
|
8
|
+
adapter: sqlite3
|
|
9
|
+
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
10
|
+
timeout: 5000
|
|
11
|
+
|
|
12
|
+
development:
|
|
13
|
+
<<: *default
|
|
14
|
+
database: db/development.sqlite3
|
|
15
|
+
|
|
16
|
+
# Warning: The database defined as "test" will be erased and
|
|
17
|
+
# re-generated from your development database when you run "rake".
|
|
18
|
+
# Do not set this db to the same as development or production.
|
|
19
|
+
test:
|
|
20
|
+
<<: *default
|
|
21
|
+
database: db/test.sqlite3
|
|
22
|
+
|
|
23
|
+
production:
|
|
24
|
+
<<: *default
|
|
25
|
+
database: db/production.sqlite3
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
Rails.application.configure do
|
|
4
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
|
+
|
|
6
|
+
# In the development environment your application's code is reloaded on
|
|
7
|
+
# every request. This slows down response time but is perfect for development
|
|
8
|
+
# since you don't have to restart the web server when you make code changes.
|
|
9
|
+
config.cache_classes = false
|
|
10
|
+
|
|
11
|
+
# Do not eager load code on boot.
|
|
12
|
+
config.eager_load = false
|
|
13
|
+
|
|
14
|
+
# Show full error reports.
|
|
15
|
+
config.consider_all_requests_local = true
|
|
16
|
+
|
|
17
|
+
# Enable/disable caching. By default caching is disabled.
|
|
18
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
19
|
+
config.action_controller.perform_caching = true
|
|
20
|
+
config.action_controller.enable_fragment_cache_logging = true
|
|
21
|
+
|
|
22
|
+
config.cache_store = :memory_store
|
|
23
|
+
config.public_file_server.headers = {
|
|
24
|
+
"Cache-Control" => "public, max-age=#{2.days.seconds.to_i}"
|
|
25
|
+
}
|
|
26
|
+
else
|
|
27
|
+
config.action_controller.perform_caching = false
|
|
28
|
+
|
|
29
|
+
config.cache_store = :null_store
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# Print deprecation notices to the Rails logger.
|
|
33
|
+
config.active_support.deprecation = :log
|
|
34
|
+
|
|
35
|
+
# Raise an error on page load if there are pending migrations.
|
|
36
|
+
config.active_record.migration_error = :page_load
|
|
37
|
+
|
|
38
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
|
39
|
+
# This option may cause significant delays in view rendering with a large
|
|
40
|
+
# number of complex assets.
|
|
41
|
+
config.assets.debug = true
|
|
42
|
+
|
|
43
|
+
# Suppress logger output for asset requests.
|
|
44
|
+
config.assets.quiet = true
|
|
45
|
+
|
|
46
|
+
# Raises error for missing translations
|
|
47
|
+
# config.action_view.raise_on_missing_translations = true
|
|
48
|
+
|
|
49
|
+
# Use an evented file watcher to asynchronously detect changes in source code,
|
|
50
|
+
# routes, locales, etc. This feature depends on the listen gem.
|
|
51
|
+
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
|
52
|
+
end
|