rails_imager 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/rails_imager/images_controller.rb +15 -4
- data/lib/rails_imager/version.rb +1 -1
- data/spec/controllers/rails_imager/images_controller_spec.rb +129 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +13 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -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/application.rb +23 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +25 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +29 -0
- data/spec/dummy/config/environments/production.rb +80 -0
- data/spec/dummy/config/environments/test.rb +36 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +12 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +3 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1877 -0
- data/spec/dummy/log/test.log +10153 -0
- data/spec/dummy/public/404.html +58 -0
- data/spec/dummy/public/422.html +58 -0
- data/spec/dummy/public/500.html +57 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/test.png +0 -0
- data/spec/dummy/public/test_/303/246_/303/270_/303/245.png +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0664a19cc0f5d977f80bafcefe17e9c9 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/0a9ac96e2e41642bb5a979bc1bba099d +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ca25a1b4dbb5046e79cdc5c2b0e6d55 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/510b6fd97773642f0b777a14f0ef5366 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9e801b0fd4666d3a5cb45345d7de21a7 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b40bea70cdbfe1b3b11ede81a1d20002 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/be7b64afb60161c417c6465682b304ac +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/c0dbbd2455c6e7638bd41c5f003dff53 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cc85e49d1f8af3e2bb0073f666f413be +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/e31424e52369b0afcae5d0350c19ae82 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f202557856e13ca5921856c87d402bd4 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/fe7c9c32074445201dccf284f19078bf +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/0a9ac96e2e41642bb5a979bc1bba099d +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/2ca25a1b4dbb5046e79cdc5c2b0e6d55 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/510b6fd97773642f0b777a14f0ef5366 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/9e801b0fd4666d3a5cb45345d7de21a7 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/b40bea70cdbfe1b3b11ede81a1d20002 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/be7b64afb60161c417c6465682b304ac +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/c0dbbd2455c6e7638bd41c5f003dff53 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/e31424e52369b0afcae5d0350c19ae82 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/f202557856e13ca5921856c87d402bd4 +0 -0
- data/spec/dummy/tmp/cache/assets/test/sprockets/fe7c9c32074445201dccf284f19078bf +0 -0
- data/spec/helpers/rails_imager/images_helper_spec.rb +8 -0
- data/spec/spec_helper.rb +45 -0
- data/spec/test.png +0 -0
- metadata +143 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04126925985bb64dc3e56a9260c42bacf152dad
|
4
|
+
data.tar.gz: c1221e0713d7640f147139272ea0f578a0fd8e09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c45f32971ceb7439d753ced646a807ce954a65bc10e953617a55ef7a6207123cecc6e63dff07b1f03aca53f6421d76896ed8a84cf25bd97d529133e0d1721214
|
7
|
+
data.tar.gz: b0e2f3664caa12cca9d5b78739e6883b9ce3378bed3b466d83c64184ca201ee4d9a9643f212cd1d8b87fde9fb6555834ebaec55d926a3e5e1981863da46f219a
|
@@ -1,5 +1,11 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
class RailsImager::ImagesController < ApplicationController
|
2
3
|
PARAMS_ARGS = [:width, :height, :smartsize, :maxwidth, :maxheight, :rounded_corners, :border, :border_color, :force]
|
4
|
+
URI_REPLACES = {
|
5
|
+
"%C3%A6" => "æ",
|
6
|
+
"%C3%B8" => "ø",
|
7
|
+
"%C3%A5" => "å"
|
8
|
+
}
|
3
9
|
|
4
10
|
def show
|
5
11
|
set_and_validate_parameters
|
@@ -10,16 +16,21 @@ class RailsImager::ImagesController < ApplicationController
|
|
10
16
|
set_headers
|
11
17
|
|
12
18
|
if not_modified? && !force?
|
13
|
-
render :
|
19
|
+
render nothing: true, status: "304 Not Modified"
|
14
20
|
else
|
15
|
-
send_file @cache_path, :
|
21
|
+
send_file @cache_path, type: "image/png", disposition: "inline", filename: "picture.png"
|
16
22
|
end
|
17
23
|
end
|
18
24
|
|
19
25
|
private
|
20
26
|
|
21
27
|
def set_path
|
22
|
-
|
28
|
+
id = params[:id]
|
29
|
+
URI_REPLACES.each do |key, val|
|
30
|
+
id = id.gsub(key, val)
|
31
|
+
end
|
32
|
+
|
33
|
+
@path = "#{Rails.public_path}/#{id}"
|
23
34
|
@full_path = File.realpath(@path)
|
24
35
|
validate_path
|
25
36
|
end
|
@@ -190,7 +201,7 @@ private
|
|
190
201
|
def apply_rounded_corners
|
191
202
|
@image = @image.clone
|
192
203
|
@image.format = "png" # Needs PNG format for transparency.
|
193
|
-
args = {:
|
204
|
+
args = {img: @image, radius: @image_params[:rounded_corners].to_i}
|
194
205
|
|
195
206
|
if @image_params[:border] && @image_params[:border_color]
|
196
207
|
args[:border] = @image_params[:border].to_i
|
data/lib/rails_imager/version.rb
CHANGED
@@ -0,0 +1,129 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'spec_helper'
|
4
|
+
require 'RMagick'
|
5
|
+
|
6
|
+
describe RailsImager::ImagesController do
|
7
|
+
before do
|
8
|
+
RailsImager.config do |config|
|
9
|
+
config.allowed_paths << File.realpath("#{File.dirname(__FILE__)}/../../dummy/public")
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
it "smartsize" do
|
14
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 200}
|
15
|
+
assert_response :success
|
16
|
+
assert "image/png", response.content_type
|
17
|
+
img = ::Magick::Image.from_blob(response.body).first
|
18
|
+
img.columns.should eq 200
|
19
|
+
img.rows.should eq 196
|
20
|
+
end
|
21
|
+
|
22
|
+
it "cache via expires" do
|
23
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 200, rounded_corners: 8}
|
24
|
+
image_path = "#{Rails.public_path}/test.png"
|
25
|
+
response.headers["Expires"].should_not eq nil
|
26
|
+
assert_equal response.headers["Last-Modified"], File.mtime(image_path).httpdate
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should not accept invalid parameters" do
|
30
|
+
expect {
|
31
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {invalid_param: "kasper"}
|
32
|
+
}.to raise_error(ArgumentError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should do exact sizes" do
|
36
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {width: "640", height: "480"}
|
37
|
+
img = ::Magick::Image.from_blob(response.body).first
|
38
|
+
img.columns.should eq 640
|
39
|
+
img.rows.should eq 480
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should work correctly with special characters" do
|
43
|
+
get :show, use_route: :rails_imager, id: "test_æ_%C3%B8_å.png", image: {width: 640, height: 480}
|
44
|
+
response.should be_success
|
45
|
+
img = ::Magick::Image.from_blob(response.body).first
|
46
|
+
img.columns.should eq 640
|
47
|
+
img.rows.should eq 480
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should do rounded corners" do
|
51
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: "640", rounded_corners: "15", border: "1", border_color: "black"}
|
52
|
+
|
53
|
+
old_file_path = File.realpath("#{File.dirname(__FILE__)}/../../test.png")
|
54
|
+
old_img = Magick::Image.read(old_file_path).first
|
55
|
+
|
56
|
+
img = ::Magick::Image.from_blob(response.body).first
|
57
|
+
img.columns.should eq 640
|
58
|
+
img.rows.should eq 629
|
59
|
+
|
60
|
+
#Test that corner pixels are transparent.
|
61
|
+
4.times do |time|
|
62
|
+
pixel = img.pixel_color(time, time)
|
63
|
+
pixel.opacity.should eq 65535
|
64
|
+
|
65
|
+
pixel_orig = old_img.pixel_color(time, time)
|
66
|
+
pixel_orig.opacity.should eq 0
|
67
|
+
end
|
68
|
+
|
69
|
+
#Test that it got a black border.
|
70
|
+
pixel = img.pixel_color(2, 5)
|
71
|
+
pixel.red.should eq 0
|
72
|
+
pixel.green.should eq 0
|
73
|
+
pixel.blue.should eq 0
|
74
|
+
pixel.opacity.should eq 0
|
75
|
+
|
76
|
+
#Test that middle pixels are not transparent.
|
77
|
+
100.upto(200) do |time|
|
78
|
+
pixel = img.pixel_color(time, time)
|
79
|
+
pixel.opacity.should eq 0
|
80
|
+
|
81
|
+
pixel_orig = old_img.pixel_color(time, time)
|
82
|
+
pixel_orig.opacity.should eq 0
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should do max width" do
|
87
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {maxwidth: 200}
|
88
|
+
img = ::Magick::Image.from_blob(response.body).first
|
89
|
+
img.columns.should eq 200
|
90
|
+
img.rows.should eq 196
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should do max height" do
|
94
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {maxheight: 200}
|
95
|
+
img = ::Magick::Image.from_blob(response.body).first
|
96
|
+
img.rows.should eq 200
|
97
|
+
img.columns.should eq 203
|
98
|
+
end
|
99
|
+
|
100
|
+
it "should be able to generate valid cache names" do
|
101
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 400}
|
102
|
+
assigns(:cache_name).should include "test.png__ARGS__width-_height-_smartsize-400_maxwidth-_maxheight-_rounded_corners-_border-_border_color-"
|
103
|
+
end
|
104
|
+
|
105
|
+
it "should be able to generate cache" do
|
106
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 400, force: true}
|
107
|
+
assigns(:image).should_not eq nil
|
108
|
+
controller.instance_variable_set(:@image, nil)
|
109
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 400}
|
110
|
+
response.code.should eq "200"
|
111
|
+
assigns(:image).should eq nil
|
112
|
+
end
|
113
|
+
|
114
|
+
it "should send not modified" do
|
115
|
+
old_file_path = File.realpath("#{File.dirname(__FILE__)}/../../test.png")
|
116
|
+
|
117
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 350}
|
118
|
+
request.headers["If-Modified-Since"] = File.mtime(old_file_path)
|
119
|
+
get :show, use_route: :rails_imager, id: "test.png", image: {smartsize: 350}
|
120
|
+
|
121
|
+
response.code.should eq "304"
|
122
|
+
end
|
123
|
+
|
124
|
+
it "should not allow paths that havent specifically been allowed" do
|
125
|
+
expect {
|
126
|
+
get :show, use_route: :rails_imager, id: "/../config.ru", image: {smartsize: 200}
|
127
|
+
}.to raise_error(ArgumentError)
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
== README
|
2
|
+
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
4
|
+
application up and running.
|
5
|
+
|
6
|
+
Things you may want to cover:
|
7
|
+
|
8
|
+
* Ruby version
|
9
|
+
|
10
|
+
* System dependencies
|
11
|
+
|
12
|
+
* Configuration
|
13
|
+
|
14
|
+
* Database creation
|
15
|
+
|
16
|
+
* Database initialization
|
17
|
+
|
18
|
+
* How to run the test suite
|
19
|
+
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
21
|
+
|
22
|
+
* Deployment instructions
|
23
|
+
|
24
|
+
* ...
|
25
|
+
|
26
|
+
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
@@ -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 vendor/assets/javascripts of plugins, if any, 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.
|
9
|
+
//
|
10
|
+
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
|
11
|
+
// about supported directives.
|
12
|
+
//
|
13
|
+
//= require_tree .
|
@@ -0,0 +1,13 @@
|
|
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 vendor/assets/stylesheets of plugins, if any, 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 top of the
|
9
|
+
* compiled file, but it's generally better to create a new file per style scope.
|
10
|
+
*
|
11
|
+
*= require_self
|
12
|
+
*= require_tree .
|
13
|
+
*/
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
|
6
|
+
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
|
7
|
+
<%= csrf_meta_tags %>
|
8
|
+
</head>
|
9
|
+
<body>
|
10
|
+
|
11
|
+
<%= yield %>
|
12
|
+
|
13
|
+
</body>
|
14
|
+
</html>
|
data/spec/dummy/bin/rake
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require 'rails/all'
|
4
|
+
|
5
|
+
Bundler.require(*Rails.groups)
|
6
|
+
require "rails_imager"
|
7
|
+
|
8
|
+
module Dummy
|
9
|
+
class Application < Rails::Application
|
10
|
+
# Settings in config/environments/* take precedence over those specified here.
|
11
|
+
# Application configuration should go into files in config/initializers
|
12
|
+
# -- all .rb files in that directory are automatically loaded.
|
13
|
+
|
14
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
15
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
16
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
|
+
|
18
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
19
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
20
|
+
# config.i18n.default_locale = :de
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -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
|
+
development:
|
7
|
+
adapter: sqlite3
|
8
|
+
database: db/development.sqlite3
|
9
|
+
pool: 5
|
10
|
+
timeout: 5000
|
11
|
+
|
12
|
+
# Warning: The database defined as "test" will be erased and
|
13
|
+
# re-generated from your development database when you run "rake".
|
14
|
+
# Do not set this db to the same as development or production.
|
15
|
+
test:
|
16
|
+
adapter: sqlite3
|
17
|
+
database: db/test.sqlite3
|
18
|
+
pool: 5
|
19
|
+
timeout: 5000
|
20
|
+
|
21
|
+
production:
|
22
|
+
adapter: sqlite3
|
23
|
+
database: db/production.sqlite3
|
24
|
+
pool: 5
|
25
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# In the development environment your application's code is reloaded on
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
|
+
# since you don't have to restart the web server when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Do not eager load code on boot.
|
10
|
+
config.eager_load = false
|
11
|
+
|
12
|
+
# Show full error reports and disable caching.
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_controller.perform_caching = false
|
15
|
+
|
16
|
+
# Don't care if the mailer can't send.
|
17
|
+
config.action_mailer.raise_delivery_errors = false
|
18
|
+
|
19
|
+
# Print deprecation notices to the Rails logger.
|
20
|
+
config.active_support.deprecation = :log
|
21
|
+
|
22
|
+
# Raise an error on page load if there are pending migrations
|
23
|
+
config.active_record.migration_error = :page_load
|
24
|
+
|
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.
|
28
|
+
config.assets.debug = true
|
29
|
+
end
|
@@ -0,0 +1,80 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# Code is not reloaded between requests.
|
5
|
+
config.cache_classes = true
|
6
|
+
|
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.
|
14
|
+
config.consider_all_requests_local = false
|
15
|
+
config.action_controller.perform_caching = true
|
16
|
+
|
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).
|
23
|
+
config.serve_static_assets = false
|
24
|
+
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
37
|
+
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
43
|
+
# config.force_ssl = true
|
44
|
+
|
45
|
+
# Set to :debug to see everything in the log.
|
46
|
+
config.log_level = :info
|
47
|
+
|
48
|
+
# Prepend all log lines with the following tags.
|
49
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
50
|
+
|
51
|
+
# Use a different logger for distributed setups.
|
52
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
53
|
+
|
54
|
+
# Use a different cache store in production.
|
55
|
+
# config.cache_store = :mem_cache_store
|
56
|
+
|
57
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
58
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
59
|
+
|
60
|
+
# Precompile additional assets.
|
61
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
62
|
+
# config.assets.precompile += %w( search.js )
|
63
|
+
|
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.
|
66
|
+
# config.action_mailer.raise_delivery_errors = false
|
67
|
+
|
68
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
69
|
+
# the I18n.default_locale when a translation can not be found).
|
70
|
+
config.i18n.fallbacks = true
|
71
|
+
|
72
|
+
# Send deprecation notices to registered listeners.
|
73
|
+
config.active_support.deprecation = :notify
|
74
|
+
|
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
|
80
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Do not eager load code on boot. This avoids loading your whole application
|
11
|
+
# just for the purpose of running a single test. If you are using a tool that
|
12
|
+
# preloads Rails for running tests, you may have to set it to true.
|
13
|
+
config.eager_load = false
|
14
|
+
|
15
|
+
# Configure static asset server for tests with Cache-Control for performance.
|
16
|
+
config.serve_static_assets = true
|
17
|
+
config.static_cache_control = "public, max-age=3600"
|
18
|
+
|
19
|
+
# Show full error reports and disable caching.
|
20
|
+
config.consider_all_requests_local = true
|
21
|
+
config.action_controller.perform_caching = false
|
22
|
+
|
23
|
+
# Raise exceptions instead of rendering exception templates.
|
24
|
+
config.action_dispatch.show_exceptions = false
|
25
|
+
|
26
|
+
# Disable request forgery protection in test environment.
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
|
+
|
29
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
30
|
+
# The :test delivery method accumulates sent emails in the
|
31
|
+
# ActionMailer::Base.deliveries array.
|
32
|
+
config.action_mailer.delivery_method = :test
|
33
|
+
|
34
|
+
# Print deprecation notices to the stderr.
|
35
|
+
config.active_support.deprecation = :stderr
|
36
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
|
4
|
+
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
|
5
|
+
|
6
|
+
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
|
7
|
+
# Rails.backtrace_cleaner.remove_silencers!
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format. Inflections
|
4
|
+
# are locale specific, and you may define rules for as many different
|
5
|
+
# locales as you wish. All of these examples are active by default:
|
6
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
7
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
8
|
+
# inflect.singular /^(ox)en/i, '\1'
|
9
|
+
# inflect.irregular 'person', 'people'
|
10
|
+
# inflect.uncountable %w( fish sheep )
|
11
|
+
# end
|
12
|
+
|
13
|
+
# These inflection rules are supported but not enabled by default:
|
14
|
+
# ActiveSupport::Inflector.inflections(:en) do |inflect|
|
15
|
+
# inflect.acronym 'RESTful'
|
16
|
+
# end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
4
|
+
# If you change this key, all old signed cookies will become invalid!
|
5
|
+
|
6
|
+
# Make sure the secret is at least 30 characters and all random,
|
7
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
8
|
+
# You can use `rake secret` to generate a secure secret key.
|
9
|
+
|
10
|
+
# Make sure your secret_key_base is kept private
|
11
|
+
# if you're sharing your code publicly.
|
12
|
+
Dummy::Application.config.secret_key_base = '38592eb56d7625dae555fe965d8bdc56bb3d186911b2b28094b88b5ddd2d19c7834c19ebc6114c7933e0a907e99faf8969947198bd0c1e4a9876071c19d72c6d'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# This file contains settings for ActionController::ParamsWrapper which
|
4
|
+
# is enabled by default.
|
5
|
+
|
6
|
+
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
|
7
|
+
ActiveSupport.on_load(:action_controller) do
|
8
|
+
wrap_parameters format: [:json] if respond_to?(:wrap_parameters)
|
9
|
+
end
|
10
|
+
|
11
|
+
# To enable root element in JSON for ActiveRecord objects.
|
12
|
+
# ActiveSupport.on_load(:active_record) do
|
13
|
+
# self.include_root_in_json = true
|
14
|
+
# end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# Files in the config/locales directory are used for internationalization
|
2
|
+
# and are automatically loaded by Rails. If you want to use locales other
|
3
|
+
# than English, add the necessary files in this directory.
|
4
|
+
#
|
5
|
+
# To use the locales, use `I18n.t`:
|
6
|
+
#
|
7
|
+
# I18n.t 'hello'
|
8
|
+
#
|
9
|
+
# In views, this is aliased to just `t`:
|
10
|
+
#
|
11
|
+
# <%= t('hello') %>
|
12
|
+
#
|
13
|
+
# To use a different locale, set it with `I18n.locale`:
|
14
|
+
#
|
15
|
+
# I18n.locale = :es
|
16
|
+
#
|
17
|
+
# This would use the information in config/locales/es.yml.
|
18
|
+
#
|
19
|
+
# To learn more, please read the Rails Internationalization guide
|
20
|
+
# available at http://guides.rubyonrails.org/i18n.html.
|
21
|
+
|
22
|
+
en:
|
23
|
+
hello: "Hello world"
|
File without changes
|
File without changes
|