homura 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/Gemfile +4 -0
- data/Guardfile +19 -0
- data/LICENSE +22 -0
- data/README.md +51 -0
- data/Rakefile +2 -0
- data/app/helpers/homura/layout_helper.rb +101 -0
- data/app/views/layouts/homura.html.slim +15 -0
- data/homura.gemspec +26 -0
- data/lib/generators/homura/install/USAGE +9 -0
- data/lib/generators/homura/install/install_generator.rb +14 -0
- data/lib/generators/homura/install/templates/application.html.slim +15 -0
- data/lib/generators/homura/install/templates/application.html.slim.bak +15 -0
- data/lib/generators/homura/install/templates/layout.en.yml +5 -0
- data/lib/homura/engine.rb +9 -0
- data/lib/homura/set_locale.rb +32 -0
- data/lib/homura/version.rb +3 -0
- data/lib/homura.rb +7 -0
- data/spec/dummy/.gitignore +2 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.slim +15 -0
- data/spec/dummy/config/application.rb +44 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/database.yml +22 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +26 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +35 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/inflections.rb +10 -0
- data/spec/dummy/config/initializers/mime_types.rb +5 -0
- data/spec/dummy/config/initializers/secret_token.rb +7 -0
- data/spec/dummy/config/initializers/session_store.rb +8 -0
- data/spec/dummy/config/locales/en.yml +5 -0
- data/spec/dummy/config/routes.rb +58 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/public/404.html +26 -0
- data/spec/dummy/public/422.html +26 -0
- data/spec/dummy/public/500.html +26 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/public/javascripts/application.js +2 -0
- data/spec/dummy/public/javascripts/controls.js +965 -0
- data/spec/dummy/public/javascripts/dragdrop.js +974 -0
- data/spec/dummy/public/javascripts/effects.js +1123 -0
- data/spec/dummy/public/javascripts/prototype.js +6001 -0
- data/spec/dummy/public/javascripts/rails.js +202 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/helpers/homura/layout_helper_spec.rb +78 -0
- data/spec/spec_helper.rb +34 -0
- data/spec/views/layouts/homura.html.slim_spec.rb +23 -0
- metadata +252 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard 'rspec', :version => 2 do
|
5
|
+
watch(%r{^spec/.+_spec\.rb$})
|
6
|
+
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
|
7
|
+
watch('spec/spec_helper.rb') { "spec" }
|
8
|
+
|
9
|
+
# Rails example
|
10
|
+
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
11
|
+
watch(%r{^app/(.*)(\.erb|\.haml)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
|
12
|
+
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
|
13
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
14
|
+
watch('config/routes.rb') { "spec/routing" }
|
15
|
+
watch('app/controllers/application_controller.rb') { "spec/controllers" }
|
16
|
+
# Capybara request specs
|
17
|
+
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
|
18
|
+
end
|
19
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 ayaya
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# Homura
|
2
|
+
|
3
|
+
Homura is a simple layout generator and helpers for rails.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'homura'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install homura
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
### Base Layout
|
22
|
+
|
23
|
+
Run this to generate a base layout:
|
24
|
+
|
25
|
+
$ rails generate homura:install
|
26
|
+
|
27
|
+
### Layout Helpers
|
28
|
+
|
29
|
+
Providing these helpers:
|
30
|
+
|
31
|
+
page_title
|
32
|
+
page_description
|
33
|
+
canonical_link
|
34
|
+
og_properties
|
35
|
+
|
36
|
+
### Locale Detection
|
37
|
+
|
38
|
+
In application controller:
|
39
|
+
|
40
|
+
include Homura::SetLocale
|
41
|
+
|
42
|
+
Your app will set locale via params/cookies/http-accept-language before any
|
43
|
+
requests.
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
1. Fork it
|
48
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
|
+
3. Commit your changes (`git commit -am 'Added some feature'`)
|
50
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
module Homura
|
2
|
+
module LayoutHelper
|
3
|
+
def controller_action_full_name
|
4
|
+
[params[:controller], params[:action]].join('#')
|
5
|
+
end
|
6
|
+
|
7
|
+
def page_classes
|
8
|
+
[params[:controller].gsub('/', '_'), params[:action]].join(' ')
|
9
|
+
end
|
10
|
+
|
11
|
+
def page_title(text = nil)
|
12
|
+
if text.present?
|
13
|
+
@page_title = text
|
14
|
+
og_properties title: text
|
15
|
+
else
|
16
|
+
@page_title
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def page_title_tag
|
21
|
+
if @page_title.blank?
|
22
|
+
@page_title = controller_action_full_name
|
23
|
+
logger.warn "in #{controller_action_full_name}:"
|
24
|
+
logger.warn 'No page title specified, please use `page_title` helper.'
|
25
|
+
end
|
26
|
+
content_tag(:title, t('homura.layout.title', title: @page_title))
|
27
|
+
end
|
28
|
+
|
29
|
+
def page_description(text = nil)
|
30
|
+
if text.present?
|
31
|
+
@page_description = text
|
32
|
+
og_properties description: text
|
33
|
+
else
|
34
|
+
@page_description
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def page_description_tag
|
39
|
+
if @page_description.blank?
|
40
|
+
logger.warn "in #{controller_action_full_name}:"
|
41
|
+
logger.warn 'No page description specified, please use `page_description` helper.'
|
42
|
+
return
|
43
|
+
else
|
44
|
+
tag(:meta, name: :description, content: @page_description)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Get/Set canonical link for the page.
|
49
|
+
#
|
50
|
+
# @raise will raise 'canonical link should be a full url' if not an url
|
51
|
+
def canonical_link(url = nil)
|
52
|
+
if url
|
53
|
+
if url !~ %r(^https?://)
|
54
|
+
raise 'canonical link should be a full url'
|
55
|
+
else
|
56
|
+
@canonical_link = url
|
57
|
+
end
|
58
|
+
else
|
59
|
+
@canonical_link
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def canonical_link_tag
|
64
|
+
if @canonical_link.blank?
|
65
|
+
logger.warn "in #{controller_action_full_name}:"
|
66
|
+
logger.warn 'No canonical link specified, please use `canonical_link` helper.'
|
67
|
+
return
|
68
|
+
else
|
69
|
+
tag(:link, rel: 'canonical_link', href: @canonical_link)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Set the Open Graph properties.
|
74
|
+
#
|
75
|
+
# Examples
|
76
|
+
#
|
77
|
+
# og_properties type: 'website',
|
78
|
+
# image: [image_path('hello.png'),
|
79
|
+
# image_path('world.png')]
|
80
|
+
#
|
81
|
+
# the page_title and page_description helpers are also set og properties,
|
82
|
+
# so you don't need to do that again.
|
83
|
+
def og_properties(properties = {})
|
84
|
+
@og_properties ||= {site_name: t('homura.layout.site_name')}
|
85
|
+
@og_properties = @og_properties.merge(properties)
|
86
|
+
end
|
87
|
+
|
88
|
+
def og_properties_tags
|
89
|
+
og_properties.map { |property, content|
|
90
|
+
case content
|
91
|
+
when Array
|
92
|
+
content.map { |item|
|
93
|
+
tag(:meta, property: "og:#{property}", content: item)
|
94
|
+
}.inject(&:+)
|
95
|
+
else
|
96
|
+
tag(:meta, property: "og:#{property}", content: content)
|
97
|
+
end
|
98
|
+
}.inject(&:+)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset='utf-8'
|
5
|
+
= page_title_tag
|
6
|
+
= page_description_tag
|
7
|
+
= canonical_link_tag
|
8
|
+
= og_properties_tags
|
9
|
+
= csrf_meta_tags
|
10
|
+
= stylesheet_link_tag 'application', media: :all
|
11
|
+
= yield(:extra_head)
|
12
|
+
body
|
13
|
+
= content_for?(:content) ? yield(:content) : yield
|
14
|
+
= javascript_include_tag 'application'
|
15
|
+
= yield(:extra_javascripts)
|
data/homura.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/homura/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ['ayaya']
|
6
|
+
gem.email = ['ayaya@ayaya.tw']
|
7
|
+
gem.description = %q{Homura is a simple layout generator and helpers for rails}
|
8
|
+
gem.summary = %q{Homura is a simple layout generator and helpers for rails}
|
9
|
+
gem.homepage = 'https://github.com/ayamomiji/homura'
|
10
|
+
|
11
|
+
gem.files = `git ls-files`.split($\)
|
12
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
14
|
+
gem.name = 'homura'
|
15
|
+
gem.require_paths = ['lib']
|
16
|
+
gem.version = Homura::VERSION
|
17
|
+
|
18
|
+
gem.add_dependency 'rails', '>= 3'
|
19
|
+
gem.add_dependency 'slim-rails'
|
20
|
+
|
21
|
+
gem.add_development_dependency 'rspec', '>= 2'
|
22
|
+
gem.add_development_dependency 'rspec-rails', '>= 2'
|
23
|
+
gem.add_development_dependency 'guard-rspec'
|
24
|
+
gem.add_development_dependency 'capybara'
|
25
|
+
gem.add_development_dependency 'sqlite3'
|
26
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Homura
|
2
|
+
class InstallGenerator < Rails::Generators::Base
|
3
|
+
source_root File.expand_path('../templates', __FILE__)
|
4
|
+
|
5
|
+
def copy_locale_file
|
6
|
+
copy_file 'layout.en.yml', 'config/locales/layout.en.yml'
|
7
|
+
end
|
8
|
+
|
9
|
+
def copy_layout_file
|
10
|
+
copy_file 'application.html.slim',
|
11
|
+
'app/views/layouts/application.html.slim'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset='utf-8'
|
5
|
+
= page_title_tag
|
6
|
+
= page_description_tag
|
7
|
+
= canonical_link_tag
|
8
|
+
= og_properties_tags
|
9
|
+
= csrf_meta_tags
|
10
|
+
= stylesheet_link_tag 'application', media: :all
|
11
|
+
= yield(:extra_head)
|
12
|
+
body
|
13
|
+
= content_for?(:content) ? yield(:content) : yield
|
14
|
+
= javascript_include_tag 'application'
|
15
|
+
= yield(:extra_javascripts)
|
@@ -0,0 +1,15 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset='utf-8'
|
5
|
+
= page_title_tag
|
6
|
+
= page_description_tag
|
7
|
+
= canonical_link_tag
|
8
|
+
= og_properties_tags
|
9
|
+
= csrf_meta_tags
|
10
|
+
= stylesheet_link_tag 'application', media: :all
|
11
|
+
= yield(:extra_head)
|
12
|
+
body
|
13
|
+
= content_for?(:content) ? yield(:content) : yield
|
14
|
+
= javascript_include_tag 'application'
|
15
|
+
= yield(:extra_javascripts)
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Homura
|
2
|
+
module SetLocale
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
before_filter :set_locale
|
7
|
+
end
|
8
|
+
|
9
|
+
def available_locales
|
10
|
+
@available_locales ||= I18n.available_locales.map(&:to_s)
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_locale
|
14
|
+
if params['locale'] && available_locales.include?(params['locale'])
|
15
|
+
cookies.permanent['locale'] = locale
|
16
|
+
I18n.locale = locale and return
|
17
|
+
end
|
18
|
+
|
19
|
+
if cookies['locale'] && available_locales.include?(locale)
|
20
|
+
I18n.locale = locale and return
|
21
|
+
end
|
22
|
+
|
23
|
+
http_accept_language = request.headers['HTTP_ACCEPT_LANGUAGE'] || ''
|
24
|
+
preferred_locales = http_accept_language.split(',').map { |l|
|
25
|
+
l.split(';').first
|
26
|
+
}
|
27
|
+
I18n.locale = preferred_locales.find { |l|
|
28
|
+
available_locales.include?(l)
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/homura.rb
ADDED
data/spec/dummy/Rakefile
ADDED
@@ -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,15 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
meta charset='utf-8'
|
5
|
+
= page_title_tag
|
6
|
+
= page_description_tag
|
7
|
+
= canonical_link_tag
|
8
|
+
= og_properties_tags
|
9
|
+
= csrf_meta_tags
|
10
|
+
= stylesheet_link_tag 'application', media: :all
|
11
|
+
= yield(:extra_head)
|
12
|
+
body
|
13
|
+
= content_for?(:content) ? yield(:content) : yield
|
14
|
+
= javascript_include_tag 'application'
|
15
|
+
= yield(:extra_javascripts)
|
@@ -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
|
+
Bundler.require
|
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,22 @@
|
|
1
|
+
# SQLite version 3.x
|
2
|
+
# gem install sqlite3
|
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
|