Replaced grit calls to new calls in gollum-lib 1.06 (set_git_timeout and set_git_max_filsize). Removed grit dependency from tests, using cp of empty.git instead. Replaced Grit exceptions with equivalents in the Gollum module.

This commit is contained in:
Dawa Ometto
2013-08-08 21:36:30 +02:00
parent 90e20810d5
commit f81634728d
6 changed files with 12 additions and 12 deletions
+2 -2
View File
@@ -146,7 +146,7 @@ if options['irb']
begin
require 'gollum-lib'
wiki = Gollum::Wiki.new(gollum_path, wiki_options)
if !wiki.exist? then raise Grit::InvalidGitRepositoryError end
if !wiki.exist? then raise Gollum::InvalidGitRepositoryError end
puts "Loaded Gollum wiki at #{File.expand_path(gollum_path).inspect}."
puts
puts %( page = wiki.page('page-name'))
@@ -160,7 +160,7 @@ if options['irb']
puts
puts "Check out the Gollum README for more."
IRB.start_session(binding)
rescue Grit::InvalidGitRepositoryError, Grit::NoSuchPathError
rescue Gollum::InvalidGitRepositoryError, Gollum::NoSuchPathError
puts "Invalid Gollum wiki at #{File.expand_path(gollum_path).inspect}"
exit 0
end
+1 -1
View File
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.md LICENSE]
s.add_dependency 'gollum-lib', '~> 1.0.4'
s.add_dependency 'gollum-lib', '~> 1.0.6'
s.add_dependency 'sinatra', '~> 1.4.2'
s.add_dependency 'mustache', ['>= 0.99.4', '< 1.0.0']
s.add_dependency 'useragent', '~> 0.6.0'
-1
View File
@@ -5,7 +5,6 @@ require 'digest/sha1'
require 'ostruct'
# external
require 'grit'
require 'github/markup'
require 'sanitize'
+2 -2
View File
@@ -14,8 +14,8 @@ require 'gollum/views/has_page'
require File.expand_path '../helpers', __FILE__
#required to upload bigger binary files
Grit::Git.git_timeout = 120 # timeout in secs
Grit::Git.git_max_size = 190 * 10**6 # size in bytes (10^6=1 MB)
Gollum::set_git_timeout(120)
Gollum::set_git_max_filesize(190 * 10**6)
# Fix to_url
class String
+3 -2
View File
@@ -1,7 +1,8 @@
class WikiFactory
def self.create p
path = testpath "examples/test.git"
Grit::Repo.init_bare(@path)
examples = testpath "examples"
path = File.join(examples, "test.git")
FileUtils.cp_r File.join(examples, "empty.git"), path, :remove_destination => true
Gollum::Wiki.default_options = {:universal_toc => false}
cleanup = Proc.new { FileUtils.rm_r File.join(File.dirname(__FILE__), *%w[examples test.git]) }
Gollum::Wiki.new(@path), @path, cleanup
+4 -4
View File
@@ -4,9 +4,9 @@ require File.expand_path '../../lib/gollum/views/page', __FILE__
context "Precious::Views::Page" do
setup do
@path = testpath("examples/test.git")
FileUtils.rm_rf(@path)
@repo = Grit::Repo.init_bare(@path)
examples = testpath "examples"
@path = File.join(examples, "test.git")
FileUtils.cp_r File.join(examples, "empty.git"), @path, :remove_destination => true
@wiki = Gollum::Wiki.new(@path)
end
@@ -43,4 +43,4 @@ context "Precious::Views::Page" do
actual = @view.title
assert_equal 'H1', title
end
end
end