Merge branch 'bzr/golem' of /Users/distler/Sites/code/instiki

This commit is contained in:
Jacques Distler 2009-11-22 01:34:50 -06:00
commit 1cf29f444f
6 changed files with 12 additions and 12 deletions

View file

@ -68,7 +68,7 @@ class WikiController < ApplicationController
end
def export_html
stylesheet = File.read(File.join(RAILS_ROOT, 'public', 'stylesheets', 'instiki.css'))
stylesheet = Rails.root.join('public', 'stylesheets', 'instiki.css').read
export_pages_as_zip(html_ext) do |page|
renderer = PageRenderer.new(page.revisions.last)
@ -423,7 +423,7 @@ class WikiController < ApplicationController
file_prefix = "#{@web.address}-#{file_type}-"
timestamp = @web.revised_at.strftime('%Y-%m-%d-%H-%M-%S')
file_path = File.join(@wiki.storage_path, file_prefix + timestamp + '.zip')
file_path = @wiki.storage_path.join(file_prefix + timestamp + '.zip')
tmp_path = "#{file_path}.tmp"
Zip::ZipOutputStream.open(tmp_path) do |zip_out|
@ -438,7 +438,7 @@ class WikiController < ApplicationController
"<META HTTP-EQUIV=\"Refresh\" CONTENT=\"0;URL=HomePage.#{file_type}\"></head></html>"
end
end
FileUtils.rm_rf(Dir[File.join(@wiki.storage_path, file_prefix + '*.zip')])
FileUtils.rm_rf(Dir[@wiki.storage_path.join(file_prefix + '*.zip')])
FileUtils.mv(tmp_path, file_path)
send_file file_path
end
@ -516,9 +516,9 @@ class WikiController < ApplicationController
end
def load_spam_patterns
spam_patterns_file = "#{RAILS_ROOT}/config/spam_patterns.txt"
spam_patterns_file = Rails.root.join('config', 'spam_patterns.txt')
if File.exists?(spam_patterns_file)
File.readlines(spam_patterns_file).inject([]) { |patterns, line| patterns << Regexp.new(line.chomp, Regexp::IGNORECASE) }
spam_patterns_file.readlines.inject([]) { |patterns, line| patterns << Regexp.new(line.chomp, Regexp::IGNORECASE) }
else
[]
end

View file

@ -1,7 +1,7 @@
class Wiki
cattr_accessor :storage_path, :logger
self.storage_path = "#{RAILS_ROOT}/storage/"
self.storage_path = Rails.root.join('storage')
def authenticate(password)
password == (system.password || 'instiki')

View file

@ -20,7 +20,7 @@
h1#pageName, div.info, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, [actiontype="toggle"]:hover, #TextileHelp h3 {
color: #<%= @web ? @web.color : "393" %>;
}
<%= File.read(RAILS_ROOT + '/public/stylesheets/instiki.css') if @inline_style %>
<%= Rails.root.join('public', 'stylesheets', 'instiki.css').read if @inline_style %>
</style>
<%= stylesheet_link_tag 'instiki', :media => 'all' unless @inline_style %>
<%= "<style type='text/css'>#{@style_additions}</style>" if @style_additions %>

View file

@ -12,10 +12,10 @@
h1#pageName, .newWikiWord a, a.existingWikiWord, .newWikiWord a:hover, #TextileHelp h3 {
color: #<%= @web ? @web.color : "393" %>;
}
<%= File.read(RAILS_ROOT + '/public/stylesheets/instiki.css') if @inline_style %>
<%= Rails.root.join('public', 'stylesheets', 'instiki.css').read if @inline_style %>
</style>
<%= stylesheet_link_tag 'instiki' unless @inline_style %>
<%= stylesheet_link_tag 'instiki', :media => 'all' unless @inline_style %>
<style type="text/css"><!--/*--><![CDATA[/*><!--*/
<%= @style_additions %>

View file

@ -18,9 +18,9 @@ Rails::Initializer.run do |config|
# in a file, for reuse between server restarts. If you want to
# change the key, just delete the file, and it will be regenerated
# on the next restart. Doing so will invalitate all existing sessions.
secret_file = File.join(RAILS_ROOT, "secret")
secret_file = Rails.root.join("secret")
if File.exist?(secret_file)
secret = File.read(secret_file)
secret = secret_file.read
else
secret = ActiveSupport::SecureRandom.hex(64)
File.open(secret_file, 'w', 0600) { |f| f.write(secret) }

View file

@ -8,7 +8,7 @@ config.cache_classes = true
####
# This rotates the log file, keeping 25 files, of 1MB each.
config.action_controller.logger = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log", 25, 1024000)
config.action_controller.logger = Logger.new(Rails.root.join('log', "#{RAILS_ENV}.log"), 25, 1024000)
# Unfortunately, the above does not work well under Mongrel, as the default Ruby logger class
# does no locking and you will have several processes running, each wanting to write to (and