slim 0.9.0 → 0.9.1.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +53 -0
- data/lib/slim/version.rb +1 -1
- data/test/helper.rb +177 -0
- data/test/integration/rails/dummy/Rakefile +7 -0
- data/test/integration/rails/dummy/app/controllers/application_controller.rb +3 -0
- data/test/integration/rails/dummy/app/controllers/parents_controller.rb +84 -0
- data/test/integration/rails/dummy/app/controllers/slim_controller.rb +25 -0
- data/test/integration/rails/dummy/app/helpers/application_helper.rb +2 -0
- data/test/integration/rails/dummy/app/models/child.rb +5 -0
- data/test/integration/rails/dummy/app/models/parent.rb +6 -0
- data/test/integration/rails/dummy/app/views/layouts/application.html.slim +10 -0
- data/test/integration/rails/dummy/app/views/parents/_form.html.slim +8 -0
- data/test/integration/rails/dummy/app/views/parents/edit.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/parents/new.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/parents/show.html.slim +5 -0
- data/test/integration/rails/dummy/app/views/slim/_partial.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/slim/content_for.html.slim +7 -0
- data/test/integration/rails/dummy/app/views/slim/erb.html.erb +1 -0
- data/test/integration/rails/dummy/app/views/slim/integers.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/slim/nil.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/slim/no_layout.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/slim/normal.html.slim +1 -0
- data/test/integration/rails/dummy/app/views/slim/partial.html.slim +2 -0
- data/test/integration/rails/dummy/app/views/slim/variables.html.slim +1 -0
- data/test/integration/rails/dummy/config/application.rb +44 -0
- data/test/integration/rails/dummy/config/boot.rb +10 -0
- data/test/integration/rails/dummy/config/database.yml +22 -0
- data/test/integration/rails/dummy/config/environment.rb +5 -0
- data/test/integration/rails/dummy/config/environments/development.rb +26 -0
- data/test/integration/rails/dummy/config/environments/production.rb +49 -0
- data/test/integration/rails/dummy/config/environments/test.rb +35 -0
- data/test/integration/rails/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/integration/rails/dummy/config/initializers/inflections.rb +10 -0
- data/test/integration/rails/dummy/config/initializers/mime_types.rb +5 -0
- data/test/integration/rails/dummy/config/initializers/secret_token.rb +7 -0
- data/test/integration/rails/dummy/config/initializers/session_store.rb +8 -0
- data/test/integration/rails/dummy/config/locales/en.yml +5 -0
- data/test/integration/rails/dummy/config/routes.rb +60 -0
- data/test/integration/rails/dummy/config.ru +4 -0
- data/test/integration/rails/dummy/db/migrate/20101220223037_parents_and_children.rb +17 -0
- data/test/integration/rails/dummy/script/rails +6 -0
- data/test/integration/rails/test_helper.rb +10 -0
- data/test/integration/rails/test_slim_rails.rb +66 -0
- data/test/slim/test_code_blocks.rb +68 -0
- data/test/slim/test_code_escaping.rb +53 -0
- data/test/slim/test_code_evaluation.rb +201 -0
- data/test/slim/test_code_output.rb +124 -0
- data/test/slim/test_code_structure.rb +95 -0
- data/test/slim/test_embedded_engines.rb +98 -0
- data/test/slim/test_html_escaping.rb +32 -0
- data/test/slim/test_html_structure.rb +307 -0
- data/test/slim/test_parser_errors.rb +107 -0
- data/test/slim/test_ruby_errors.rb +144 -0
- data/test/slim/test_sections.rb +90 -0
- data/test/slim/test_slim_template.rb +123 -0
- data/test/slim/test_text_interpolation.rb +56 -0
- data/test/slim/test_validator.rb +47 -0
- data/test/slim/test_wrapper.rb +32 -0
- metadata +68 -7
data/Rakefile
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
rescue Exception => e
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rake/testtask'
|
8
|
+
|
9
|
+
desc 'Run Slim benchmarks! (Default :iterations is 1000)'
|
10
|
+
task :bench, :iterations, :slow do |t, args|
|
11
|
+
ruby("benchmarks/run.rb #{args[:slow]} #{args[:iterations]}")
|
12
|
+
end
|
13
|
+
|
14
|
+
Rake::TestTask.new(:test) do |t|
|
15
|
+
t.libs << 'lib' << 'test'
|
16
|
+
t.pattern = 'test/slim/**/test_*.rb'
|
17
|
+
t.verbose = true
|
18
|
+
end
|
19
|
+
|
20
|
+
Rake::TestTask.new(:integration) do |t|
|
21
|
+
t.libs << 'lib' << 'test'
|
22
|
+
t.pattern = 'test/integration/**/test_*.rb'
|
23
|
+
t.verbose = true
|
24
|
+
end
|
25
|
+
|
26
|
+
begin
|
27
|
+
require 'rcov/rcovtask'
|
28
|
+
Rcov::RcovTask.new do |t|
|
29
|
+
t.libs << 'lib' << 'test'
|
30
|
+
t.pattern = 'test/**/test_*.rb'
|
31
|
+
t.verbose = true
|
32
|
+
end
|
33
|
+
rescue LoadError
|
34
|
+
task :rcov do
|
35
|
+
abort "RCov is not available. In order to run rcov, you must: gem install rcov"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
begin
|
40
|
+
require 'yard'
|
41
|
+
YARD::Rake::YardocTask.new do |t|
|
42
|
+
t.files = %w(lib/**/*.rb)
|
43
|
+
end
|
44
|
+
rescue LoadError
|
45
|
+
task :yard do
|
46
|
+
abort "YARD is not available. In order to run yard, you must: gem install yard"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Generate Documentation"
|
51
|
+
task :doc => :yard
|
52
|
+
|
53
|
+
task :default => 'test'
|
data/lib/slim/version.rb
CHANGED
data/test/helper.rb
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'minitest/unit'
|
5
|
+
require 'slim'
|
6
|
+
|
7
|
+
MiniTest::Unit.autorun
|
8
|
+
|
9
|
+
class TestSlim < MiniTest::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@env = Env.new
|
12
|
+
# Slim::Engine.set_default_options :debug => true
|
13
|
+
end
|
14
|
+
|
15
|
+
def teardown
|
16
|
+
Slim::Sections.set_default_options(:dictionary_access => :wrapped)
|
17
|
+
Temple::Filters::EscapeHTML.default_options.delete(:use_html_safe)
|
18
|
+
end
|
19
|
+
|
20
|
+
def render(source, options = {}, &block)
|
21
|
+
Slim::Template.new(options[:file], options) { source }.render(options[:scope] || @env, &block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def assert_html(expected, source, options = {}, &block)
|
25
|
+
assert_equal expected, render(source, options, &block)
|
26
|
+
end
|
27
|
+
|
28
|
+
def assert_syntax_error(message, source, options = {})
|
29
|
+
render(source, options)
|
30
|
+
raise 'Syntax error expected'
|
31
|
+
rescue Slim::Parser::SyntaxError => ex
|
32
|
+
assert_equal message, ex.message
|
33
|
+
end
|
34
|
+
|
35
|
+
def assert_ruby_error(error, from, source, options = {})
|
36
|
+
render(source, options)
|
37
|
+
raise 'Ruby error expected'
|
38
|
+
rescue error => ex
|
39
|
+
ex.backtrace[0] =~ /^(.*?:\d+):/
|
40
|
+
assert_equal from, $1
|
41
|
+
end
|
42
|
+
|
43
|
+
def assert_ruby_syntax_error(from, source, options = {})
|
44
|
+
render(source, options)
|
45
|
+
raise 'Ruby syntax error expected'
|
46
|
+
rescue SyntaxError => ex
|
47
|
+
ex.message =~ /^(.*?:\d+):/
|
48
|
+
assert_equal from, $1
|
49
|
+
end
|
50
|
+
|
51
|
+
def assert_runtime_error(message, source, options = {})
|
52
|
+
render(source, options)
|
53
|
+
raise Exception, 'Runtime error expected'
|
54
|
+
rescue RuntimeError => ex
|
55
|
+
assert_equal message, ex.message
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
class Env
|
60
|
+
attr_reader :var
|
61
|
+
|
62
|
+
class HtmlSafeString < String
|
63
|
+
def html_safe?
|
64
|
+
true
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class HtmlUnsafeString < String
|
69
|
+
def html_safe?
|
70
|
+
false
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def initialize
|
75
|
+
@var = 'instance'
|
76
|
+
end
|
77
|
+
|
78
|
+
def id_helper
|
79
|
+
"notice"
|
80
|
+
end
|
81
|
+
|
82
|
+
def hash
|
83
|
+
{:a => 'The letter a', :b => 'The letter b'}
|
84
|
+
end
|
85
|
+
|
86
|
+
def show_first?(show = false)
|
87
|
+
show
|
88
|
+
end
|
89
|
+
|
90
|
+
def define_macro(name, &block)
|
91
|
+
@macro ||= {}
|
92
|
+
@macro[name.to_s] = block
|
93
|
+
''
|
94
|
+
end
|
95
|
+
|
96
|
+
def call_macro(name, *args)
|
97
|
+
@macro[name.to_s].call(*args)
|
98
|
+
end
|
99
|
+
|
100
|
+
def hello_world(text = "Hello World from @env", opts = {})
|
101
|
+
text << opts.to_a * " " if opts.any?
|
102
|
+
if block_given?
|
103
|
+
"#{text} #{yield} #{text}"
|
104
|
+
else
|
105
|
+
text
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def message(*args)
|
110
|
+
args.join(' ')
|
111
|
+
end
|
112
|
+
|
113
|
+
def action_path(*args)
|
114
|
+
"/action-#{args.join('-')}"
|
115
|
+
end
|
116
|
+
|
117
|
+
def in_keyword
|
118
|
+
"starts with keyword"
|
119
|
+
end
|
120
|
+
|
121
|
+
def evil_method
|
122
|
+
"<script>do_something_evil();</script>"
|
123
|
+
end
|
124
|
+
|
125
|
+
def output_number
|
126
|
+
1337
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
class ViewEnv
|
131
|
+
def person
|
132
|
+
[{:name => 'Joe'}, {:name => 'Jack'}]
|
133
|
+
end
|
134
|
+
|
135
|
+
def people
|
136
|
+
%w(Andy Fred Daniel).collect{|n| Person.new(n)}
|
137
|
+
end
|
138
|
+
|
139
|
+
def cities
|
140
|
+
%w{Atlanta Melbourne Karlsruhe}
|
141
|
+
end
|
142
|
+
|
143
|
+
def people_with_locations
|
144
|
+
array = []
|
145
|
+
people.each_with_index do |p,i|
|
146
|
+
p.location = Location.new cities[i]
|
147
|
+
array << p
|
148
|
+
end
|
149
|
+
array
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
require 'forwardable'
|
154
|
+
|
155
|
+
class Person
|
156
|
+
extend Forwardable
|
157
|
+
|
158
|
+
attr_accessor :name
|
159
|
+
|
160
|
+
def initialize(name)
|
161
|
+
@name = name
|
162
|
+
end
|
163
|
+
|
164
|
+
def location=(location)
|
165
|
+
@location = location
|
166
|
+
end
|
167
|
+
|
168
|
+
def_delegators :@location, :city
|
169
|
+
end
|
170
|
+
|
171
|
+
class Location
|
172
|
+
attr_accessor :city
|
173
|
+
|
174
|
+
def initialize(city)
|
175
|
+
@city = city
|
176
|
+
end
|
177
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# Add your own tasks in files placed in lib/tasks ending in .rake,
|
2
|
+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
|
3
|
+
|
4
|
+
require File.expand_path('../config/application', __FILE__)
|
5
|
+
require 'rake'
|
6
|
+
|
7
|
+
Dummy::Application.load_tasks
|
@@ -0,0 +1,84 @@
|
|
1
|
+
class ParentsController < ApplicationController
|
2
|
+
# GET /parents
|
3
|
+
# GET /parents.xml
|
4
|
+
def index
|
5
|
+
@parents = Parent.all
|
6
|
+
|
7
|
+
respond_to do |format|
|
8
|
+
format.html # index.html.erb
|
9
|
+
format.xml { render :xml => @parents }
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# GET /parents/1
|
14
|
+
# GET /parents/1.xml
|
15
|
+
def show
|
16
|
+
@parent = Parent.find(params[:id])
|
17
|
+
|
18
|
+
respond_to do |format|
|
19
|
+
format.html # show.html.erb
|
20
|
+
format.xml { render :xml => @parent }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# GET /parents/new
|
25
|
+
# GET /parents/new.xml
|
26
|
+
def new
|
27
|
+
@parent = Parent.new
|
28
|
+
@parent.children.build
|
29
|
+
|
30
|
+
respond_to do |format|
|
31
|
+
format.html # new.html.erb
|
32
|
+
format.xml { render :xml => @parent }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# GET /parents/1/edit
|
37
|
+
def edit
|
38
|
+
@parent = Parent.find(params[:id])
|
39
|
+
end
|
40
|
+
|
41
|
+
# POST /parents
|
42
|
+
# POST /parents.xml
|
43
|
+
def create
|
44
|
+
@parent = Parent.new(params[:parent])
|
45
|
+
|
46
|
+
respond_to do |format|
|
47
|
+
if @parent.save
|
48
|
+
format.html { redirect_to(@parent, :notice => 'Parent was successfully created.') }
|
49
|
+
format.xml { render :xml => @parent, :status => :created, :location => @parent }
|
50
|
+
else
|
51
|
+
format.html { render :action => "new" }
|
52
|
+
format.xml { render :xml => @parent.errors, :status => :unprocessable_entity }
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# PUT /parents/1
|
58
|
+
# PUT /parents/1.xml
|
59
|
+
def update
|
60
|
+
@parent = Parent.find(params[:id])
|
61
|
+
|
62
|
+
respond_to do |format|
|
63
|
+
if @parent.update_attributes(params[:parent])
|
64
|
+
format.html { redirect_to(@parent, :notice => 'Parent was successfully updated.') }
|
65
|
+
format.xml { head :ok }
|
66
|
+
else
|
67
|
+
format.html { render :action => "edit" }
|
68
|
+
format.xml { render :xml => @parent.errors, :status => :unprocessable_entity }
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# DELETE /parents/1
|
74
|
+
# DELETE /parents/1.xml
|
75
|
+
def destroy
|
76
|
+
@parent = Parent.find(params[:id])
|
77
|
+
@parent.destroy
|
78
|
+
|
79
|
+
respond_to do |format|
|
80
|
+
format.html { redirect_to(parents_url) }
|
81
|
+
format.xml { head :ok }
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class SlimController < ApplicationController
|
2
|
+
def normal; end
|
3
|
+
|
4
|
+
def no_layout
|
5
|
+
render :layout => false
|
6
|
+
end
|
7
|
+
|
8
|
+
def variables
|
9
|
+
@hello = "Hello Slim with variables!"
|
10
|
+
end
|
11
|
+
|
12
|
+
def partial; end
|
13
|
+
|
14
|
+
def integers
|
15
|
+
@integer = 1337
|
16
|
+
end
|
17
|
+
|
18
|
+
def nil
|
19
|
+
@nil = nil
|
20
|
+
end
|
21
|
+
|
22
|
+
def content_for
|
23
|
+
@hello = "Hello Slim!"
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
= render "form"
|
@@ -0,0 +1 @@
|
|
1
|
+
= render "form"
|
@@ -0,0 +1 @@
|
|
1
|
+
p With a partial!
|
@@ -0,0 +1 @@
|
|
1
|
+
<h1>Hello Erb!</h1>
|
@@ -0,0 +1 @@
|
|
1
|
+
p= @integer
|
@@ -0,0 +1 @@
|
|
1
|
+
p= @nil
|
@@ -0,0 +1 @@
|
|
1
|
+
h1 Hello Slim without a layout!
|
@@ -0,0 +1 @@
|
|
1
|
+
h1 Hello Slim!
|
@@ -0,0 +1 @@
|
|
1
|
+
h1= @hello
|
@@ -0,0 +1,44 @@
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
2
|
+
|
3
|
+
require "active_model/railtie"
|
4
|
+
require "active_record/railtie"
|
5
|
+
require "action_controller/railtie"
|
6
|
+
require "action_view/railtie"
|
7
|
+
require "action_mailer/railtie"
|
8
|
+
|
9
|
+
require "slim/rails"
|
10
|
+
|
11
|
+
module Dummy
|
12
|
+
class Application < Rails::Application
|
13
|
+
# Settings in config/environments/* take precedence over those specified here.
|
14
|
+
# Application configuration should go into files in config/initializers
|
15
|
+
# -- all .rb files in that directory are automatically loaded.
|
16
|
+
|
17
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
18
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
19
|
+
|
20
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
21
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
22
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
23
|
+
|
24
|
+
# Activate observers that should always be running.
|
25
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
26
|
+
|
27
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
28
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
29
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
30
|
+
|
31
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
32
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
33
|
+
# config.i18n.default_locale = :de
|
34
|
+
|
35
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
36
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
37
|
+
|
38
|
+
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
+
config.encoding = "utf-8"
|
40
|
+
|
41
|
+
# Configure sensitive parameters which will be filtered from the log file.
|
42
|
+
config.filter_parameters += [:password]
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
gemfile = File.expand_path('../../../../../../Gemfile', __FILE__)
|
3
|
+
|
4
|
+
if File.exist?(gemfile)
|
5
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
6
|
+
require 'bundler'
|
7
|
+
Bundler.setup(:default, :integration)
|
8
|
+
end
|
9
|
+
|
10
|
+
$:.unshift File.expand_path('../../../../../../lib', __FILE__)
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3-ruby (not necessary on OS X Leopard)
|
3
|
+
development:
|
4
|
+
adapter: sqlite3
|
5
|
+
database: db/development.sqlite3
|
6
|
+
pool: 5
|
7
|
+
timeout: 5000
|
8
|
+
|
9
|
+
# Warning: The database defined as "test" will be erased and
|
10
|
+
# re-generated from your development database when you run "rake".
|
11
|
+
# Do not set this db to the same as development or production.
|
12
|
+
test:
|
13
|
+
adapter: sqlite3
|
14
|
+
database: db/test.sqlite3
|
15
|
+
pool: 5
|
16
|
+
timeout: 5000
|
17
|
+
|
18
|
+
production:
|
19
|
+
adapter: sqlite3
|
20
|
+
database: db/production.sqlite3
|
21
|
+
pool: 5
|
22
|
+
timeout: 5000
|
@@ -0,0 +1,26 @@
|
|
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 webserver when you make code changes.
|
7
|
+
config.cache_classes = false
|
8
|
+
|
9
|
+
# Log error messages when you accidentally call methods on nil.
|
10
|
+
config.whiny_nils = true
|
11
|
+
|
12
|
+
# Show full error reports and disable caching
|
13
|
+
config.consider_all_requests_local = true
|
14
|
+
config.action_view.debug_rjs = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Don't care if the mailer can't send
|
18
|
+
config.action_mailer.raise_delivery_errors = false
|
19
|
+
|
20
|
+
# Print deprecation notices to the Rails logger
|
21
|
+
config.active_support.deprecation = :log
|
22
|
+
|
23
|
+
# Only use best-standards-support built into browsers
|
24
|
+
config.action_dispatch.best_standards_support = :builtin
|
25
|
+
end
|
26
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
Dummy::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb
|
3
|
+
|
4
|
+
# The production environment is meant for finished, "live" apps.
|
5
|
+
# Code is not reloaded between requests
|
6
|
+
config.cache_classes = true
|
7
|
+
|
8
|
+
# Full error reports are disabled and caching is turned on
|
9
|
+
config.consider_all_requests_local = false
|
10
|
+
config.action_controller.perform_caching = true
|
11
|
+
|
12
|
+
# Specifies the header that your server uses for sending files
|
13
|
+
config.action_dispatch.x_sendfile_header = "X-Sendfile"
|
14
|
+
|
15
|
+
# For nginx:
|
16
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
|
17
|
+
|
18
|
+
# If you have no front-end server that supports something like X-Sendfile,
|
19
|
+
# just comment this out and Rails will serve the files
|
20
|
+
|
21
|
+
# See everything in the log (default is :info)
|
22
|
+
# config.log_level = :debug
|
23
|
+
|
24
|
+
# Use a different logger for distributed setups
|
25
|
+
# config.logger = SyslogLogger.new
|
26
|
+
|
27
|
+
# Use a different cache store in production
|
28
|
+
# config.cache_store = :mem_cache_store
|
29
|
+
|
30
|
+
# Disable Rails's static asset server
|
31
|
+
# In production, Apache or nginx will already do this
|
32
|
+
config.serve_static_assets = false
|
33
|
+
|
34
|
+
# Enable serving of images, stylesheets, and javascripts from an asset server
|
35
|
+
# config.action_controller.asset_host = "http://assets.example.com"
|
36
|
+
|
37
|
+
# Disable delivery errors, bad email addresses will be ignored
|
38
|
+
# config.action_mailer.raise_delivery_errors = false
|
39
|
+
|
40
|
+
# Enable threaded mode
|
41
|
+
# config.threadsafe!
|
42
|
+
|
43
|
+
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
44
|
+
# the I18n.default_locale when a translation can not be found)
|
45
|
+
config.i18n.fallbacks = true
|
46
|
+
|
47
|
+
# Send deprecation notices to registered listeners
|
48
|
+
config.active_support.deprecation = :notify
|
49
|
+
end
|
@@ -0,0 +1,35 @@
|
|
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
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
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,10 @@
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
2
|
+
|
3
|
+
# Add new inflection rules using the following format
|
4
|
+
# (all these examples are active by default):
|
5
|
+
# ActiveSupport::Inflector.inflections do |inflect|
|
6
|
+
# inflect.plural /^(ox)$/i, '\1en'
|
7
|
+
# inflect.singular /^(ox)en/i, '\1'
|
8
|
+
# inflect.irregular 'person', 'people'
|
9
|
+
# inflect.uncountable %w( fish sheep )
|
10
|
+
# end
|