Permalink
Browse files

Move gollum back end to gollum-lib #647

  • Loading branch information...
1 parent fe706c1 commit 1f79126b27d6c50bb6a659ba132bda0edee83625 Jamie Oliver committed Mar 19, 2013
Showing 520 changed files with 36 additions and 5,663 deletions.
View
@@ -149,7 +149,7 @@ if options['irb']
exit 0
end
else
- require 'gollum/frontend/app'
+ require 'gollum/app'
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, wiki_options)
View
@@ -23,14 +23,9 @@ Gem::Specification.new do |s|
s.rdoc_options = ["--charset=UTF-8"]
s.extra_rdoc_files = %w[README.md LICENSE]
- s.add_dependency('grit', '~> 2.5.0')
- s.add_dependency('github-markup', ['>= 0.7.5', '< 1.0.0'])
- s.add_dependency('github-markdown', '~> 0.5.3')
- s.add_dependency('pygments.rb', '~> 0.4.2')
+ s.add_dependency('gollum-lib', '~> 0.0.1')
s.add_dependency('sinatra', '~> 1.3.5')
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
- s.add_dependency('sanitize', '~> 2.0.3')
- s.add_dependency('nokogiri', '~> 1.5.6')
s.add_dependency('useragent', '~> 0.4.16')
s.add_dependency('stringex', '~> 1.5.1')
@@ -44,6 +39,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('pry', '~> 0.9.12')
# required by pry
s.add_development_dependency('rb-readline', '~> 0.4.2')
+ s.add_development_dependency('minitest-reporters', '>= 0.5.0')
# = MANIFEST =
s.files = %w[
View
@@ -6,24 +6,11 @@
# external
require 'grit'
-require File.expand_path('../gollum/grit_ext', __FILE__)
require 'github/markup'
require 'sanitize'
# internal
-require File.expand_path('../gollum/git_access', __FILE__)
-require File.expand_path('../gollum/committer', __FILE__)
-require File.expand_path('../gollum/pagination', __FILE__)
-require File.expand_path('../gollum/blob_entry', __FILE__)
-require File.expand_path('../gollum/wiki', __FILE__)
-require File.expand_path('../gollum/page', __FILE__)
-require File.expand_path('../gollum/file', __FILE__)
-require File.expand_path('../gollum/file_view', __FILE__)
-require File.expand_path('../gollum/markup', __FILE__)
-require File.expand_path('../gollum/markups', __FILE__)
-require File.expand_path('../gollum/sanitization', __FILE__)
-require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
-require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
+require File.expand_path('../gollum/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports.
@@ -33,7 +20,7 @@ module Gollum
VERSION = '2.4.11'
def self.assets_path
- ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+ ::File.expand_path('gollum/public', ::File.dirname(__FILE__))
end
class Error < StandardError; end
@@ -1,14 +1,14 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi'
require 'sinatra'
-require 'gollum'
+require 'gollum-lib'
require 'mustache/sinatra'
require 'useragent'
require 'stringex'
-require 'gollum/frontend/views/layout'
-require 'gollum/frontend/views/editable'
-require 'gollum/frontend/views/has_page'
+require 'gollum/views/layout'
+require 'gollum/views/editable'
+require 'gollum/views/has_page'
require File.expand_path '../helpers', __FILE__
@@ -27,7 +27,7 @@ def to_url
# There are a number of wiki options that can be set for the frontend
#
# Example
-# require 'gollum/frontend/app'
+# require 'gollum/app'
# Precious::App.set(:wiki_options, {
# :universal_toc => false,
# }
View
@@ -1,95 +0,0 @@
-# ~*~ encoding: utf-8 ~*~
-module Gollum
- class BlobEntry
- # Gets the String SHA for this blob.
- attr_reader :sha
-
- # Gets the full path String for this blob.
- attr_reader :path
-
- # Gets the Fixnum size of this blob.
- attr_reader :size
-
- # Gets the Fixnum mode of this blob.
- attr_reader :mode
-
- def initialize(sha, path, size = nil, mode = nil)
- @sha = sha
- @path = path
- @size = size
- @mode = mode
- @dir = @name = @blob = nil
- end
-
- # Gets the normalized directory path String for this blob.
- def dir
- @dir ||= self.class.normalize_dir(::File.dirname(@path))
- end
-
- # Gets the file base name String for this blob.
- def name
- @name ||= ::File.basename(@path)
- end
-
- # Gets a Grit::Blob instance for this blob.
- #
- # repo - Grit::Repo instance for the Grit::Blob.
- #
- # Returns an unbaked Grit::Blob instance.
- def blob(repo)
- @blob ||= Grit::Blob.create(repo,
- :id => @sha, :name => name, :size => @size, :mode => @mode)
- end
-
- # Gets a Page instance for this blob.
- #
- # wiki - Gollum::Wiki instance for the Gollum::Page
- #
- # Returns a Gollum::Page instance.
- def page(wiki, commit)
- blob = self.blob(wiki.repo)
- page = wiki.page_class.new(wiki).populate(blob, self.dir)
- page.version = commit
- page
- end
-
- # Gets a File instance for this blob.
- #
- # wiki - Gollum::Wiki instance for the Gollum::File
- #
- # Returns a Gollum::File instance.
- def file(wiki, commit)
- blob = self.blob(wiki.repo)
- file = wiki.file_class.new(wiki).populate(blob, self.dir)
- file.version = commit
- file
- end
-
- def inspect
- %(#<Gollum::BlobEntry #{@sha} #{@path}>)
- end
-
- # Normalizes a given directory name for searching through tree paths.
- # Ensures that a directory begins with a slash, or
- #
- # normalize_dir("") # => ""
- # normalize_dir(".") # => ""
- # normalize_dir("foo") # => "/foo"
- # normalize_dir("/foo/") # => "/foo"
- # normalize_dir("/") # => ""
- # normalize_dir("c:/") # => ""
- #
- # dir - String directory name.
- #
- # Returns a normalized String directory name, or nil if no directory
- # is given.
- def self.normalize_dir(dir)
- return '' if dir =~ /^.:\/$/
- if dir
- dir = ::File.expand_path(dir, '/')
- dir = '' if dir == '/'
- end
- dir
- end
- end
-end
Oops, something went wrong.

0 comments on commit 1f79126

Please sign in to comment.