s3_cors_fileupload 0.2.1 → 0.3.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/.travis.yml +4 -0
- data/CHANGELOG.md +10 -3
- data/Gemfile +11 -9
- data/Gemfile.lock +86 -65
- data/README.md +8 -4
- data/lib/generators/s3_cors_fileupload/install/install_generator.rb +5 -2
- data/lib/generators/s3_cors_fileupload/install/templates/s3_uploads_controller.rb +3 -1
- data/lib/generators/s3_cors_fileupload/install/templates/source_file.rb +4 -3
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_download.html.erb +18 -7
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_upload.html.erb +4 -4
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/_template_uploaded.html.erb +17 -6
- data/lib/generators/s3_cors_fileupload/install/templates/views/erb/index.html.erb +1 -1
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_download.html.haml +14 -4
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_upload.html.haml +5 -5
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/_template_uploaded.html.haml +12 -1
- data/lib/generators/s3_cors_fileupload/install/templates/views/haml/index.html.haml +1 -1
- data/lib/s3_cors_fileupload.rb +6 -0
- data/lib/s3_cors_fileupload/rails.rb +1 -1
- data/lib/s3_cors_fileupload/rails/form_helper.rb +15 -12
- data/lib/s3_cors_fileupload/version.rb +3 -3
- data/s3_cors_fileupload.gemspec +3 -4
- data/spec/dummy/Rakefile +0 -1
- data/spec/dummy/app/assets/javascripts/application.js +4 -3
- data/spec/dummy/app/assets/javascripts/s3_uploads.js +92 -0
- data/spec/dummy/app/assets/stylesheets/application.css +1 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -1
- data/spec/dummy/app/controllers/s3_uploads_controller.rb +56 -0
- data/spec/dummy/app/models/source_file.rb +54 -0
- data/spec/dummy/app/views/layouts/application.html.erb +2 -2
- data/spec/dummy/app/views/s3_uploads/_template_download.html.erb +43 -0
- data/spec/dummy/app/views/s3_uploads/_template_upload.html.erb +36 -0
- data/spec/dummy/app/views/s3_uploads/_template_uploaded.html.erb +41 -0
- data/spec/dummy/app/views/s3_uploads/index.html.erb +41 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/config/application.rb +2 -33
- data/spec/dummy/config/boot.rb +4 -9
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +14 -19
- data/spec/dummy/config/environments/production.rb +40 -27
- data/spec/dummy/config/environments/test.rb +14 -12
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +6 -5
- data/spec/dummy/config/initializers/secret_token.rb +7 -2
- data/spec/dummy/config/initializers/session_store.rb +0 -5
- data/spec/dummy/config/initializers/wrap_parameters.rb +6 -6
- data/spec/dummy/config/locales/en.yml +20 -2
- data/spec/dummy/config/routes.rb +27 -24
- data/spec/dummy/db/migrate/20131001201535_create_source_files.rb +14 -0
- data/spec/dummy/db/schema.rb +27 -0
- data/spec/dummy/public/404.html +43 -11
- data/spec/dummy/public/422.html +43 -11
- data/spec/dummy/public/500.html +43 -11
- data/spec/features/uploads_spec.rb +37 -0
- data/spec/lib/s3_cors_fileupload/rails/engine_spec.rb +8 -0
- data/spec/lib/s3_cors_fileupload/rails/form_helper_spec.rb +30 -0
- data/spec/lib/s3_cors_fileupload/rails/policy_helper_spec.rb +95 -0
- data/spec/s3_cors_fileupload_spec.rb +8 -4
- data/spec/spec_helper.rb +8 -8
- data/spec/support/dummy.pdf +0 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/index.js +1 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-image.js +111 -32
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-ui.js +24 -18
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload-validate.js +7 -6
- data/vendor/assets/javascripts/s3_cors_fileupload/jquery.fileupload.js +22 -15
- data/vendor/assets/javascripts/s3_cors_fileupload/vendor/load-image-meta.js +137 -0
- data/vendor/assets/javascripts/s3_cors_fileupload/vendor/tmpl.js +8 -8
- data/vendor/assets/stylesheets/jquery.fileupload-ui.css.erb +2 -1
- metadata +56 -28
- data/spec/dummy/script/rails +0 -6
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<title>Dummy</title>
|
|
5
|
-
<%= stylesheet_link_tag "application", :
|
|
6
|
-
<%= javascript_include_tag "application" %>
|
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
|
7
7
|
<%= csrf_meta_tags %>
|
|
8
8
|
</head>
|
|
9
9
|
<body>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<!-- The template to display files available for download -->
|
|
2
|
+
<script id="template-download" type="text/x-tmpl">
|
|
3
|
+
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
|
4
|
+
<tr class="template-download fade">
|
|
5
|
+
<td>
|
|
6
|
+
<span class="preview">
|
|
7
|
+
{% if (file.thumbnailUrl) { %}
|
|
8
|
+
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" data-gallery><img src="{%=file.thumbnailUrl%}"></a>
|
|
9
|
+
{% } %}
|
|
10
|
+
</span>
|
|
11
|
+
</td>
|
|
12
|
+
<td>
|
|
13
|
+
<p class="name">
|
|
14
|
+
{% if (file.url) { %}
|
|
15
|
+
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl ? 'data-gallery' : ''%}>{%=file.name%}</a>
|
|
16
|
+
{% } else { %}
|
|
17
|
+
<span>{%=file.name%}</span>
|
|
18
|
+
{% } %}
|
|
19
|
+
</p>
|
|
20
|
+
{% if (file.error) { %}
|
|
21
|
+
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
|
|
22
|
+
{% } %}
|
|
23
|
+
</td>
|
|
24
|
+
<td>
|
|
25
|
+
<span class="size">{%=o.formatFileSize(file.size)%}</span>
|
|
26
|
+
</td>
|
|
27
|
+
<td>
|
|
28
|
+
{% if (file.deleteUrl) { %}
|
|
29
|
+
<button class="btn btn-danger delete" data-type="{%=file.deleteType%}" data-url="{%=file.deleteUrl%}" data-confirmation="Are you sure?" {% if (file.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
|
|
30
|
+
<i class="glyphicon glyphicon-trash"></i>
|
|
31
|
+
<span>Delete</span>
|
|
32
|
+
</button>
|
|
33
|
+
<input type="checkbox" name="delete" value="1" class="toggle">
|
|
34
|
+
{% } else { %}
|
|
35
|
+
<button class="btn btn-warning cancel">
|
|
36
|
+
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
37
|
+
<span>Cancel</span>
|
|
38
|
+
</button>
|
|
39
|
+
{% } %}
|
|
40
|
+
</td>
|
|
41
|
+
</tr>
|
|
42
|
+
{% } %}
|
|
43
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<!-- The template to display files available for upload -->
|
|
2
|
+
<script id="template-upload" type="text/x-tmpl">
|
|
3
|
+
{% for (var i=0, file; file=o.files[i]; i++) { %}
|
|
4
|
+
<tr class="template-upload fade">
|
|
5
|
+
<td>
|
|
6
|
+
<span class="preview"></span>
|
|
7
|
+
</td>
|
|
8
|
+
<td>
|
|
9
|
+
<p class="name">{%=file.name%}</p>
|
|
10
|
+
{% if (file.error) { %}
|
|
11
|
+
<div><span class="label label-danger">Error</span> {%=file.error%}</div>
|
|
12
|
+
{% } %}
|
|
13
|
+
</td>
|
|
14
|
+
<td>
|
|
15
|
+
<p class="size">{%=o.formatFileSize(file.size)%}</p>
|
|
16
|
+
{% if (!o.files.error) { %}
|
|
17
|
+
<div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
|
|
18
|
+
{% } %}
|
|
19
|
+
</td>
|
|
20
|
+
<td>
|
|
21
|
+
{% if (!o.files.error && !i && !o.options.autoUpload) { %}
|
|
22
|
+
<button class="btn btn-primary start">
|
|
23
|
+
<i class="glyphicon glyphicon-upload"></i>
|
|
24
|
+
<span>Start</span>
|
|
25
|
+
</button>
|
|
26
|
+
{% } %}
|
|
27
|
+
{% if (!i) { %}
|
|
28
|
+
<button class="btn btn-warning cancel">
|
|
29
|
+
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
30
|
+
<span>Cancel</span>
|
|
31
|
+
</button>
|
|
32
|
+
{% } %}
|
|
33
|
+
</td>
|
|
34
|
+
</tr>
|
|
35
|
+
{% } %}
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!-- The template to display files that have been uploaded to S3 already -->
|
|
2
|
+
<!-- This essentially is a stand-in for the template_download partial for the s3_cors_fileupload gem's purposes -->
|
|
3
|
+
<script id="template-uploaded" type="text/x-tmpl">
|
|
4
|
+
<tr class="template-uploaded" id="source_file_{%=o.id%}">
|
|
5
|
+
<td>
|
|
6
|
+
<span class="preview">
|
|
7
|
+
{% if (o.image == true) { %}
|
|
8
|
+
<a href="{%=o.url%}" title="{%=o.name%}" download="{%=o.name%}" data-gallery>
|
|
9
|
+
<image src="{%=o.url%}", style='width:80px; height:56px;'></image>
|
|
10
|
+
</a>
|
|
11
|
+
{% } %}
|
|
12
|
+
</span>
|
|
13
|
+
</td>
|
|
14
|
+
<td>
|
|
15
|
+
<p class="name">
|
|
16
|
+
{% if (o.url) { %}
|
|
17
|
+
<a href="{%=o.url%}" title="{%=o.name%}" download="{%=o.name%}" {%=o.image ? 'data-gallery' : ''%}>{%=o.name%}</a>
|
|
18
|
+
{% } else { %}
|
|
19
|
+
<span>{%=o.name%}</span>
|
|
20
|
+
{% } %}
|
|
21
|
+
</p>
|
|
22
|
+
</td>
|
|
23
|
+
<td>
|
|
24
|
+
<span class="size">{%=formatFileSize(o.size)%}</span>
|
|
25
|
+
</td>
|
|
26
|
+
<td>
|
|
27
|
+
{% if (o.delete_url) { %}
|
|
28
|
+
<button class="btn btn-danger delete" data-type="DELETE" data-url="{%=o.delete_url%}" data-object_id="{%=o.id%}" data-confirmation="Are you sure?" {% if (o.delete_with_credentials) { %} data-xhr-fields='{"withCredentials":true}'{% } %}>
|
|
29
|
+
<i class="glyphicon glyphicon-trash"></i>
|
|
30
|
+
<span>Delete</span>
|
|
31
|
+
</button>
|
|
32
|
+
<input type="checkbox" name="delete" value="1" class="toggle">
|
|
33
|
+
{% } else { %}
|
|
34
|
+
<button class="btn btn-warning cancel">
|
|
35
|
+
<i class="glyphicon glyphicon-ban-circle"></i>
|
|
36
|
+
<span>Cancel</span>
|
|
37
|
+
</button>
|
|
38
|
+
{% } %}
|
|
39
|
+
</td>
|
|
40
|
+
</tr>
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<%= stylesheet_link_tag '//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css' %>
|
|
2
|
+
|
|
3
|
+
<div style="padding: 10px;">
|
|
4
|
+
<h2>Upload file(s)</h2>
|
|
5
|
+
<%= s3_cors_fileupload_form_tag :id => 'fileupload' %>
|
|
6
|
+
|
|
7
|
+
<div class="javascript-templates">
|
|
8
|
+
<%= render 'template_upload' %>
|
|
9
|
+
<%= render 'template_download' %>
|
|
10
|
+
<%= render 'template_uploaded' %>
|
|
11
|
+
</div>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
//<![CDATA[
|
|
16
|
+
$(function () {
|
|
17
|
+
// Initialize the jQuery File Upload widget:
|
|
18
|
+
$('#fileupload').fileupload({
|
|
19
|
+
dataType: 'xml',
|
|
20
|
+
sequentialUploads: true
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Load existing files:
|
|
24
|
+
$.getJSON('/source_files', function (files) {
|
|
25
|
+
$.each(files, function(index, value) {
|
|
26
|
+
$('#upload_files tbody').append(tmpl('template-uploaded', value));
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
// used by the jQuery File Upload
|
|
32
|
+
var fileUploadErrors = {
|
|
33
|
+
maxFileSize: 'File is too big',
|
|
34
|
+
minFileSize: 'File is too small',
|
|
35
|
+
acceptFileTypes: 'Filetype not allowed',
|
|
36
|
+
maxNumberOfFiles: 'Max number of files exceeded',
|
|
37
|
+
uploadedBytes: 'Uploaded bytes exceed file size',
|
|
38
|
+
emptyResult: 'Empty file upload result'
|
|
39
|
+
};
|
|
40
|
+
//]]>
|
|
41
|
+
</script>
|
data/spec/dummy/bin/rake
ADDED
data/spec/dummy/config.ru
CHANGED
|
@@ -4,10 +4,9 @@ require File.expand_path('../boot', __FILE__)
|
|
|
4
4
|
require "active_record/railtie"
|
|
5
5
|
require "action_controller/railtie"
|
|
6
6
|
# require "action_mailer/railtie" # comment out since we aren't testing the mailers
|
|
7
|
-
require "active_resource/railtie"
|
|
8
7
|
require "sprockets/railtie"
|
|
9
8
|
|
|
10
|
-
Bundler.require(
|
|
9
|
+
Bundler.require(*Rails.groups)
|
|
11
10
|
require 's3_cors_fileupload'
|
|
12
11
|
|
|
13
12
|
module Dummy
|
|
@@ -16,16 +15,6 @@ module Dummy
|
|
|
16
15
|
# Application configuration should go into files in config/initializers
|
|
17
16
|
# -- all .rb files in that directory are automatically loaded.
|
|
18
17
|
|
|
19
|
-
# Custom directories with classes and modules you want to be autoloadable.
|
|
20
|
-
# config.autoload_paths += %W(#{config.root}/extras)
|
|
21
|
-
|
|
22
|
-
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
23
|
-
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
24
|
-
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
25
|
-
|
|
26
|
-
# Activate observers that should always be running.
|
|
27
|
-
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
28
|
-
|
|
29
18
|
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
30
19
|
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
31
20
|
# config.time_zone = 'Central Time (US & Canada)'
|
|
@@ -34,31 +23,11 @@ module Dummy
|
|
|
34
23
|
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
35
24
|
# config.i18n.default_locale = :de
|
|
36
25
|
|
|
37
|
-
# Configure the default encoding used in templates for Ruby 1.9.
|
|
38
|
-
config.encoding = "utf-8"
|
|
39
|
-
|
|
40
|
-
# Configure sensitive parameters which will be filtered from the log file.
|
|
41
|
-
config.filter_parameters += [:password]
|
|
42
|
-
|
|
43
|
-
# Enable escaping HTML in JSON.
|
|
44
|
-
config.active_support.escape_html_entities_in_json = true
|
|
45
|
-
|
|
46
|
-
# Use SQL instead of Active Record's schema dumper when creating the database.
|
|
47
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
|
48
|
-
# like if you have constraints or database-specific column types
|
|
49
|
-
# config.active_record.schema_format = :sql
|
|
50
|
-
|
|
51
26
|
# Enforce whitelist mode for mass assignment.
|
|
52
27
|
# This will create an empty whitelist of attributes available for mass-assignment for all models
|
|
53
28
|
# in your app. As such, your models will need to explicitly whitelist or blacklist accessible
|
|
54
29
|
# parameters by using an attr_accessible or attr_protected declaration.
|
|
55
|
-
config.active_record.whitelist_attributes =
|
|
56
|
-
|
|
57
|
-
# Enable the asset pipeline
|
|
58
|
-
config.assets.enabled = false
|
|
59
|
-
|
|
60
|
-
# Version of your assets, change this if you want to expire all your assets
|
|
61
|
-
config.assets.version = '1.0'
|
|
30
|
+
config.active_record.whitelist_attributes = false if ::S3CorsFileupload.active_record_protected_attributes?
|
|
62
31
|
end
|
|
63
32
|
end
|
|
64
33
|
|
data/spec/dummy/config/boot.rb
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
# Set up gems listed in the Gemfile.
|
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
|
|
3
3
|
|
|
4
|
-
if File.
|
|
5
|
-
|
|
6
|
-
require 'bundler'
|
|
7
|
-
Bundler.setup
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
|
4
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
|
|
@@ -1,37 +1,32 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
|
5
5
|
# every request. This slows down response time but is perfect for development
|
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
|
7
7
|
config.cache_classes = false
|
|
8
8
|
|
|
9
|
-
#
|
|
10
|
-
config.
|
|
9
|
+
# Do not eager load code on boot.
|
|
10
|
+
config.eager_load = false
|
|
11
11
|
|
|
12
|
-
# Show full error reports and disable caching
|
|
12
|
+
# Show full error reports and disable caching.
|
|
13
13
|
config.consider_all_requests_local = true
|
|
14
14
|
config.action_controller.perform_caching = false
|
|
15
15
|
|
|
16
|
-
# Don't care if the mailer can't send
|
|
16
|
+
# Don't care if the mailer can't send.
|
|
17
17
|
# config.action_mailer.raise_delivery_errors = false
|
|
18
18
|
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
|
19
|
+
# Print deprecation notices to the Rails logger.
|
|
20
20
|
config.active_support.deprecation = :log
|
|
21
21
|
|
|
22
|
-
#
|
|
23
|
-
config.
|
|
22
|
+
# Raise an error on page load if there are pending migrations
|
|
23
|
+
config.active_record.migration_error = :page_load
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# Log the query plan for queries taking more than this (works
|
|
29
|
-
# with SQLite, MySQL, and PostgreSQL)
|
|
30
|
-
config.active_record.auto_explain_threshold_in_seconds = 0.5
|
|
31
|
-
|
|
32
|
-
# Do not compress assets
|
|
33
|
-
config.assets.compress = false
|
|
34
|
-
|
|
35
|
-
# Expands the lines which load the assets
|
|
25
|
+
# Debug mode disables concatenation and preprocessing of assets.
|
|
26
|
+
# This option may cause significant delays in view rendering with a large
|
|
27
|
+
# number of complex assets.
|
|
36
28
|
config.assets.debug = true
|
|
29
|
+
|
|
30
|
+
# Raise exception on mass assignment protection for Active Record models
|
|
31
|
+
config.active_record.mass_assignment_sanitizer = :strict if ::S3CorsFileupload.active_record_protected_attributes?
|
|
37
32
|
end
|
|
@@ -1,67 +1,80 @@
|
|
|
1
1
|
Dummy::Application.configure do
|
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
|
3
3
|
|
|
4
|
-
# Code is not reloaded between requests
|
|
4
|
+
# Code is not reloaded between requests.
|
|
5
5
|
config.cache_classes = true
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
|
8
|
+
# your application in memory, allowing both thread web servers
|
|
9
|
+
# and those relying on copy on write to perform better.
|
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
|
11
|
+
config.eager_load = true
|
|
12
|
+
|
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
|
8
14
|
config.consider_all_requests_local = false
|
|
9
15
|
config.action_controller.perform_caching = true
|
|
10
16
|
|
|
11
|
-
#
|
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
|
20
|
+
# config.action_dispatch.rack_cache = true
|
|
21
|
+
|
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
|
12
23
|
config.serve_static_assets = false
|
|
13
24
|
|
|
14
|
-
# Compress JavaScripts and CSS
|
|
15
|
-
config.assets.
|
|
25
|
+
# Compress JavaScripts and CSS.
|
|
26
|
+
config.assets.js_compressor = :uglifier
|
|
27
|
+
# config.assets.css_compressor = :sass
|
|
16
28
|
|
|
17
|
-
#
|
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
|
18
30
|
config.assets.compile = false
|
|
19
31
|
|
|
20
|
-
# Generate digests for assets URLs
|
|
32
|
+
# Generate digests for assets URLs.
|
|
21
33
|
config.assets.digest = true
|
|
22
34
|
|
|
23
|
-
#
|
|
24
|
-
|
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
|
36
|
+
config.assets.version = '1.0'
|
|
25
37
|
|
|
26
|
-
# Specifies the header that your server uses for sending files
|
|
38
|
+
# Specifies the header that your server uses for sending files.
|
|
27
39
|
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
|
28
40
|
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
|
29
41
|
|
|
30
42
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
31
43
|
# config.force_ssl = true
|
|
32
44
|
|
|
33
|
-
#
|
|
34
|
-
|
|
45
|
+
# Set to :debug to see everything in the log.
|
|
46
|
+
config.log_level = :info
|
|
35
47
|
|
|
36
|
-
# Prepend all log lines with the following tags
|
|
48
|
+
# Prepend all log lines with the following tags.
|
|
37
49
|
# config.log_tags = [ :subdomain, :uuid ]
|
|
38
50
|
|
|
39
|
-
# Use a different logger for distributed setups
|
|
51
|
+
# Use a different logger for distributed setups.
|
|
40
52
|
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
|
41
53
|
|
|
42
|
-
# Use a different cache store in production
|
|
54
|
+
# Use a different cache store in production.
|
|
43
55
|
# config.cache_store = :mem_cache_store
|
|
44
56
|
|
|
45
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
|
46
58
|
# config.action_controller.asset_host = "http://assets.example.com"
|
|
47
59
|
|
|
48
|
-
# Precompile additional assets
|
|
60
|
+
# Precompile additional assets.
|
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
|
49
62
|
# config.assets.precompile += %w( search.js )
|
|
50
63
|
|
|
51
|
-
#
|
|
64
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
|
65
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
|
52
66
|
# config.action_mailer.raise_delivery_errors = false
|
|
53
67
|
|
|
54
|
-
# Enable threaded mode
|
|
55
|
-
# config.threadsafe!
|
|
56
|
-
|
|
57
68
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
58
|
-
# the I18n.default_locale when a translation can not be found)
|
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
|
59
70
|
config.i18n.fallbacks = true
|
|
60
71
|
|
|
61
|
-
# Send deprecation notices to registered listeners
|
|
72
|
+
# Send deprecation notices to registered listeners.
|
|
62
73
|
config.active_support.deprecation = :notify
|
|
63
74
|
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
75
|
+
# Disable automatic flushing of the log to improve performance.
|
|
76
|
+
# config.autoflush_log = false
|
|
77
|
+
|
|
78
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
79
|
+
config.log_formatter = ::Logger::Formatter.new
|
|
67
80
|
end
|