radiant 0.6.2 → 0.6.3
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of radiant might be problematic. Click here for more details.
- data/CHANGELOG +37 -0
- data/CONTRIBUTORS +9 -0
- data/app/controllers/admin/page_controller.rb +3 -2
- data/app/controllers/admin/user_controller.rb +2 -2
- data/app/controllers/admin/welcome_controller.rb +3 -3
- data/app/controllers/application.rb +9 -1
- data/app/helpers/admin/abstract_model_helper.rb +2 -0
- data/app/helpers/admin/page_helper.rb +4 -0
- data/app/helpers/application_helper.rb +4 -6
- data/app/models/page.rb +4 -1
- data/app/models/response_cache.rb +10 -7
- data/app/models/standard_tags.rb +7 -5
- data/app/views/admin/layout/index.rhtml +1 -1
- data/app/views/admin/layout/remove.rhtml +1 -1
- data/app/views/admin/page/_node.rhtml +4 -4
- data/app/views/admin/snippet/index.rhtml +1 -1
- data/app/views/admin/user/index.rhtml +1 -1
- data/app/views/layouts/application.rhtml +4 -4
- data/config/environment.rb +77 -70
- data/config/environments/test.rb +9 -2
- data/db/migrate/016_add_sessions.rb +16 -0
- data/db/schema.rb +10 -1
- data/lib/generators/extension/templates/tasks.rake +13 -2
- data/lib/generators/extension/templates/test_helper.rb +3 -2
- data/lib/login_system.rb +19 -4
- data/lib/plugins/extension_patches/init.rb +1 -1
- data/lib/plugins/extension_patches/lib/fixture_loading_extension.rb +32 -33
- data/lib/radiant.rb +1 -1
- data/lib/radiant/extension.rb +14 -0
- data/lib/radiant/extension_loader.rb +135 -106
- data/lib/radiant/initializer.rb +2 -0
- data/lib/tasks/extensions.rake +16 -1
- data/public/javascripts/prototype.js +305 -175
- data/public/javascripts/sitemap.js +1 -1
- data/public/stylesheets/admin/main.css +5 -2
- data/test/fixtures/extensions/01_basic/vendor/plugins/multiple/init.rb +1 -0
- data/test/fixtures/extensions/01_basic/vendor/plugins/multiple/lib/multiple.rb +2 -0
- data/test/fixtures/extensions/01_basic/vendor/plugins/plugin_normal/init.rb +1 -0
- data/test/fixtures/extensions/01_basic/vendor/plugins/plugin_normal/lib/normal_plugin.rb +2 -0
- data/test/fixtures/extensions/02_overriding/overriding_extension.rb +1 -1
- data/test/fixtures/extensions/02_overriding/vendor/plugins/multiple/init.rb +1 -0
- data/test/fixtures/extensions/02_overriding/vendor/plugins/multiple/lib/multiple.rb +2 -0
- data/test/fixtures/extensions/load_order_blue/load_order_blue_extension.rb +11 -0
- data/test/fixtures/extensions/load_order_green/load_order_green_extension.rb +11 -0
- data/test/fixtures/extensions/load_order_red/load_order_red_extension.rb +11 -0
- data/test/fixtures/pages.yml +16 -1
- data/test/functional/admin/abstract_model_controller_test.rb +2 -2
- data/test/functional/admin/export_controller_test.rb +2 -1
- data/test/functional/admin/extension_controller_test.rb +2 -1
- data/test/functional/admin/layout_controller_test.rb +6 -4
- data/test/functional/admin/page_controller_test.rb +48 -22
- data/test/functional/admin/user_controller_test.rb +12 -9
- data/test/functional/admin/welcome_controller_test.rb +4 -4
- data/test/functional/application_controller_test.rb +3 -2
- data/test/functional/extension_initialization_test.rb +31 -5
- data/test/functional/extension_load_order_test.rb +49 -0
- data/test/functional/login_system_test.rb +21 -11
- data/test/helpers/difference_test_helper.rb +13 -0
- data/test/helpers/extension_tag_test_helper.rb +3 -3
- data/test/helpers/login_test_helper.rb +12 -0
- data/test/helpers/page_test_helper.rb +4 -1
- data/test/unit/page_test.rb +5 -0
- data/test/unit/response_cache_test.rb +27 -6
- data/test/unit/standard_tags_test.rb +6 -3
- metadata +1789 -1767
data/CHANGELOG
CHANGED
@@ -1,5 +1,42 @@
|
|
1
1
|
== Change Log
|
2
2
|
|
3
|
+
=== 0.6.3 Rock Grinder
|
4
|
+
* Add generic public/ copy task to generated extensions. [Sean Cribbs]
|
5
|
+
* Fix typo in StandardTags. [oli]
|
6
|
+
* Added db:remigrate:extensions task. [Sean Cribbs]
|
7
|
+
* Show all child pages on remove confirmation, regardless of sitemap expansion. [Sean Cribbs]
|
8
|
+
* Make LoginSystem store user ids in session rather than whole user objects. [Sean Cribbs]
|
9
|
+
* Plugins included in an extension's vendor/plugins directory will automatically
|
10
|
+
be loaded before the extension is activated. Plugins included in more than one extension
|
11
|
+
will be loaded only once according to the extension load order. [Sean Cribbs]
|
12
|
+
* Allow subclassing of FileNotFoundPage. [Daniel Sheppard]
|
13
|
+
* <r:find/> should not return FileNotFoundPage. [Daniel Sheppard]
|
14
|
+
* Change test for tabs to just check dupes and for the requested tab
|
15
|
+
rather than a specific list (test was breaking if a real extension added
|
16
|
+
a tab). [Daniel Sheppard]
|
17
|
+
* Ensure test extensions are loaded in the test environment. [Daniel Sheppard]
|
18
|
+
* Prevent ExtensionInitializationTest from unloading real extensions. [Daniel Sheppard]
|
19
|
+
* Expire the old URL from the cache when the page slug changes. [Daniel Sheppard]
|
20
|
+
* Fix failing tests in instance mode. [Daniel Sheppard]
|
21
|
+
* Move difference assertions upstream from forms extension into a test helper. [Sean Cribbs]
|
22
|
+
* Update Prototype to 1.5.0 final release. [Sean Cribbs]
|
23
|
+
* Allow specification of extension loading order in environment.rb [Daniel Sheppard]
|
24
|
+
* Fix bugs in assert_global_tag_defined and assert_tag_defined of
|
25
|
+
ExtensionTagTestHelper. [Sean Cribbs]
|
26
|
+
* Make sure included stylesheets and javascripts are only linked to once in
|
27
|
+
<head>. [Sean Cribbs]
|
28
|
+
* Fix navigation tag tests. [vitali]
|
29
|
+
* Suppress errors about missing default helper by providing a blank helper.
|
30
|
+
[Sean Cribbs]
|
31
|
+
* Fix mis-alignment of "Clear cache" button when homepage not present.
|
32
|
+
[Sean Cribbs]
|
33
|
+
* Fix issues with misnesting of modules in fixture loading extension and
|
34
|
+
test suites running randomly from dispatchers. [Sean Cribbs]
|
35
|
+
* Remove invalid image alignment. [tolbrino]
|
36
|
+
* Display not_found.rhtml on standard 'not found'-like exceptions. [Sean Cribbs]
|
37
|
+
* Make sitemap.js use relative URLs. [Earl Chew]
|
38
|
+
* Preliminary support for active_record sessions. [John Long]
|
39
|
+
|
3
40
|
=== 0.6.2 Jewel Carver (June 23, 2007)
|
4
41
|
* Removed some of the database specific code from the ArchiveFinder [Daniel
|
5
42
|
Sheppard]
|
data/CONTRIBUTORS
CHANGED
@@ -4,6 +4,15 @@
|
|
4
4
|
The following people have submitted changes which have been applied to the
|
5
5
|
core:
|
6
6
|
|
7
|
+
=== 0.6.3 Rock Grinder
|
8
|
+
* oli
|
9
|
+
* Daniel Sheppard
|
10
|
+
* vitali
|
11
|
+
* tolbrino
|
12
|
+
* Sean Cribbs
|
13
|
+
* Earl Chew
|
14
|
+
* John Long
|
15
|
+
|
7
16
|
=== 0.6.2 Jewel Carver
|
8
17
|
* Sean Cribbs
|
9
18
|
* Daniel Sheppard
|
@@ -22,6 +22,7 @@ class Admin::PageController < Admin::AbstractModelController
|
|
22
22
|
|
23
23
|
def edit
|
24
24
|
@page = Page.find(params[:id])
|
25
|
+
@old_page_url = @page.url
|
25
26
|
handle_new_or_edit_post
|
26
27
|
end
|
27
28
|
|
@@ -116,6 +117,6 @@ class Admin::PageController < Admin::AbstractModelController
|
|
116
117
|
end
|
117
118
|
|
118
119
|
def clear_model_cache
|
119
|
-
@cache.expire_response(@page.url)
|
120
|
+
@cache.expire_response(@old_page_url || @page.url)
|
120
121
|
end
|
121
|
-
end
|
122
|
+
end
|
@@ -6,7 +6,7 @@ class Admin::UserController < Admin::AbstractModelController
|
|
6
6
|
:denied_message => 'You must have administrative privileges to perform this action.'
|
7
7
|
|
8
8
|
def preferences
|
9
|
-
@user =
|
9
|
+
@user = current_user
|
10
10
|
if valid_params?
|
11
11
|
handle_new_or_edit_post(
|
12
12
|
:redirect_to => page_index_url,
|
@@ -18,7 +18,7 @@ class Admin::UserController < Admin::AbstractModelController
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def remove
|
21
|
-
if
|
21
|
+
if current_user.id.to_s == params[:id].to_s
|
22
22
|
announce_cannot_delete_self
|
23
23
|
redirect_to user_index_url
|
24
24
|
else
|
@@ -9,8 +9,8 @@ class Admin::WelcomeController < ApplicationController
|
|
9
9
|
if request.post?
|
10
10
|
login = params[:user][:login]
|
11
11
|
password = params[:user][:password]
|
12
|
-
|
13
|
-
if
|
12
|
+
self.current_user = User.authenticate(login, password)
|
13
|
+
if current_user
|
14
14
|
redirect_to welcome_url
|
15
15
|
else
|
16
16
|
announce_invalid_user
|
@@ -19,7 +19,7 @@ class Admin::WelcomeController < ApplicationController
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def logout
|
22
|
-
|
22
|
+
self.current_user = nil
|
23
23
|
announce_logged_out
|
24
24
|
redirect_to login_url
|
25
25
|
end
|
@@ -28,10 +28,18 @@ class ApplicationController < ActionController::Base
|
|
28
28
|
@javascripts << script
|
29
29
|
end
|
30
30
|
|
31
|
+
def rescue_action_in_public(exception)
|
32
|
+
case exception
|
33
|
+
when ActiveRecord::RecordNotFound, ActionController::UnknownController, ActionController::UnknownAction, ActionController::Routing::RoutingError
|
34
|
+
render :template => "site/not_found", :status => 404
|
35
|
+
else
|
36
|
+
super
|
37
|
+
end
|
38
|
+
end
|
31
39
|
private
|
32
40
|
|
33
41
|
def set_current_user
|
34
|
-
UserActionObserver.current_user =
|
42
|
+
UserActionObserver.current_user = current_user
|
35
43
|
end
|
36
44
|
|
37
45
|
def set_javascripts_and_stylesheets
|
@@ -16,7 +16,7 @@ module ApplicationHelper
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def logged_in?
|
19
|
-
|
19
|
+
!current_user.nil?
|
20
20
|
end
|
21
21
|
|
22
22
|
def save_model_button(model)
|
@@ -49,7 +49,7 @@ module ApplicationHelper
|
|
49
49
|
def links_for_navigation
|
50
50
|
tabs = admin.tabs
|
51
51
|
links = tabs.map do |tab|
|
52
|
-
nav_link_to(tab.name, tab.url) if tab.shown_for?(
|
52
|
+
nav_link_to(tab.name, tab.url) if tab.shown_for?(current_user)
|
53
53
|
end.compact
|
54
54
|
links.join(separator)
|
55
55
|
end
|
@@ -83,13 +83,11 @@ module ApplicationHelper
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def admin?
|
86
|
-
|
87
|
-
user and user.admin?
|
86
|
+
current_user and current_user.admin?
|
88
87
|
end
|
89
88
|
|
90
89
|
def developer?
|
91
|
-
|
92
|
-
user and (user.developer? or user.admin?)
|
90
|
+
current_user and (current_user.developer? or current_user.admin?)
|
93
91
|
end
|
94
92
|
|
95
93
|
def focus(field_name)
|
data/app/models/page.rb
CHANGED
@@ -140,7 +140,10 @@ class Page < ActiveRecord::Base
|
|
140
140
|
found = child.find_by_url(url, live, clean)
|
141
141
|
return found if found
|
142
142
|
end
|
143
|
-
|
143
|
+
file_not_found_types = [FileNotFoundPage] + FileNotFoundPage.descendants
|
144
|
+
condition = (['class_name = ?']*file_not_found_types.length).join(' or ')
|
145
|
+
file_not_found_names = file_not_found_types.map {|x| x.name}.uniq
|
146
|
+
children.find(:first, :conditions => [condition]+file_not_found_names)
|
144
147
|
end
|
145
148
|
end
|
146
149
|
|
@@ -61,11 +61,13 @@ class ResponseCache
|
|
61
61
|
name = "#{page_cache_path(path)}.yml"
|
62
62
|
if File.exists?(name) and not File.directory?(name)
|
63
63
|
content = File.open(name,"rb") { |f| f.read }
|
64
|
-
metadata = YAML::load(content)
|
65
|
-
if(metadata['expires']
|
64
|
+
metadata = YAML::load(content)
|
65
|
+
if(metadata['expires'] >= Time.now)
|
66
66
|
return metadata
|
67
67
|
end
|
68
|
-
end
|
68
|
+
end
|
69
|
+
rescue
|
70
|
+
nil
|
69
71
|
end
|
70
72
|
def response_cached?(path)
|
71
73
|
!!read_metadata(path)
|
@@ -109,9 +111,9 @@ class ResponseCache
|
|
109
111
|
file_path = page_cache_path(path)
|
110
112
|
if metadata = read_metadata(path)
|
111
113
|
response.headers.merge!(metadata['headers'] || {})
|
112
|
-
|
114
|
+
if client_has_cache?(metadata, request)
|
113
115
|
response.headers.merge!('Status' => '304 Not Modified')
|
114
|
-
|
116
|
+
elsif use_x_sendfile
|
115
117
|
response.headers.merge!('X-Sendfile' => "#{file_path}.data")
|
116
118
|
else
|
117
119
|
response.body = File.open("#{file_path}.data", "rb") {|f| f.read}
|
@@ -165,9 +167,10 @@ class ResponseCache
|
|
165
167
|
|
166
168
|
path = page_cache_path(path)
|
167
169
|
benchmark "Cached page: #{path}" do
|
168
|
-
FileUtils.makedirs(File.dirname(path))
|
170
|
+
FileUtils.makedirs(File.dirname(path))
|
171
|
+
#dont want yml without data
|
172
|
+
File.open("#{path}.data", "wb+") { |f| f.write(content) }
|
169
173
|
File.open("#{path}.yml", "wb+") { |f| f.write(metadata) }
|
170
|
-
File.open("#{path}.data", "wb+") { |f| f.write(content) }
|
171
174
|
end
|
172
175
|
end
|
173
176
|
end
|
data/app/models/standard_tags.rb
CHANGED
@@ -409,8 +409,10 @@ module StandardTags
|
|
409
409
|
tag 'find' do |tag|
|
410
410
|
if url = tag.attr['url']
|
411
411
|
if found = Page.find_by_url(tag.attr['url'])
|
412
|
-
|
413
|
-
|
412
|
+
unless FileNotFoundPage === found
|
413
|
+
tag.locals.page = found
|
414
|
+
tag.expand
|
415
|
+
end
|
414
416
|
end
|
415
417
|
else
|
416
418
|
raise TagError.new("`find' tag must contain `url' attribute")
|
@@ -482,7 +484,7 @@ module StandardTags
|
|
482
484
|
* @selected@ specifies the state of the link when the current page matches
|
483
485
|
is a child of the specified url
|
484
486
|
|
485
|
-
The @between@ tag specifies what
|
487
|
+
The @between@ tag specifies what should be inserted in between each of the links.
|
486
488
|
|
487
489
|
*Usage:*
|
488
490
|
<pre><code><r:navigation urls="[Title: url | Title: url | ...]">
|
@@ -492,7 +494,7 @@ module StandardTags
|
|
492
494
|
<r:between> | </r:between>
|
493
495
|
</r:navigation>
|
494
496
|
</code></pre>
|
495
|
-
}
|
497
|
+
}
|
496
498
|
tag 'navigation' do |tag|
|
497
499
|
hash = tag.locals.navigation = {}
|
498
500
|
tag.expand
|
@@ -598,4 +600,4 @@ module StandardTags
|
|
598
600
|
return regexp
|
599
601
|
end
|
600
602
|
|
601
|
-
end
|
603
|
+
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<% for layout in @layouts -%>
|
17
17
|
<tr class="node level-1">
|
18
18
|
<td class="layout">
|
19
|
-
<%= image 'layout', :alt => 'layout-icon', :title => ''
|
19
|
+
<%= image 'layout', :alt => 'layout-icon', :title => '' %>
|
20
20
|
<%= link_to layout.name, layout_edit_url(:id => layout) %>
|
21
21
|
</td>
|
22
22
|
<td class="remove"><%= link_to image('remove', :alt => 'Remove Layout'), layout_remove_url(:id => layout) %></td>
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<tbody>
|
6
6
|
<tr class="node level-1" onmouseover="Element.addClassName(this, 'highlight');" onmouseout="Element.removeClassName(this, 'highlight');">
|
7
7
|
<td class="layout">
|
8
|
-
<%= image 'layout', :alt => 'layout-icon', :title => ''
|
8
|
+
<%= image 'layout', :alt => 'layout-icon', :title => '' %>
|
9
9
|
<%= @layout.name %>
|
10
10
|
</td>
|
11
11
|
</tr>
|
@@ -1,23 +1,23 @@
|
|
1
1
|
<%
|
2
2
|
count = page.children.count
|
3
3
|
children = count > 0
|
4
|
-
expanded = expanded_rows.include?(page.id)
|
4
|
+
expanded = show_all? || expanded_rows.include?(page.id)
|
5
5
|
padding_left = (level * 22) + 4
|
6
6
|
|
7
7
|
children_class = children ? (expanded ? ' children-visible' : ' children-hidden') : ' no-children'
|
8
8
|
virtual_class = page.virtual? ? " virtual": ""
|
9
9
|
|
10
|
-
expander = children ? image((expanded ? "collapse" : "expand"), :class => "expander", :alt => 'toggle children', :title => ''
|
10
|
+
expander = children ? image((expanded ? "collapse" : "expand"), :class => "expander", :alt => 'toggle children', :title => '') : ""
|
11
11
|
|
12
12
|
icon_name = page.virtual? ? "virtual-page" : "page"
|
13
|
-
icon = image(icon_name, :class => "icon", :alt => 'page-icon', :title => ''
|
13
|
+
icon = image(icon_name, :class => "icon", :alt => 'page-icon', :title => '')
|
14
14
|
|
15
15
|
title = %{<span class="title">#{ page.title }</span>}
|
16
16
|
|
17
17
|
display_name = page.class.display_name
|
18
18
|
page_type = display_name == 'Page' ? '' : %{<small class="info">(#{ display_name })</small>}
|
19
19
|
|
20
|
-
spinner = image('spinner.gif', :class => 'busy', :id => "busy-#{page.id}", :alt => "", :title => "", :
|
20
|
+
spinner = image('spinner.gif', :class => 'busy', :id => "busy-#{page.id}", :alt => "", :title => "", :style => 'display: none;')
|
21
21
|
-%>
|
22
22
|
<tr id="page-<%= page.id %>" class="node level-<%= level %><%= children_class %><%= virtual_class %>">
|
23
23
|
<td class="page" style="padding-left: <%= padding_left %>px">
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<% for snippet in @snippets -%>
|
15
15
|
<tr class="node level-1">
|
16
16
|
<td class="snippet">
|
17
|
-
<%= image "snippet", :class => "icon", :alt => 'snippet-icon', :title => ''
|
17
|
+
<%= image "snippet", :class => "icon", :alt => 'snippet-icon', :title => '' %>
|
18
18
|
<%= link_to snippet.name, snippet_edit_url(:id => snippet) %></span>
|
19
19
|
</td>
|
20
20
|
<td class="remove"><%= link_to image('remove', :alt => 'Remove Snippet'), snippet_remove_url(:id => snippet) %></td>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
roles.join(', ')
|
25
25
|
%>
|
26
26
|
</td>
|
27
|
-
<td class="remove"><%= user
|
27
|
+
<td class="remove"><%= user != current_user ? link_to(image('remove', :alt => 'Remove User'), user_remove_url(:id => user)) : image('remove-disabled', :alt => 'Remove') %></td>
|
28
28
|
</tr>
|
29
29
|
<% end -%>
|
30
30
|
<% else -%>
|
@@ -4,10 +4,10 @@
|
|
4
4
|
<head>
|
5
5
|
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
|
6
6
|
<title><%= @page_title || default_page_title %></title>
|
7
|
-
<% @stylesheets.each do |stylesheet| -%>
|
7
|
+
<% @stylesheets.uniq.each do |stylesheet| -%>
|
8
8
|
<%= stylesheet_link_tag stylesheet %>
|
9
9
|
<% end -%>
|
10
|
-
<% @javascripts.each do |script| -%>
|
10
|
+
<% @javascripts.uniq.each do |script| -%>
|
11
11
|
<%= javascript_include_tag script %>
|
12
12
|
<% end -%>
|
13
13
|
<!--[if lt IE 7]>
|
@@ -70,7 +70,7 @@
|
|
70
70
|
<%= nav_link_to 'Log Out', logout_url %>
|
71
71
|
<span class="separator"> | </span>
|
72
72
|
<% end -%>
|
73
|
-
<%= link_to image('view-site.gif', :alt => 'View Site', :title => ''
|
73
|
+
<%= link_to image('view-site.gif', :alt => 'View Site', :title => ''), homepage_url %>
|
74
74
|
</p>
|
75
75
|
</div>
|
76
76
|
</div>
|
@@ -80,4 +80,4 @@
|
|
80
80
|
</div>
|
81
81
|
<% end -%>
|
82
82
|
</body>
|
83
|
-
</html>
|
83
|
+
</html>
|
data/config/environment.rb
CHANGED
@@ -1,71 +1,78 @@
|
|
1
|
-
# Uncomment below to force Rails into production mode when
|
2
|
-
# you don't control web/app server and can't set it the proper way
|
3
|
-
# ENV['RAILS_ENV'] ||= 'production'
|
4
|
-
|
5
|
-
# Bootstrap the Rails environment, frameworks, and default configuration
|
6
|
-
require File.join(File.dirname(__FILE__), 'boot')
|
7
|
-
|
8
|
-
require 'radius'
|
9
|
-
|
10
|
-
Radiant::Initializer.run do |config|
|
11
|
-
# Settings in config/environments/* take precedence those specified here
|
12
|
-
|
13
|
-
# Skip frameworks you're not going to use
|
14
|
-
config.frameworks -= [ :action_web_service, :action_mailer ]
|
15
|
-
|
16
|
-
# Add additional load paths for when Radiant is running in instance mode
|
17
|
-
config.load_paths += %w(
|
18
|
-
app/controllers
|
19
|
-
app/models
|
20
|
-
app/helpers
|
21
|
-
lib
|
22
|
-
).map { |path| File.join(RADIANT_ROOT, path) }
|
23
|
-
config.controller_paths << File.join(RADIANT_ROOT, 'app', 'controllers')
|
24
|
-
config.view_path = File.join(RADIANT_ROOT, 'app', 'views')
|
25
|
-
|
26
|
-
#
|
27
|
-
#
|
28
|
-
# config.
|
29
|
-
|
30
|
-
#
|
31
|
-
# (
|
32
|
-
# config.
|
33
|
-
|
34
|
-
#
|
35
|
-
# (
|
36
|
-
# config.action_controller.
|
37
|
-
|
38
|
-
|
39
|
-
#
|
40
|
-
config.
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
1
|
+
# Uncomment below to force Rails into production mode when
|
2
|
+
# you don't control web/app server and can't set it the proper way
|
3
|
+
# ENV['RAILS_ENV'] ||= 'production'
|
4
|
+
|
5
|
+
# Bootstrap the Rails environment, frameworks, and default configuration
|
6
|
+
require File.join(File.dirname(__FILE__), 'boot')
|
7
|
+
|
8
|
+
require 'radius'
|
9
|
+
|
10
|
+
Radiant::Initializer.run do |config|
|
11
|
+
# Settings in config/environments/* take precedence those specified here
|
12
|
+
|
13
|
+
# Skip frameworks you're not going to use
|
14
|
+
config.frameworks -= [ :action_web_service, :action_mailer ]
|
15
|
+
|
16
|
+
# Add additional load paths for when Radiant is running in instance mode
|
17
|
+
config.load_paths += %w(
|
18
|
+
app/controllers
|
19
|
+
app/models
|
20
|
+
app/helpers
|
21
|
+
lib
|
22
|
+
).map { |path| File.join(RADIANT_ROOT, path) }
|
23
|
+
config.controller_paths << File.join(RADIANT_ROOT, 'app', 'controllers')
|
24
|
+
config.view_path = File.join(RADIANT_ROOT, 'app', 'views')
|
25
|
+
|
26
|
+
# Only load the extensions named here, in the order given. By default all plugins in vendor/extensions are
|
27
|
+
# loaded, in alphabetical order. :all can be used as a placeholder for all extensions not explicitly named.
|
28
|
+
# config.extensions = [ :textile_filter, :markdown_filter, :all ]
|
29
|
+
|
30
|
+
# Force all environments to use the same logger level
|
31
|
+
# (by default production uses :info, the others :debug)
|
32
|
+
# config.log_level = :debug
|
33
|
+
|
34
|
+
# Use the database for sessions instead of the file system
|
35
|
+
# (create the session table with 'rake create_sessions_table')
|
36
|
+
# config.action_controller.session_store = :active_record_store
|
37
|
+
|
38
|
+
# Enable page/fragment caching by setting a file-based store
|
39
|
+
# (remember to create the caching directory and make it readable to the application)
|
40
|
+
# config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/fragment_cache"
|
41
|
+
config.action_controller.page_cache_directory = "#{RAILS_ROOT}/cache"
|
42
|
+
|
43
|
+
# Make Active Record use UTC-base instead of local time
|
44
|
+
config.active_record.default_timezone = :utc
|
45
|
+
|
46
|
+
# Activate observers that should always be running
|
47
|
+
config.active_record.observers = :user_action_observer
|
48
|
+
|
49
|
+
# Make sure plugins are loaded from lib and vendor
|
50
|
+
config.plugin_paths = [
|
51
|
+
"#{RAILS_ROOT}/vendor/plugins",
|
52
|
+
"#{RADIANT_ROOT}/lib/plugins",
|
53
|
+
"#{RADIANT_ROOT}/vendor/plugins"
|
54
|
+
]
|
55
|
+
|
56
|
+
# Use ActiveRecord sessions
|
57
|
+
config.action_controller.session_store = :active_record_store
|
58
|
+
|
59
|
+
# See Rails::Configuration for more options
|
60
|
+
end
|
61
|
+
|
62
|
+
# Add new inflection rules using the following format:
|
63
|
+
Inflector.inflections do |inflect|
|
64
|
+
inflect.uncountable 'config'
|
65
|
+
inflect.uncountable 'meta'
|
66
|
+
end
|
67
|
+
|
68
|
+
# Auto-require text filters
|
69
|
+
Dir["#{RADIANT_ROOT}/app/models/*_filter.rb"].each do |filter|
|
70
|
+
filter = $1 if filter =~ %r{/([^/]+)\.rb}
|
71
|
+
require_dependency filter
|
72
|
+
end
|
73
|
+
|
74
|
+
# Response Caching Defaults
|
75
|
+
ResponseCache.defaults[:directory] = ActionController::Base.page_cache_directory
|
76
|
+
ResponseCache.defaults[:logger] = ActionController::Base.logger
|
77
|
+
|
71
78
|
require "status"
|