diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index dba74af6..3651aa1a 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -25,7 +25,7 @@ class WikiController < ApplicationController if password_check(@params['password']) redirect_show('HomePage') else - redirect_to :action => 'login' + redirect_to :action => 'login', :web => @web_name end end diff --git a/app/models/chunks/engines.rb b/app/models/chunks/engines.rb index 1d7eff70..15b19fe6 100644 --- a/app/models/chunks/engines.rb +++ b/app/models/chunks/engines.rb @@ -1,11 +1,10 @@ $: << File.dirname(__FILE__) + "../../libraries" require 'redcloth' -require 'bluecloth' require 'rdocsupport' require 'chunks/chunk' -# The markup engines are Chunks that call the one of RedCloth, BlueCloth +# The markup engines are Chunks that call the one of RedCloth # or RDoc to convert text. This markup occurs when the chunk is required # to mask itself. module Engines @@ -39,7 +38,7 @@ module Engines class Markdown < AbstractEngine def mask(content) - BlueCloth.new(text,content.options[:engine_opts]).to_html + RedCloth.new(text,content.options[:engine_opts]).to_html end end diff --git a/config/environment.rb b/config/environment.rb index 9e8c98d6..a5d621aa 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -11,44 +11,53 @@ RAILS_ROOT = File.expand_path(File.dirname(__FILE__) + '/../') unless defined? R RAILS_ENV = ENV['RAILS_ENV'] || 'production' unless defined? RAILS_ENV unless defined? ADDITIONAL_LOAD_PATHS -# Mocks first. + # Mocks first. ADDITIONAL_LOAD_PATHS = ["#{RAILS_ROOT}/test/mocks/#{RAILS_ENV}"] -# Then model subdirectories. + # Then model subdirectories. ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/app/models/[_a-z]*"]) + ADDITIONAL_LOAD_PATHS.concat(Dir["#{RAILS_ROOT}/components/[_a-z]*"]) -# Followed by the standard includes. + # Followed by the standard includes. ADDITIONAL_LOAD_PATHS.concat %w( - app - app/models - app/controllers - app/helpers - config - libraries - ).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}" } - -# Third party vendors - ADDITIONAL_LOAD_PATHS.concat %w( - vendor/bluecloth-1.0.0/lib + app + app/models + app/controllers + app/helpers + app/apis + components + config + lib + vendor + vendor/rails/railties + vendor/rails/railties/lib + vendor/rails/actionpack/lib + vendor/rails/activesupport/lib + vendor/rails/activerecord/lib + vendor/rails/actionmailer/lib + vendor/rails/actionwebservice/lib vendor/madeleine-0.7.1/lib vendor/RedCloth-3.0.3/lib vendor/rubyzip-0.5.6 - vendor/actionpack/lib - vendor/activesupport/lib - vendor/railties/lib - ).map { |dir| - "#{File.expand_path(File.join(RAILS_ROOT, dir))}" + ).map { |dir| "#{File.expand_path(File.join(RAILS_ROOT, dir))}" }.delete_if { |dir| not File.exist?(dir) } -# Prepend to $LOAD_PATH + # Prepend to $LOAD_PATH ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } end +# Require Rails libraries. +require 'rubygems' unless File.directory?("#{RAILS_ROOT}/vendor/rails") + +require 'active_support' require 'action_controller' require 'active_record_stub' require 'instiki_errors' -require 'routes' +# Environment specific configuration +require_dependency "environments/#{RAILS_ENV}" + +# Configure defaults if the included environment did not. unless defined? RAILS_DEFAULT_LOGGER RAILS_DEFAULT_LOGGER = Logger.new(STDERR) ActionController::Base.logger ||= RAILS_DEFAULT_LOGGER @@ -61,15 +70,12 @@ unless defined? RAILS_DEFAULT_LOGGER end end -# Environment-specific configuration. -require "environments/#{RAILS_ENV}" -require 'wiki_service' - -Socket.do_not_reverse_lookup = true - ActionController::Base.template_root ||= "#{RAILS_ROOT}/app/views/" ActionController::Routing::Routes.reload Controllers = Dependencies::LoadingModule.root( - File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')), - File.expand_path(File.join(RAILS_ROOT, 'components')) + File.join(RAILS_ROOT, 'app', 'controllers'), + File.join(RAILS_ROOT, 'components') ) + +require 'wiki_service' +Socket.do_not_reverse_lookup = true diff --git a/config/environments/development.rb b/config/environments/development.rb index f824ec90..76df0ced 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,4 +1,5 @@ Dependencies.mechanism = :require ActionController::Base.consider_all_requests_local = true +ActionController::Base.perform_caching = false BREAKPOINT_SERVER_PORT = 42531 ActionController::Base.logger.level = Logger::DEBUG diff --git a/config/environments/production.rb b/config/environments/production.rb index 8ce5207c..e5b18783 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,2 +1,4 @@ Dependencies.mechanism = :require ActionController::Base.consider_all_requests_local = false +ActionController::Base.perform_caching = false + diff --git a/config/environments/test.rb b/config/environments/test.rb index d4bad332..168574c6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,5 +1,6 @@ Dependencies.mechanism = :require ActionController::Base.consider_all_requests_local = true +ActionController::Base.perform_caching = false require 'fileutils' FileUtils.mkdir_p(RAILS_ROOT + "/log") diff --git a/libraries/active_record_stub.rb b/lib/active_record_stub.rb similarity index 100% rename from libraries/active_record_stub.rb rename to lib/active_record_stub.rb diff --git a/libraries/diff.rb b/lib/diff.rb similarity index 100% rename from libraries/diff.rb rename to lib/diff.rb diff --git a/libraries/instiki_errors.rb b/lib/instiki_errors.rb similarity index 100% rename from libraries/instiki_errors.rb rename to lib/instiki_errors.rb diff --git a/libraries/rdocsupport.rb b/lib/rdocsupport.rb similarity index 100% rename from libraries/rdocsupport.rb rename to lib/rdocsupport.rb diff --git a/libraries/redcloth_for_tex.rb b/lib/redcloth_for_tex.rb similarity index 100% rename from libraries/redcloth_for_tex.rb rename to lib/redcloth_for_tex.rb diff --git a/public/.htaccess b/public/.htaccess index da3851df..bf245115 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -3,27 +3,23 @@ AddHandler fastcgi-script .fcgi AddHandler cgi-script .cgi Options +FollowSymLinks +ExecCGI -# Make sure that mod_ruby.c has been added and loaded as a module with Apache +# Redirect all requests not available on the filesystem to Rails +# By default the cgi dispatcher is used which is very slow +# +# For better performance replace the dispatcher with the fastcgi one +# +# Example: +# RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] RewriteEngine On +RewriteRule ^$ index.html [QSA] +RewriteRule ^([^.]+)$ $1.html [QSA] +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^(.*)$ dispatch.cgi [QSA,L] -# Change extension from .cgi to .fcgi to switch to FCGI and to .rb to switch to mod_ruby -RewriteBase /dispatch.cgi +# In case Rails experiences terminal errors +# Instead of displaying this message you can supply a file here which will be rendered instead +# +# Example: +# ErrorDocument 500 /500.html -# Enable this rewrite rule to point to the controller/action that should serve root. -# RewriteRule ^$ /wiki/ [R] - -# Add missing slash -RewriteRule ^([-_a-zA-Z0-9]+)$ /$1/ [R] - -# Default rewriting rules. -RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?controller=$1&action=$2&id=$3 [QSA,L] -RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?controller=$1&action=$2 [QSA,L] -RewriteRule ^([-_a-zA-Z0-9]+)/$ ?controller=$1&action=index [QSA,L] - -RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([0-9]+)$ ?module=$1&controller=$2&action=$3&id=$4 [QSA,L] -RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)$ ?module=$1&controller=$2&action=$3 [QSA,L] -RewriteRule ^([-_a-zA-Z0-9]+)/([-_a-zA-Z0-9]+)/$ ?module=$1&controller=$2&action=index [QSA,L] - -# You can also point these error messages to a controller/action -ErrorDocument 500 /500.html -ErrorDocument 404 /404.html +ErrorDocument 500 "
HTTP 404
+Change this error message for pages not found in public/404.html
- +