Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 70793ff559 | |||
| 6621e71e6c | |||
| 2af164ee9e | |||
| 9227f0a195 | |||
| f18330b494 | |||
| bb32339ab4 | |||
| ddf4378dfe | |||
| 2a607e209b |
+2
-2
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
||||
s.required_ruby_version = ">= 1.8.7"
|
||||
|
||||
s.name = 'gollum'
|
||||
s.version = '2.4.6'
|
||||
s.date = '2012-12-18'
|
||||
s.version = '2.4.8'
|
||||
s.date = '2012-12-20'
|
||||
s.rubyforge_project = 'gollum'
|
||||
|
||||
s.summary = "A simple, Git-powered wiki."
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
|
||||
$KCODE = 'U' if RUBY_VERSION[0,3] == '1.8'
|
||||
|
||||
module Gollum
|
||||
VERSION = '2.4.6'
|
||||
VERSION = '2.4.8'
|
||||
|
||||
def self.assets_path
|
||||
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
|
||||
|
||||
@@ -85,6 +85,10 @@ module Gollum
|
||||
#
|
||||
# Returns nothing (modifies the Index in place).
|
||||
def add_to_index(dir, name, format, data, allow_same_ext = false)
|
||||
# spaces must be dashes
|
||||
dir.gsub!(' ', '-')
|
||||
name.gsub!(' ', '-')
|
||||
|
||||
path = @wiki.page_file_name(name, format)
|
||||
|
||||
dir = '/' if dir.strip.empty?
|
||||
|
||||
+13
-11
@@ -88,7 +88,8 @@ module Precious
|
||||
end
|
||||
|
||||
get '/' do
|
||||
redirect ::File.join(@base_url, 'Home')
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect clean_url(::File.join(@base_url, page_dir, 'Home'))
|
||||
end
|
||||
|
||||
# path is set to name if path is nil.
|
||||
@@ -179,9 +180,16 @@ module Precious
|
||||
@name = wikip.name.to_url
|
||||
@path = wikip.path
|
||||
|
||||
# --page-file-dir docs
|
||||
# /docs/Home should be created in /Home
|
||||
# not /docs/Home because write_page will append /docs
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
@path = @path.sub(page_dir, '/') if @path.start_with? page_dir
|
||||
|
||||
page = wikip.page
|
||||
if page
|
||||
redirect to("/#{page.escaped_url_path}")
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, page.escaped_url_path))}")
|
||||
else
|
||||
mustache :create
|
||||
end
|
||||
@@ -191,16 +199,13 @@ module Precious
|
||||
name = params[:page].to_url
|
||||
path = sanitize_empty_params(params[:path]) || ''
|
||||
format = params[:format].intern
|
||||
|
||||
# ensure pages are created in page_file_dir
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = clean_url(::File.join(page_dir, path)) unless path.start_with?(page_dir)
|
||||
|
||||
wiki = wiki_new
|
||||
|
||||
begin
|
||||
wiki.write_page(name, format, params[:content], commit_message, path)
|
||||
redirect to("/#{clean_url(::File.join(path,name))}")
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
redirect to("/#{clean_url(::File.join(page_dir, path, name))}")
|
||||
rescue Gollum::DuplicatePageError => e
|
||||
@message = "Duplicate page: #{e.message}"
|
||||
mustache :error
|
||||
@@ -345,9 +350,6 @@ module Precious
|
||||
path = extract_path(fullpath) || '/'
|
||||
wiki = wiki_new
|
||||
|
||||
page_dir = settings.wiki_options[:page_file_dir].to_s
|
||||
path = ::File.join(page_dir, path) unless path.start_with?(page_dir)
|
||||
|
||||
if page = wiki.paged(name, path, exact = true)
|
||||
@page = page
|
||||
@name = name
|
||||
|
||||
@@ -420,7 +420,7 @@ module Gollum
|
||||
path = cname[0..slash]
|
||||
page = @wiki.paged(name, path)
|
||||
else
|
||||
page = @wiki.paged(cname, '/')
|
||||
page = @wiki.paged(cname, '/') || @wiki.page(cname)
|
||||
end
|
||||
|
||||
if page
|
||||
|
||||
@@ -287,6 +287,10 @@ module Gollum
|
||||
# Returns the String SHA1 of the newly written version, or the
|
||||
# Gollum::Committer instance if this is part of a batch update.
|
||||
def write_page(name, format, data, commit = {}, dir = '')
|
||||
# spaces must be dashes
|
||||
name.gsub!(' ', '-')
|
||||
dir.gsub!(' ', '-')
|
||||
|
||||
multi_commit = false
|
||||
|
||||
committer = if obj = commit[:committer]
|
||||
|
||||
+4
-4
@@ -305,7 +305,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
||||
|
||||
assert_equal :textile, @wiki.page("Samwise Gamgee").format
|
||||
assert_equal "h1. Samwise Gamgee2", @wiki.page("Samwise Gamgee").raw_data
|
||||
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||
assert_equal "Samwise-Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||
end
|
||||
|
||||
test "update page with format change, verify non-canonicalization of filename, where filename contains Whitespace" do
|
||||
@@ -317,7 +317,7 @@ context "Wiki page writing with whitespace (filename contains whitespace)" do
|
||||
|
||||
assert_equal :textile, @wiki.page("Samwise Gamgee").format
|
||||
assert_equal "h1. Samwise Gamgee", @wiki.page("Samwise Gamgee").raw_data
|
||||
assert_equal "Samwise Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||
assert_equal "Samwise-Gamgee.textile", @wiki.page("Samwise Gamgee").filename
|
||||
end
|
||||
|
||||
test "update page with name change, verify canonicalization of filename, where filename contains Whitespace" do
|
||||
@@ -424,8 +424,8 @@ context "Wiki sync with working directory (filename contains whitespace)" do
|
||||
test "update a page with same name and different format" do
|
||||
page = @wiki.page("Samwise Gamgee")
|
||||
@wiki.update_page(page, page.name, :textile, "What we need is a few good taters.", commit_details)
|
||||
assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise Gamgee.textile"))
|
||||
assert !File.exist?(File.join(@path, "Samwise Gamgee.mediawiki"))
|
||||
assert_equal "What we need is a few good taters.", File.read(File.join(@path, "Samwise-Gamgee.textile"))
|
||||
assert !File.exist?(File.join(@path, "Samwise-Gamgee.mediawiki"))
|
||||
end
|
||||
|
||||
test "update a page with different name and different format" do
|
||||
|
||||
Reference in New Issue
Block a user