high_voltage 1.0.0 → 2.0.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 +7 -0
- data/.gitignore +9 -0
- data/.travis.yml +8 -0
- data/Appraisals +16 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +80 -0
- data/MIT-LICENSE +1 -1
- data/NEWS.md +23 -0
- data/README.md +213 -60
- data/Rakefile +19 -0
- data/app/controllers/concerns/high_voltage/static_page.rb +41 -0
- data/app/controllers/high_voltage/pages_controller.rb +1 -26
- data/config/routes.rb +3 -1
- data/high_voltage.gemspec +24 -0
- data/lib/high_voltage/constraints/root_route.rb +22 -0
- data/lib/high_voltage/engine.rb +9 -2
- data/lib/high_voltage/page_finder.rb +37 -0
- data/lib/high_voltage/route_drawers/default.rb +15 -0
- data/lib/high_voltage/route_drawers/root.rb +16 -0
- data/lib/high_voltage/version.rb +3 -0
- data/lib/high_voltage.rb +29 -0
- data/spec/constraints/root_route_spec.rb +25 -0
- data/spec/controllers/action_caching_controller_spec.rb +23 -0
- data/spec/controllers/alternative_finder_controller_spec.rb +12 -0
- data/spec/controllers/page_caching_controller_spec.rb +20 -0
- data/spec/controllers/pages_controller_spec.rb +128 -0
- data/spec/controllers/subclassed_pages_controller_spec.rb +40 -0
- data/spec/dummy/Rakefile +7 -0
- data/spec/dummy/app/controllers/alternative_finder_controller.rb +14 -0
- data/spec/dummy/app/controllers/application_controller.rb +3 -0
- data/spec/dummy/app/controllers/subclassed_pages_controller.rb +3 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/alternate.html.erb +14 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/app/views/other/wrong.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_dir/also_nested.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_exists.html.erb +1 -0
- data/spec/dummy/app/views/other_pages/also_exists_but_references_nonexistent_partial.html.erb +2 -0
- data/spec/dummy/app/views/pages/also_dir/also_nested.html.erb +1 -0
- data/spec/dummy/app/views/pages/also_exists.html.erb +1 -0
- data/spec/dummy/app/views/pages/also_exists_but_references_nonexistent_partial.html.erb +2 -0
- data/spec/dummy/app/views/pages/dir/nested.html.erb +1 -0
- data/spec/dummy/app/views/pages/exists.html.erb +1 -0
- data/spec/dummy/app/views/pages/exists_but_references_nonexistent_partial.html.erb +2 -0
- data/spec/dummy/app/views/pages/rot13.html.erb +1 -0
- data/spec/dummy/config/application.rb +43 -0
- data/spec/dummy/config/boot.rb +10 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +25 -0
- data/spec/dummy/config/environments/production.rb +49 -0
- data/spec/dummy/config/environments/test.rb +29 -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_key_base.rb +1 -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 +4 -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 +191 -0
- data/spec/dummy/public/stylesheets/.gitkeep +0 -0
- data/spec/dummy/script/rails +6 -0
- data/spec/high_voltage/page_finder_spec.rb +52 -0
- data/spec/high_voltage_spec.rb +11 -0
- data/spec/integration/navigation_spec.rb +9 -0
- data/spec/minimal_spec_helper.rb +5 -0
- data/spec/routing/routes_spec.rb +142 -0
- data/spec/spec_helper.rb +19 -0
- data/spec/support/caching.rb +12 -0
- data/spec/support/concern_reload.rb +11 -0
- metadata +236 -42
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module HighVoltage
|
|
2
|
+
module Constraints
|
|
3
|
+
# Routing constraint to validate request.path has a corresponding view
|
|
4
|
+
class RootRoute
|
|
5
|
+
def self.matches?(request)
|
|
6
|
+
pattern = file_pattern(request.path)
|
|
7
|
+
|
|
8
|
+
Dir.glob(pattern).any?
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
private
|
|
12
|
+
|
|
13
|
+
def self.file_pattern(page_id)
|
|
14
|
+
"#{content_path}#{page_id}.html*"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def self.content_path
|
|
18
|
+
Rails.root.join('app', 'views', HighVoltage.content_path).to_s
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
data/lib/high_voltage/engine.rb
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
module HighVoltage
|
|
2
|
-
|
|
3
2
|
class Engine < Rails::Engine
|
|
4
|
-
|
|
3
|
+
initializer 'Require concerns path' do |app|
|
|
4
|
+
concerns_path = 'app/controllers/concerns'
|
|
5
5
|
|
|
6
|
+
unless app.paths.keys.include?(concerns_path)
|
|
7
|
+
app.paths.add(concerns_path)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
require 'concerns/high_voltage/static_page'
|
|
11
|
+
end
|
|
12
|
+
end
|
|
6
13
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
module HighVoltage
|
|
2
|
+
# A command for finding pages by id. This encapsulates the concepts of
|
|
3
|
+
# mapping page names to file names.
|
|
4
|
+
class PageFinder
|
|
5
|
+
VALID_CHARACTERS = "a-zA-Z0-9~!@$%^&*()#`_+-=<>\"{}|[];',?".freeze
|
|
6
|
+
|
|
7
|
+
def initialize(page_id)
|
|
8
|
+
@page_id = page_id
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
# Produce a template path to the page, in a format understood by
|
|
12
|
+
# `render :template => find`
|
|
13
|
+
def find
|
|
14
|
+
"#{content_path}#{clean_path}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def content_path
|
|
18
|
+
HighVoltage.content_path
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
protected
|
|
22
|
+
|
|
23
|
+
# The raw page id passed in by the user
|
|
24
|
+
attr_reader :page_id
|
|
25
|
+
|
|
26
|
+
private
|
|
27
|
+
|
|
28
|
+
def clean_path
|
|
29
|
+
path = Pathname.new("/#{clean_id}")
|
|
30
|
+
path.cleanpath.to_s[1..-1]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def clean_id
|
|
34
|
+
@page_id.tr("^#{VALID_CHARACTERS}", '')
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module HighVoltage
|
|
2
|
+
module RouteDrawers
|
|
3
|
+
# Matches routes in the HighVoltage.content_path directory. By default this looks
|
|
4
|
+
# for /pages/id. e.g. http://www.example.com/pages/about_us
|
|
5
|
+
class Default
|
|
6
|
+
def self.match_attributes
|
|
7
|
+
{
|
|
8
|
+
"/#{HighVoltage.content_path}*id" => 'high_voltage/pages#show',
|
|
9
|
+
:as => :page,
|
|
10
|
+
:format => false
|
|
11
|
+
}
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module HighVoltage
|
|
2
|
+
module RouteDrawers
|
|
3
|
+
# Matches routes from root of the domain e.g. http://www.example.com/about_us
|
|
4
|
+
# Uses HighVoltage::Constraints::RootRoute to validate view exists.
|
|
5
|
+
class Root
|
|
6
|
+
def self.match_attributes
|
|
7
|
+
{
|
|
8
|
+
"/*id" => 'high_voltage/pages#show',
|
|
9
|
+
:as => :page,
|
|
10
|
+
:format => false,
|
|
11
|
+
:constraints => HighVoltage::Constraints::RootRoute
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
data/lib/high_voltage.rb
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
+
require 'high_voltage/version'
|
|
2
|
+
require 'high_voltage/constraints/root_route'
|
|
3
|
+
require 'high_voltage/page_finder'
|
|
4
|
+
require 'high_voltage/route_drawers/default'
|
|
5
|
+
require 'high_voltage/route_drawers/root'
|
|
6
|
+
require 'active_support/core_ext/module/attribute_accessors'
|
|
7
|
+
|
|
1
8
|
module HighVoltage
|
|
9
|
+
mattr_accessor :layout
|
|
10
|
+
@@layout = 'application'
|
|
11
|
+
|
|
12
|
+
mattr_accessor :content_path
|
|
13
|
+
@@content_path = 'pages/'
|
|
14
|
+
|
|
15
|
+
mattr_accessor :route_drawer
|
|
16
|
+
@@route_drawer = HighVoltage::RouteDrawers::Default
|
|
17
|
+
|
|
18
|
+
mattr_accessor :routes
|
|
19
|
+
@@routes = true
|
|
20
|
+
|
|
21
|
+
mattr_accessor :action_caching
|
|
22
|
+
@@action_caching = false
|
|
23
|
+
|
|
24
|
+
mattr_accessor :page_caching
|
|
25
|
+
@@page_caching = false
|
|
26
|
+
|
|
27
|
+
def self.setup
|
|
28
|
+
yield self
|
|
29
|
+
end
|
|
30
|
+
|
|
2
31
|
require 'high_voltage/engine' if defined?(Rails)
|
|
3
32
|
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe HighVoltage::Constraints::RootRoute, '.matches?' do
|
|
4
|
+
context 'view file exists' do
|
|
5
|
+
it 'should return true' do
|
|
6
|
+
request = double(path: 'index')
|
|
7
|
+
Dir.stub(:glob).and_return(['about.html.erb'])
|
|
8
|
+
|
|
9
|
+
result = HighVoltage::Constraints::RootRoute.matches?(request)
|
|
10
|
+
|
|
11
|
+
expect(result).to be_true
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context 'view file does not exist' do
|
|
16
|
+
it 'should return false' do
|
|
17
|
+
request = double(path: 'index')
|
|
18
|
+
File.stub(:glob).and_return([])
|
|
19
|
+
|
|
20
|
+
result = HighVoltage::Constraints::RootRoute.matches?(request)
|
|
21
|
+
|
|
22
|
+
expect(result).to be_false
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe HighVoltage::PagesController, 'action_caching' do
|
|
4
|
+
it 'caches the action when action_caching is set to true', enable_caching: true do
|
|
5
|
+
expect do
|
|
6
|
+
HighVoltage.action_caching = true
|
|
7
|
+
concern_reload
|
|
8
|
+
get :show, id: :exists
|
|
9
|
+
end.to change { action_was_cached(:exists) }
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'does not cache the action when action_caching is set to false', enable_caching: true do
|
|
13
|
+
expect do
|
|
14
|
+
HighVoltage.action_caching = false
|
|
15
|
+
concern_reload
|
|
16
|
+
get :show, id: :exists
|
|
17
|
+
end.to_not change { action_was_cached(:exists) }
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def action_was_cached(page)
|
|
21
|
+
ActionController::Base.cache_store.exist?("views/test.host#{page_path(page)}")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe AlternativeFinderController do
|
|
4
|
+
render_views
|
|
5
|
+
|
|
6
|
+
it 'renders the file from the alternative directory' do
|
|
7
|
+
get :show, :id => 'ebg13'
|
|
8
|
+
|
|
9
|
+
response.should be_success
|
|
10
|
+
response.should render_template('rot13')
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe HighVoltage::PagesController, 'action_caching' do
|
|
4
|
+
it 'caches the page when page_caching is set to true', enable_caching: true do
|
|
5
|
+
controller.should_receive(:cache_page).at_least(:once)
|
|
6
|
+
|
|
7
|
+
HighVoltage.page_caching = true
|
|
8
|
+
concern_reload
|
|
9
|
+
get :show, id: :exists
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'does not cache the page when page_caching is set to false', enable_caching: true do
|
|
13
|
+
controller.should_receive(:cache_page).never
|
|
14
|
+
|
|
15
|
+
HighVoltage.page_caching = false
|
|
16
|
+
concern_reload
|
|
17
|
+
get :show, id: :exists
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
|
|
4
|
+
describe HighVoltage::PagesController do
|
|
5
|
+
render_views
|
|
6
|
+
|
|
7
|
+
context 'using default configuration' do
|
|
8
|
+
describe 'on GET to /pages/exists' do
|
|
9
|
+
before { get :show, :id => 'exists' }
|
|
10
|
+
|
|
11
|
+
it 'should respond with success and render template' do
|
|
12
|
+
response.should be_success
|
|
13
|
+
response.should render_template('exists')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
it 'should use the default layout used by ApplicationController' do
|
|
17
|
+
response.should render_template('layouts/application')
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
describe 'on GET to /pages/dir/nested' do
|
|
22
|
+
before { get :show, :id => 'dir/nested' }
|
|
23
|
+
|
|
24
|
+
it 'should respond with success and render template' do
|
|
25
|
+
response.should be_success
|
|
26
|
+
response.should render_template('pages/dir/nested')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'should raise a routing error for an invalid page' do
|
|
31
|
+
lambda {
|
|
32
|
+
get :show,
|
|
33
|
+
:id => 'invalid'
|
|
34
|
+
}.should raise_error(ActionController::RoutingError)
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should raise a routing error for a page in another directory' do
|
|
38
|
+
lambda {
|
|
39
|
+
get :show,
|
|
40
|
+
:id => '../other/wrong'
|
|
41
|
+
}.should raise_error(ActionController::RoutingError)
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
it 'should raise missing template error for valid page with invalid partial' do
|
|
45
|
+
lambda {
|
|
46
|
+
get :show,
|
|
47
|
+
:id => 'exists_but_references_nonexistent_partial'
|
|
48
|
+
}.should raise_error(ActionView::MissingTemplate)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
context 'using custom layout' do
|
|
53
|
+
before(:all) do
|
|
54
|
+
@original_layout = HighVoltage.layout
|
|
55
|
+
HighVoltage.layout = 'alternate'
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
after(:all) do
|
|
59
|
+
HighVoltage.layout = @original_layout
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
describe 'on GET to /pages/exists' do
|
|
63
|
+
before { get :show, :id => 'exists' }
|
|
64
|
+
|
|
65
|
+
it 'should use the custom configured layout' do
|
|
66
|
+
response.should_not render_template('layouts/application')
|
|
67
|
+
response.should render_template('layouts/alternate')
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
context 'using custom content path' do
|
|
73
|
+
before(:all) do
|
|
74
|
+
@original_content_path = HighVoltage.content_path
|
|
75
|
+
HighVoltage.content_path = 'other_pages/'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
after(:all) do
|
|
79
|
+
HighVoltage.content_path = @original_content_path
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe 'on GET to /other_pages/also_exists' do
|
|
83
|
+
before { get :show, :id => 'also_exists' }
|
|
84
|
+
|
|
85
|
+
it 'should respond with success and render template' do
|
|
86
|
+
response.should be_success
|
|
87
|
+
response.should render_template('other_pages/also_exists')
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
describe 'on GET to /other_pages/also_dir/nested' do
|
|
92
|
+
before { get :show, :id => 'also_dir/also_nested' }
|
|
93
|
+
|
|
94
|
+
it 'should respond with success and render template' do
|
|
95
|
+
response.should be_success
|
|
96
|
+
response.should render_template('other_pages/also_dir/also_nested')
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it 'should raise a routing error for an invalid page' do
|
|
101
|
+
lambda {
|
|
102
|
+
get :show,
|
|
103
|
+
:id => 'also_invalid'
|
|
104
|
+
}.should raise_error(ActionController::RoutingError)
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it 'should raise a routing error for a page in another directory' do
|
|
108
|
+
lambda {
|
|
109
|
+
get :show,
|
|
110
|
+
:id => '../other/wrong'
|
|
111
|
+
}.should raise_error(ActionController::RoutingError)
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
it 'should raise a routing error for a page in another directory when using a Unicode exploit' do
|
|
115
|
+
lambda {
|
|
116
|
+
get :show,
|
|
117
|
+
:id => '/\\../other/wrong'
|
|
118
|
+
}.should raise_error(ActionController::RoutingError)
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
it 'should raise missing template error for valid page with invalid partial' do
|
|
122
|
+
lambda {
|
|
123
|
+
get :show,
|
|
124
|
+
:id => 'also_exists_but_references_nonexistent_partial'
|
|
125
|
+
}.should raise_error(ActionView::MissingTemplate)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe SubclassedPagesController do
|
|
4
|
+
render_views
|
|
5
|
+
|
|
6
|
+
describe 'on GET to /subclassed_pages/also_exists' do
|
|
7
|
+
before { get :show, :id => 'also_exists' }
|
|
8
|
+
|
|
9
|
+
it 'should respond with success and render template' do
|
|
10
|
+
response.should be_success
|
|
11
|
+
response.should render_template('also_exists')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
it 'should use the custom configured layout' do
|
|
15
|
+
response.should_not render_template('layouts/application')
|
|
16
|
+
response.should render_template('layouts/alternate')
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
it 'should raise a routing error for an invalid page' do
|
|
21
|
+
lambda {
|
|
22
|
+
get :show,
|
|
23
|
+
:id => 'invalid'
|
|
24
|
+
}.should raise_error(ActionController::RoutingError)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it 'should raise a routing error for a page in another directory' do
|
|
28
|
+
lambda {
|
|
29
|
+
get :show,
|
|
30
|
+
:id => '../other/wrong'
|
|
31
|
+
}.should raise_error(ActionController::RoutingError)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
it 'should raise missing template error for valid page with invalid partial' do
|
|
35
|
+
lambda {
|
|
36
|
+
get :show,
|
|
37
|
+
:id => 'also_exists_but_references_nonexistent_partial'
|
|
38
|
+
}.should raise_error(ActionView::MissingTemplate)
|
|
39
|
+
end
|
|
40
|
+
end
|
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,14 @@
|
|
|
1
|
+
class AlternativeFinderController < HighVoltage::PagesController
|
|
2
|
+
private
|
|
3
|
+
|
|
4
|
+
def page_finder_factory
|
|
5
|
+
Rot13PageFinder
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
class Rot13PageFinder < HighVoltage::PageFinder
|
|
9
|
+
def find
|
|
10
|
+
paths = super.split('/')
|
|
11
|
+
"#{paths[0..-2].join('/')}/#{paths[-1].tr('a-z','n-za-m')}"
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
cant get here from pages
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %> from a nested dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %> from a nested dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %> from a nested dir
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
hello <%= 'world' %>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
alternative
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
require File.expand_path('../boot', __FILE__)
|
|
2
|
+
|
|
3
|
+
require "active_model/railtie"
|
|
4
|
+
require "action_controller/railtie"
|
|
5
|
+
require "action_view/railtie"
|
|
6
|
+
|
|
7
|
+
Bundler.require
|
|
8
|
+
require "high_voltage"
|
|
9
|
+
|
|
10
|
+
module Dummy
|
|
11
|
+
class Application < Rails::Application
|
|
12
|
+
# Settings in config/environments/* take precedence over those specified here.
|
|
13
|
+
# Application configuration should go into files in config/initializers
|
|
14
|
+
# -- all .rb files in that directory are automatically loaded.
|
|
15
|
+
|
|
16
|
+
# Custom directories with classes and modules you want to be autoloadable.
|
|
17
|
+
# config.autoload_paths += %W(#{config.root}/extras)
|
|
18
|
+
|
|
19
|
+
# Only load the plugins named here, in the order given (default is alphabetical).
|
|
20
|
+
# :all can be used as a placeholder for all plugins not explicitly named.
|
|
21
|
+
# config.plugins = [ :exception_notification, :ssl_requirement, :all ]
|
|
22
|
+
|
|
23
|
+
# Activate observers that should always be running.
|
|
24
|
+
# config.active_record.observers = :cacher, :garbage_collector, :forum_observer
|
|
25
|
+
|
|
26
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
|
27
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
|
28
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
|
29
|
+
|
|
30
|
+
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
|
31
|
+
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
|
32
|
+
# config.i18n.default_locale = :de
|
|
33
|
+
|
|
34
|
+
# JavaScript files you want as :defaults (application.js is always included).
|
|
35
|
+
# config.action_view.javascript_expansions[:defaults] = %w(jquery rails)
|
|
36
|
+
|
|
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
|
+
end
|
|
43
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
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_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
|
+
# Only use best-standards-support built into browsers
|
|
23
|
+
config.action_dispatch.best_standards_support = :builtin
|
|
24
|
+
end
|
|
25
|
+
|
|
@@ -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
|