diff --git a/gemspec.rb b/gemspec.rb
index 6329eb37d..a1fe6a135 100644
--- a/gemspec.rb
+++ b/gemspec.rb
@@ -49,7 +49,7 @@ def specification(version, default_adapter, platform = nil)
s.add_development_dependency 'guard', '~> 2.16'
s.add_development_dependency 'guard-minitest', '~> 2.4'
s.add_development_dependency 'twitter_cldr', '~> 6.4'
-
+
# = MANIFEST =
s.files = %w[
Gemfile
@@ -67,7 +67,6 @@ def specification(version, default_adapter, platform = nil)
lib/gollum-lib/blob_entry.rb
lib/gollum-lib/committer.rb
lib/gollum-lib/file.rb
- lib/gollum-lib/file_view.rb
lib/gollum-lib/filter.rb
lib/gollum-lib/filter/bibtex.rb
lib/gollum-lib/filter/code.rb
diff --git a/lib/gollum-lib.rb b/lib/gollum-lib.rb
index 5a2c5858f..f4d8ea409 100644
--- a/lib/gollum-lib.rb
+++ b/lib/gollum-lib.rb
@@ -28,7 +28,6 @@ module Gollum; end
require File.expand_path('../gollum-lib/file', __FILE__)
require File.expand_path('../gollum-lib/page', __FILE__)
require File.expand_path('../gollum-lib/macro', __FILE__)
-require File.expand_path('../gollum-lib/file_view', __FILE__)
require File.expand_path('../gollum-lib/markup', __FILE__)
require File.expand_path('../gollum-lib/markups', __FILE__)
require File.expand_path('../gollum-lib/sanitization', __FILE__)
diff --git a/lib/gollum-lib/file_view.rb b/lib/gollum-lib/file_view.rb
deleted file mode 100644
index ff8f43bae..000000000
--- a/lib/gollum-lib/file_view.rb
+++ /dev/null
@@ -1,164 +0,0 @@
-# ~*~ encoding: utf-8 ~*~
-module Gollum
- # FileView requires that:
- # - All files in root dir are processed first
- # - Then all the folders are sorted and processed
-
- class FileView
- # common use cases:
- # set pages to wiki.pages and show_all to false
- # set pages to wiki.pages + wiki.files and show_all to true
- def initialize(pages, options = {})
- @pages = pages
- @wiki = @pages.first ? @pages.first.wiki : nil
- @show_all = options[:show_all] || false
- @checked = options[:collapse_tree] ? '' : "checked"
- end
-
- def enclose_tree(string)
- sanitize_html(%Q(
\n) + string + %Q(
))
- end
-
- def new_page(page)
- name = page.name
- url, valid_page = url_for_page page
- %Q( #{name}#{valid_page ? "" : delete_file(url, valid_page)})
- end
-
- def delete_file(url, valid_page)
- %Q()
- end
-
- def new_folder(folder_path)
- new_sub_folder folder_path
- end
-
- def new_sub_folder(path)
- <<-HTML
-
-
-
- HTML
- end
-
- def end_folder
- "
\n"
- end
-
- def url_for_page(page)
- url = ''
- valid_page_name = false
- if @show_all
- # Remove ext for valid pages.
- filename = page.filename
- valid_page_name = Page::valid_page_name?(filename)
- filename = valid_page_name ? filename.chomp(::File.extname(filename)) : filename
-
- url = ::File.join(::File.dirname(page.path), filename)
- else
- url = ::File.join(::File.dirname(page.path), page.filename_stripped)
- end
- url = url[2..-1] if url[0, 2] == './'
- return url, valid_page_name
- end
-
- def render_files
- html = ''
- count = @pages.size
- folder_start = -1
-
- # Process all pages until folders start
- count.times do |index|
- page = @pages[index]
- path = page.path
-
- unless path.include? '/'
- # Page processed (not contained in a folder)
- html += new_page page
- else
- # Folders start at the next index
- folder_start = index
- break # Pages finished, move on to folders
- end
- end
-
- # If there are no folders, then we're done.
- return enclose_tree(html) if folder_start <= -1
-
- # Handle special case of only one folder.
- if (count - folder_start == 1)
- page = @pages[folder_start]
- html += <<-HTML
-
-
-
- #{new_page page}
-
-
- HTML
-
- return enclose_tree(html)
- end
-
- sorted_folders = []
- (folder_start).upto count - 1 do |index|
- sorted_folders += [[@pages[index].path, index]]
- end
-
- # http://stackoverflow.com/questions/3482814/sorting-list-of-string-paths-in-vb-net
- sorted_folders.sort! do |first, second|
- a = first[0]
- b = second[0]
-
- # use :: operator because gollum defines its own conflicting File class
- dir_compare = ::File.dirname(a) <=> ::File.dirname(b)
-
- # Sort based on directory name unless they're equal (0) in
- # which case sort based on file name.
- if dir_compare == 0
- ::File.basename(a) <=> ::File.basename(b)
- else
- dir_compare
- end
- end
-
- # keep track of folder depth, 0 = at root.
- cwd_array = []
- changed = false
-
- # process rest of folders
- (0...sorted_folders.size).each do |i|
- page = @pages[sorted_folders[i][1]]
- path = page.path
- folder = ::File.dirname path
-
- tmp_array = folder.split '/'
-
- (0...tmp_array.size).each do |index|
- if cwd_array[index].nil? || changed
- html += new_sub_folder tmp_array[index]
- next
- end
-
- if cwd_array[index] != tmp_array[index]
- changed = true
- (cwd_array.size - index).times do
- html += end_folder
- end
- html += new_sub_folder tmp_array[index]
- end
- end
-
- html += new_page page
- cwd_array = tmp_array
- changed = false
- end
-
- enclose_tree(html)
- end # end render_files
-
- def sanitize_html(data)
- @wiki ? @wiki.sanitizer.clean(data) : data
- end
- end # end FileView class
-end # end Gollum module
diff --git a/test/file_view/1_file.txt b/test/file_view/1_file.txt
deleted file mode 100644
index b0478cafc..000000000
--- a/test/file_view/1_file.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-
- -
- 0
-
-
diff --git a/test/file_view/1_file_1_folder.txt b/test/file_view/1_file_1_folder.txt
deleted file mode 100644
index 10c50815d..000000000
--- a/test/file_view/1_file_1_folder.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
- -
-
-
-
- -
- 0
-
-
-
-
diff --git a/test/file_view/1_folder.txt b/test/file_view/1_folder.txt
deleted file mode 100644
index eb7c34f63..000000000
--- a/test/file_view/1_folder.txt
+++ /dev/null
@@ -1,11 +0,0 @@
-
- -
-
-
-
- -
- folder0
-
-
-
-
diff --git a/test/file_view/2_files_2_folders.txt b/test/file_view/2_files_2_folders.txt
deleted file mode 100644
index d8661a67b..000000000
--- a/test/file_view/2_files_2_folders.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-
- -
-
-
-
- -
- 0
-
-
-
- -
-
-
-
- -
- 1
-
-
-
-
diff --git a/test/file_view/2_files_2_folders_1_root.txt b/test/file_view/2_files_2_folders_1_root.txt
deleted file mode 100644
index 0e153dd00..000000000
--- a/test/file_view/2_files_2_folders_1_root.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-
- -
- root
-
- -
-
-
-
- -
- 0
-
-
-
- -
-
-
-
- -
- 1
-
-
-
-
diff --git a/test/file_view/nested_folders.txt b/test/file_view/nested_folders.txt
deleted file mode 100644
index 8d7fcc954..000000000
--- a/test/file_view/nested_folders.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-
- -
-
-
-
- -
-
-
-
- -
-
-
-
- -
- 0
-
-
-
- -
-
-
-
- -
- 1
-
-
-
-
-
-
-
- -
-
-
-
- -
- 2
-
-
-
-
diff --git a/test/test_file_view.rb b/test/test_file_view.rb
deleted file mode 100644
index 2789f08dc..000000000
--- a/test/test_file_view.rb
+++ /dev/null
@@ -1,132 +0,0 @@
-# ~*~ encoding: utf-8 ~*~
-require File.expand_path(File.join(File.dirname(__FILE__), 'helper'))
-require File.expand_path '../../lib/gollum-lib/file_view', __FILE__
-
-class FakeSane
- def clean(data)
- data
- end
-end
-
-class FakeWiki
- def sanitizer
- FakeSane.new
- end
-end
-
-class FakePage
- def initialize(filepath)
- @filepath = filepath
- end
-
- def wiki
- FakeWiki.new
- end
-
- # From page.rb
- def filename_stripped
- ::File.basename(@filepath, ::File.extname(@filepath))
- end
-
- def filename
- ::File.basename(@filepath)
- end
-
- def path
- return @filepath
- end
-
- # From page.rb
- def name
- self.class.canonicalize_filename @filepath
- end
-
- # From page.rb
- def self.strip_filename filename
- ::File.basename(filename, ::File.extname(filename))
- end
-
- # From page.rb
- def self.canonicalize_filename filename
- strip_filename(filename)
- end
-end
-
-class FakePages
- def initialize(filepath_array)
- @array = filepath_array.map { |filepath| FakePage.new filepath }
- end
-
- def first
- @array.first
- end
-
- def size
- @array.size
- end
-
- def [] index
- @array[index]
- end
-end
-
-def view(pages)
- Gollum::FileView.new(pages).render_files
-end
-
-def test_path
- @test_path ||= File.expand_path('../file_view/', __FILE__) + '/'
-end
-
-def read(file)
- File.read test_path + file + '.txt'
-end
-
-# For creating expected files.
-# write name, actual
-def write(file, content)
- File.open(test_path + file + '.txt', 'w') do |f|
- f.write content
- end
-end
-
-def check(name, pages_array)
- pages = FakePages.new pages_array
- expected = read name
- actual = view pages
-
- # Uncomment when updating tests
- # write name, actual
-
- assert_html_equal expected, actual
-end
-
-# Test Notes
-# root files must be before any folders.
-# Home.md => file at root folder
-# docs/sanitization.md => file within folder
-context 'file_view' do
- test 'one file' do
- check '1_file', ['0.md']
- end
-
- test 'one folder' do
- check '1_folder', ['folder0/']
- end
-
- test 'one file with one folder' do
- check '1_file_1_folder', ['folder0/0.md']
- end
-
- test 'two files with two folders' do
- check '2_files_2_folders', ['folder0/0.md', 'folder1/1.md']
- end
-
- test 'two files with two folders and one root file' do
- check '2_files_2_folders_1_root', ['root.md', 'folder0/0.md', 'folder1/1.md']
- end
-
- test 'nested folders' do
- check 'nested_folders', ['folder0/folder1/folder2/0.md', 'folder0/folder1/folder3/1.md', 'folder4/2.md']
- end
-end # context