cloudinary 1.11.1 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -1
  3. data/.travis.yml +12 -6
  4. data/CHANGELOG.md +30 -0
  5. data/cloudinary.gemspec +2 -0
  6. data/lib/active_storage/blob_key.rb +20 -0
  7. data/lib/active_storage/service/cloudinary_service.rb +181 -0
  8. data/lib/cloudinary.rb +9 -4
  9. data/lib/cloudinary/api.rb +17 -4
  10. data/lib/cloudinary/auth_token.rb +6 -4
  11. data/lib/cloudinary/uploader.rb +4 -4
  12. data/lib/cloudinary/utils.rb +62 -29
  13. data/lib/cloudinary/version.rb +1 -1
  14. data/spec/active_storage/Gemfile +12 -0
  15. data/spec/active_storage/application_system_test_case.rb +5 -0
  16. data/spec/active_storage/database/create_users_migration.rb +9 -0
  17. data/spec/active_storage/database/setup.rb +7 -0
  18. data/spec/active_storage/dummy/Rakefile +5 -0
  19. data/spec/active_storage/dummy/app/assets/config/manifest.js +3 -0
  20. data/spec/active_storage/dummy/app/assets/javascripts/application.js +13 -0
  21. data/spec/active_storage/dummy/app/assets/stylesheets/application.css +15 -0
  22. data/spec/active_storage/dummy/app/controllers/application_controller.rb +5 -0
  23. data/spec/active_storage/dummy/app/helpers/application_helper.rb +4 -0
  24. data/spec/active_storage/dummy/app/jobs/application_job.rb +4 -0
  25. data/spec/active_storage/dummy/app/models/application_record.rb +5 -0
  26. data/spec/active_storage/dummy/app/views/layouts/application.html.erb +14 -0
  27. data/spec/active_storage/dummy/bin/bundle +5 -0
  28. data/spec/active_storage/dummy/bin/rails +6 -0
  29. data/spec/active_storage/dummy/bin/rake +6 -0
  30. data/spec/active_storage/dummy/bin/yarn +11 -0
  31. data/spec/active_storage/dummy/config.ru +7 -0
  32. data/spec/active_storage/dummy/config/application.rb +22 -0
  33. data/spec/active_storage/dummy/config/boot.rb +7 -0
  34. data/spec/active_storage/dummy/config/database.yml +25 -0
  35. data/spec/active_storage/dummy/config/environment.rb +7 -0
  36. data/spec/active_storage/dummy/config/environments/development.rb +52 -0
  37. data/spec/active_storage/dummy/config/environments/production.rb +83 -0
  38. data/spec/active_storage/dummy/config/environments/test.rb +38 -0
  39. data/spec/active_storage/dummy/config/initializers/application_controller_renderer.rb +7 -0
  40. data/spec/active_storage/dummy/config/initializers/assets.rb +16 -0
  41. data/spec/active_storage/dummy/config/initializers/backtrace_silencers.rb +8 -0
  42. data/spec/active_storage/dummy/config/initializers/cookies_serializer.rb +7 -0
  43. data/spec/active_storage/dummy/config/initializers/filter_parameter_logging.rb +6 -0
  44. data/spec/active_storage/dummy/config/initializers/inflections.rb +17 -0
  45. data/spec/active_storage/dummy/config/initializers/mime_types.rb +5 -0
  46. data/spec/active_storage/dummy/config/initializers/wrap_parameters.rb +16 -0
  47. data/spec/active_storage/dummy/config/routes.rb +4 -0
  48. data/spec/active_storage/dummy/config/secrets.yml +32 -0
  49. data/spec/active_storage/dummy/config/spring.rb +8 -0
  50. data/spec/active_storage/dummy/config/storage.yml +3 -0
  51. data/spec/active_storage/dummy/config/webpacker.yml +72 -0
  52. data/spec/active_storage/dummy/package.json +5 -0
  53. data/spec/active_storage/dummy/public/404.html +67 -0
  54. data/spec/active_storage/dummy/public/422.html +67 -0
  55. data/spec/active_storage/dummy/public/500.html +66 -0
  56. data/spec/active_storage/dummy/public/apple-touch-icon-precomposed.png +0 -0
  57. data/spec/active_storage/dummy/public/apple-touch-icon.png +0 -0
  58. data/spec/active_storage/dummy/public/favicon.ico +0 -0
  59. data/spec/active_storage/fixtures/files/colors.bmp +0 -0
  60. data/spec/active_storage/fixtures/files/empty_file.txt +0 -0
  61. data/spec/active_storage/fixtures/files/favicon.ico +0 -0
  62. data/spec/active_storage/fixtures/files/icon.psd +0 -0
  63. data/spec/active_storage/fixtures/files/icon.svg +13 -0
  64. data/spec/active_storage/fixtures/files/image.gif +0 -0
  65. data/spec/active_storage/fixtures/files/racecar.jpg +0 -0
  66. data/spec/active_storage/fixtures/files/racecar.tif +0 -0
  67. data/spec/active_storage/fixtures/files/racecar_rotated.jpg +0 -0
  68. data/spec/active_storage/fixtures/files/report.pdf +0 -0
  69. data/spec/active_storage/fixtures/files/rotated_video.mp4 +0 -0
  70. data/spec/active_storage/fixtures/files/video.mp4 +0 -0
  71. data/spec/active_storage/fixtures/files/video_with_rectangular_samples.mp4 +0 -0
  72. data/spec/active_storage/fixtures/files/video_with_undefined_display_aspect_ratio.mp4 +0 -0
  73. data/spec/active_storage/fixtures/files/video_without_video_stream.mp4 +0 -0
  74. data/spec/active_storage/service/cloudinary_service_spec.rb +92 -0
  75. data/spec/active_storage/service/configurations.yml +4 -0
  76. data/spec/active_storage/test_helper.rb +43 -0
  77. data/spec/api_spec.rb +68 -12
  78. data/spec/archive_spec.rb +17 -1
  79. data/spec/cloudinary_helper_spec.rb +2 -0
  80. data/spec/cloudinary_spec.rb +30 -6
  81. data/spec/movie.mp4 +0 -0
  82. data/spec/spec_helper.rb +9 -2
  83. data/spec/uploader_spec.rb +20 -3
  84. data/spec/utils_methods_spec.rb +29 -2
  85. data/spec/utils_spec.rb +93 -11
  86. data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +31 -1
  87. data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +24 -4
  88. data/vendor/assets/javascripts/cloudinary/jquery.ui.widget.js +741 -561
  89. data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
  90. metadata +161 -3
@@ -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 => normalize_expression(options.delete(:radius)),
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 =~ /^!.+!$/ # quoted string
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
- version ||= 1 if source_to_sign.include?("/") and !source_to_sign.match(/^v[0-9]+/) and !source_to_sign.match(/^https?:\//)
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
- return Cloudinary.config.send(option_name) || default_value
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
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.11.1"
3
+ VERSION = "1.12.0"
4
4
  end
@@ -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,5 @@
1
+ require "test_helper"
2
+
3
+ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ActiveStorageCreateUsers < ActiveRecord::Migration[5.2]
4
+ def change
5
+ create_table :users do |t|
6
+ t.string :name
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "create_users_migration"
4
+
5
+ ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: ":memory:")
6
+ ActiveRecord::Base.connection.migration_context.migrate
7
+ ActiveStorageCreateUsers.migrate(:up)
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "config/application"
4
+
5
+ Rails.application.load_tasks
@@ -0,0 +1,3 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../stylesheets .css
@@ -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,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationController < ActionController::Base
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApplicationHelper
4
+ end
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationJob < ActiveJob::Base
4
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ class ApplicationRecord < ActiveRecord::Base
4
+ self.abstract_class = true
5
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+
7
+ <%= stylesheet_link_tag 'application', media: 'all' %>
8
+ <%= javascript_include_tag 'application' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
5
+ load Gem.bin_path("bundler", "bundle")
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ APP_PATH = File.expand_path("../config/application", __dir__)
5
+ require_relative "../config/boot"
6
+ require "rails/commands"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require_relative "../config/boot"
5
+ require "rake"
6
+ Rake.application.run
@@ -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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # This file is used by Rack-based servers to start the application.
4
+
5
+ require_relative "config/environment"
6
+
7
+ run Rails.application
@@ -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,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Load the Rails application.
4
+ require_relative "application"
5
+
6
+ # Initialize the Rails application.
7
+ Rails.application.initialize!
@@ -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