gollum-lib 4.0.3-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +15 -0
  2. data/Gemfile +3 -0
  3. data/HISTORY.md +11 -0
  4. data/LICENSE +21 -0
  5. data/README.md +286 -0
  6. data/Rakefile +187 -0
  7. data/docs/sanitization.md +33 -0
  8. data/gemspec.rb +100 -0
  9. data/gollum-lib.gemspec +4 -0
  10. data/gollum-lib_java.gemspec +4 -0
  11. data/lib/gollum-lib.rb +64 -0
  12. data/lib/gollum-lib/blob_entry.rb +95 -0
  13. data/lib/gollum-lib/committer.rb +243 -0
  14. data/lib/gollum-lib/file.rb +158 -0
  15. data/lib/gollum-lib/file_view.rb +155 -0
  16. data/lib/gollum-lib/filter.rb +78 -0
  17. data/lib/gollum-lib/filter/code.rb +145 -0
  18. data/lib/gollum-lib/filter/macro.rb +57 -0
  19. data/lib/gollum-lib/filter/metadata.rb +29 -0
  20. data/lib/gollum-lib/filter/plain_text.rb +16 -0
  21. data/lib/gollum-lib/filter/remote_code.rb +63 -0
  22. data/lib/gollum-lib/filter/render.rb +20 -0
  23. data/lib/gollum-lib/filter/sanitize.rb +18 -0
  24. data/lib/gollum-lib/filter/tags.rb +320 -0
  25. data/lib/gollum-lib/filter/toc.rb +109 -0
  26. data/lib/gollum-lib/filter/wsd.rb +54 -0
  27. data/lib/gollum-lib/git_access.rb +247 -0
  28. data/lib/gollum-lib/gitcode.rb +48 -0
  29. data/lib/gollum-lib/helpers.rb +13 -0
  30. data/lib/gollum-lib/hook.rb +35 -0
  31. data/lib/gollum-lib/macro.rb +43 -0
  32. data/lib/gollum-lib/macro/all_pages.rb +11 -0
  33. data/lib/gollum-lib/markup.rb +197 -0
  34. data/lib/gollum-lib/markups.rb +20 -0
  35. data/lib/gollum-lib/page.rb +491 -0
  36. data/lib/gollum-lib/pagination.rb +62 -0
  37. data/lib/gollum-lib/sanitization.rb +176 -0
  38. data/lib/gollum-lib/version.rb +5 -0
  39. data/lib/gollum-lib/wiki.rb +925 -0
  40. data/licenses/licenses.txt +6 -0
  41. metadata +410 -0
@@ -0,0 +1,33 @@
1
+ Sanitization Rules
2
+ ==================
3
+
4
+ Gollum uses the [Sanitize](http://wonko.com/post/sanitize) gem for HTML
5
+ sanitization.
6
+
7
+ See `lib/gollum-lib/sanitization.rb` for actual settings.
8
+
9
+ ## ALLOWED TAGS
10
+
11
+ a, abbr, acronym, address, area, b, big, blockquote, br, button, caption,
12
+ center, cite, code, col, colgroup, dd, del, dfn, dir, div, dl, dt, em,
13
+ fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, i, img, input, ins, kbd,
14
+ label, legend, li, map, menu, ol, optgroup, option, p, pre, q, s, samp,
15
+ select, small, span, strike, strong, sub, sup, table, tbody, td, textarea,
16
+ tfoot, th, thead, tr, tt, u, ul, var
17
+
18
+ ## ALLOWED ATTRIBUTES
19
+
20
+ abbr, accept, accept-charset, accesskey, action, align, alt, axis, border,
21
+ cellpadding, cellspacing, char, charoff, charset, checked, cite, class, clear,
22
+ cols, colspan, color, compact, coords, datetime, dir, disabled, enctype, for,
23
+ frame, headers, height, href, hreflang, hspace, id, ismap, label, lang,
24
+ longdesc, maxlength, media, method, multiple, name, nohref, noshade, nowrap,
25
+ prompt, readonly, rel, rev, rows, rowspan, rules, scope, selected, shape,
26
+ size, span, src, start, summary, tabindex, target, title, type, usemap,
27
+ valign, value, vspace, width
28
+
29
+ ## ALLOWED PROTOCOLS
30
+
31
+ a href: http, https, mailto, ftp, irc, apt
32
+ img src: http, https
33
+ form action: http, https
data/gemspec.rb ADDED
@@ -0,0 +1,100 @@
1
+ def specification(version, default_adapter, platform = nil)
2
+ Proc.new do |s|
3
+ s.specification_version = 2 if s.respond_to? :specification_version=
4
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
5
+ s.rubygems_version = '0.0.1'
6
+ s.required_ruby_version = '>= 1.9'
7
+
8
+ s.name = 'gollum-lib'
9
+ s.version = version
10
+ s.platform = platform if platform
11
+ s.date = '2015-04-10'
12
+ s.rubyforge_project = 'gollum-lib'
13
+ s.license = 'MIT'
14
+
15
+ s.summary = 'A simple, Git-powered wiki.'
16
+ s.description = 'A simple, Git-powered wiki with a sweet API and local frontend.'
17
+
18
+ s.authors = ['Tom Preston-Werner', 'Rick Olson']
19
+ s.email = 'tom@github.com'
20
+ s.homepage = 'http://github.com/gollum/gollum-lib'
21
+
22
+ s.require_paths = %w[lib]
23
+
24
+ s.rdoc_options = ['--charset=UTF-8']
25
+ s.extra_rdoc_files = %w[README.md LICENSE]
26
+
27
+ s.add_dependency *default_adapter
28
+ s.add_dependency 'rouge', '~> 1.7.4'
29
+ s.add_dependency 'nokogiri', '~> 1.6.4'
30
+ s.add_dependency 'stringex', '~> 2.5.1'
31
+ s.add_dependency 'sanitize', '~> 2.1.0'
32
+ s.add_dependency 'github-markup', '~> 1.3.3'
33
+
34
+ s.add_development_dependency 'org-ruby', '~> 0.9.9'
35
+ s.add_development_dependency 'kramdown', '~> 1.6.0'
36
+ s.add_development_dependency 'RedCloth', '~> 4.2.9'
37
+ s.add_development_dependency 'mocha', '~> 1.1.0'
38
+ s.add_development_dependency 'shoulda', '~> 3.5.0'
39
+ s.add_development_dependency 'wikicloth', '~> 0.8.3'
40
+ s.add_development_dependency 'rake', '~> 10.4.0'
41
+ s.add_development_dependency 'pry', '~> 0.10.1'
42
+ # required by pry
43
+ s.add_development_dependency 'rb-readline', '~> 0.5.1'
44
+ # updating minitest-reporters requires a new minitest which fails with gollum's tests.
45
+ s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
46
+ s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
47
+ # required by guard
48
+ s.add_development_dependency 'guard', '~> 2.8.2'
49
+ s.add_development_dependency 'guard-minitest', '~> 2.3.2'
50
+ s.add_development_dependency 'rb-inotify', '~> 0.9.3'
51
+ s.add_development_dependency 'rb-fsevent', '~> 0.9.4'
52
+ s.add_development_dependency 'rb-fchange', '~> 0.0.6'
53
+ s.add_development_dependency 'twitter_cldr', '~> 3.1.0'
54
+ # = MANIFEST =
55
+ s.files = %w[
56
+ Gemfile
57
+ HISTORY.md
58
+ LICENSE
59
+ README.md
60
+ Rakefile
61
+ docs/sanitization.md
62
+ gemspec.rb
63
+ gollum-lib.gemspec
64
+ gollum-lib_java.gemspec
65
+ lib/gollum-lib.rb
66
+ lib/gollum-lib/blob_entry.rb
67
+ lib/gollum-lib/committer.rb
68
+ lib/gollum-lib/file.rb
69
+ lib/gollum-lib/file_view.rb
70
+ lib/gollum-lib/filter.rb
71
+ lib/gollum-lib/filter/code.rb
72
+ lib/gollum-lib/filter/macro.rb
73
+ lib/gollum-lib/filter/metadata.rb
74
+ lib/gollum-lib/filter/plain_text.rb
75
+ lib/gollum-lib/filter/remote_code.rb
76
+ lib/gollum-lib/filter/render.rb
77
+ lib/gollum-lib/filter/sanitize.rb
78
+ lib/gollum-lib/filter/tags.rb
79
+ lib/gollum-lib/filter/toc.rb
80
+ lib/gollum-lib/filter/wsd.rb
81
+ lib/gollum-lib/git_access.rb
82
+ lib/gollum-lib/gitcode.rb
83
+ lib/gollum-lib/helpers.rb
84
+ lib/gollum-lib/hook.rb
85
+ lib/gollum-lib/macro.rb
86
+ lib/gollum-lib/macro/all_pages.rb
87
+ lib/gollum-lib/markup.rb
88
+ lib/gollum-lib/markups.rb
89
+ lib/gollum-lib/page.rb
90
+ lib/gollum-lib/pagination.rb
91
+ lib/gollum-lib/sanitization.rb
92
+ lib/gollum-lib/version.rb
93
+ lib/gollum-lib/wiki.rb
94
+ licenses/licenses.txt
95
+ ]
96
+ # = MANIFEST =
97
+
98
+ s.test_files = s.files.select { |path| path =~ /^test\/test_.*\.rb/ }
99
+ end
100
+ end
@@ -0,0 +1,4 @@
1
+ require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
+ require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
3
+ default_adapter = ['gollum-grit_adapter', '~> 1.0']
4
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter)
@@ -0,0 +1,4 @@
1
+ require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
+ require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
3
+ default_adapter = ['gollum-rjgit_adapter', '~> 0.1']
4
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter, "java")
data/lib/gollum-lib.rb ADDED
@@ -0,0 +1,64 @@
1
+ # ~*~ encoding: utf-8 ~*~
2
+ # stdlib
3
+ require 'digest/md5'
4
+ require 'digest/sha1'
5
+ require 'ostruct'
6
+
7
+ DEFAULT_ADAPTER = RUBY_PLATFORM == 'java' ? 'rjgit_adapter' : 'grit_adapter'
8
+
9
+ if defined?(Gollum::GIT_ADAPTER)
10
+ require "#{Gollum::GIT_ADAPTER.downcase}_adapter"
11
+ else
12
+ require DEFAULT_ADAPTER
13
+ end
14
+
15
+ # external
16
+ require 'github/markup'
17
+ require 'sanitize'
18
+
19
+ # internal
20
+ require File.expand_path('../gollum-lib/git_access', __FILE__)
21
+ require File.expand_path('../gollum-lib/hook', __FILE__)
22
+ require File.expand_path('../gollum-lib/committer', __FILE__)
23
+ require File.expand_path('../gollum-lib/pagination', __FILE__)
24
+ require File.expand_path('../gollum-lib/blob_entry', __FILE__)
25
+ require File.expand_path('../gollum-lib/wiki', __FILE__)
26
+ require File.expand_path('../gollum-lib/page', __FILE__)
27
+ require File.expand_path('../gollum-lib/macro', __FILE__)
28
+ require File.expand_path('../gollum-lib/file', __FILE__)
29
+ require File.expand_path('../gollum-lib/file_view', __FILE__)
30
+ require File.expand_path('../gollum-lib/markup', __FILE__)
31
+ require File.expand_path('../gollum-lib/markups', __FILE__)
32
+ require File.expand_path('../gollum-lib/sanitization', __FILE__)
33
+ require File.expand_path('../gollum-lib/filter', __FILE__)
34
+
35
+ # Set ruby to UTF-8 mode
36
+ # This is required for Ruby 1.8.7 which gollum still supports.
37
+ $KCODE = 'U' if RUBY_VERSION[0, 3] == '1.8'
38
+
39
+ module Gollum
40
+
41
+ def self.assets_path
42
+ ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
43
+ end
44
+
45
+ class Error < StandardError; end
46
+
47
+ class DuplicatePageError < Error
48
+ attr_accessor :dir
49
+ attr_accessor :existing_path
50
+ attr_accessor :attempted_path
51
+
52
+ def initialize(dir, existing, attempted, message = nil)
53
+ @dir = dir
54
+ @existing_path = existing
55
+ @attempted_path = attempted
56
+ super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
57
+ end
58
+ end
59
+
60
+ class InvalidGitRepositoryError < StandardError; end
61
+ class NoSuchPathError < StandardError; end
62
+
63
+ end
64
+
@@ -0,0 +1,95 @@
1
+ # ~*~ encoding: utf-8 ~*~
2
+ module Gollum
3
+ class BlobEntry
4
+ # Gets the String SHA for this blob.
5
+ attr_reader :sha
6
+
7
+ # Gets the full path String for this blob.
8
+ attr_reader :path
9
+
10
+ # Gets the Fixnum size of this blob.
11
+ attr_reader :size
12
+
13
+ # Gets the Fixnum mode of this blob.
14
+ attr_reader :mode
15
+
16
+ def initialize(sha, path, size = nil, mode = nil)
17
+ @sha = sha
18
+ @path = path
19
+ @size = size
20
+ @mode = mode
21
+ @dir = @name = @blob = nil
22
+ end
23
+
24
+ # Gets the normalized directory path String for this blob.
25
+ def dir
26
+ @dir ||= self.class.normalize_dir(::File.dirname(@path))
27
+ end
28
+
29
+ # Gets the file base name String for this blob.
30
+ def name
31
+ @name ||= ::File.basename(@path)
32
+ end
33
+
34
+ # Gets a Gollum::Git::Blob instance for this blob.
35
+ #
36
+ # repo - Gollum::Git::Repo instance for the Gollum::Git::Blob.
37
+ #
38
+ # Returns an unbaked Gollum::Git::Blob instance.
39
+ def blob(repo)
40
+ @blob ||= Gollum::Git::Blob.create(repo,
41
+ :id => @sha, :name => name, :size => @size, :mode => @mode)
42
+ end
43
+
44
+ # Gets a Page instance for this blob.
45
+ #
46
+ # wiki - Gollum::Wiki instance for the Gollum::Page
47
+ #
48
+ # Returns a Gollum::Page instance.
49
+ def page(wiki, commit)
50
+ blob = self.blob(wiki.repo)
51
+ page = wiki.page_class.new(wiki).populate(blob, self.dir)
52
+ page.version = commit
53
+ page
54
+ end
55
+
56
+ # Gets a File instance for this blob.
57
+ #
58
+ # wiki - Gollum::Wiki instance for the Gollum::File
59
+ #
60
+ # Returns a Gollum::File instance.
61
+ def file(wiki, commit)
62
+ blob = self.blob(wiki.repo)
63
+ file = wiki.file_class.new(wiki).populate(blob, self.dir)
64
+ file.version = commit
65
+ file
66
+ end
67
+
68
+ def inspect
69
+ %(#<Gollum::BlobEntry #{@sha} #{@path}>)
70
+ end
71
+
72
+ # Normalizes a given directory name for searching through tree paths.
73
+ # Ensures that a directory begins with a slash, or
74
+ #
75
+ # normalize_dir("") # => ""
76
+ # normalize_dir(".") # => ""
77
+ # normalize_dir("foo") # => "/foo"
78
+ # normalize_dir("/foo/") # => "/foo"
79
+ # normalize_dir("/") # => ""
80
+ # normalize_dir("c:/") # => ""
81
+ #
82
+ # dir - String directory name.
83
+ #
84
+ # Returns a normalized String directory name, or nil if no directory
85
+ # is given.
86
+ def self.normalize_dir(dir)
87
+ return '' if dir =~ /^.:\/$/
88
+ if dir
89
+ dir = ::File.expand_path(dir, '/')
90
+ dir = '' if dir == '/'
91
+ end
92
+ dir
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,243 @@
1
+ # ~*~ encoding: utf-8 ~*~
2
+ module Gollum
3
+ # Responsible for handling the commit process for a Wiki. It sets up the
4
+ # Git index, provides methods for modifying the tree, and stores callbacks
5
+ # to be fired after the commit has been made. This is specifically
6
+ # designed to handle multiple updated pages in a single commit.
7
+ class Committer
8
+ # Gets the instance of the Gollum::Wiki that is being updated.
9
+ attr_reader :wiki
10
+
11
+ # Gets a Hash of commit options.
12
+ attr_reader :options
13
+
14
+ # Initializes the Committer.
15
+ #
16
+ # wiki - The Gollum::Wiki instance that is being updated.
17
+ # options - The commit Hash details:
18
+ # :message - The String commit message.
19
+ # :name - The String author full name.
20
+ # :email - The String email address.
21
+ # :parent - Optional Gollum::Git::Commit parent to this update.
22
+ # :tree - Optional String SHA of the tree to create the
23
+ # index from.
24
+ # :committer - Optional Gollum::Committer instance. If provided,
25
+ # assume that this operation is part of batch of
26
+ # updates and the commit happens later.
27
+ #
28
+ # Returns the Committer instance.
29
+ def initialize(wiki, options = {})
30
+ @wiki = wiki
31
+ @options = options
32
+ @callbacks = []
33
+ after_commit { |*args| Hook.execute(:post_commit, *args) }
34
+ end
35
+
36
+ # Public: References the Git index for this commit.
37
+ #
38
+ # Returns a Gollum::Git::Index.
39
+ def index
40
+ @index ||= begin
41
+ idx = @wiki.repo.index
42
+ if tree = options[:tree]
43
+ idx.read_tree(tree)
44
+ elsif parent = parents.first
45
+ idx.read_tree(parent.tree.id)
46
+ end
47
+ idx
48
+ end
49
+ end
50
+
51
+ # Public: The committer for this commit.
52
+ #
53
+ # Returns a Gollum::Git::Actor.
54
+ def actor
55
+ @actor ||= begin
56
+ @options[:name] = @wiki.default_committer_name if @options[:name].nil?
57
+ @options[:email] = @wiki.default_committer_email if @options[:email].nil?
58
+ Gollum::Git::Actor.new(@options[:name], @options[:email])
59
+ end
60
+ end
61
+
62
+ # Public: The parent commits to this pending commit.
63
+ #
64
+ # Returns an array of Gollum::Git::Commit instances.
65
+ def parents
66
+ @parents ||= begin
67
+ arr = [@options[:parent] || @wiki.repo.commit(@wiki.ref)]
68
+ arr.flatten!
69
+ arr.compact!
70
+ arr
71
+ end
72
+ end
73
+
74
+ # Adds a page to the given Index.
75
+ #
76
+ # dir - The String subdirectory of the Gollum::Page without any
77
+ # prefix or suffix slashes (e.g. "foo/bar").
78
+ # name - The String Gollum::Page filename_stripped.
79
+ # format - The Symbol Gollum::Page format.
80
+ # data - The String wiki data to store in the tree map.
81
+ # allow_same_ext - A Boolean determining if the tree map allows the same
82
+ # filename with the same extension.
83
+ #
84
+ # Raises Gollum::DuplicatePageError if a matching filename already exists.
85
+ # This way, pages are not inadvertently overwritten.
86
+ #
87
+ # Returns nothing (modifies the Index in place).
88
+ def add_to_index(dir, name, format, data, allow_same_ext = false)
89
+ # spaces must be dashes
90
+ dir.gsub!(' ', '-')
91
+ name.gsub!(' ', '-')
92
+
93
+ path = @wiki.page_file_name(name, format)
94
+
95
+ dir = '/' if dir.strip.empty?
96
+
97
+ fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact)
98
+ fullpath = fullpath[1..-1] if fullpath =~ /^\//
99
+
100
+ if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/')
101
+ tree = tree / dir unless tree.nil?
102
+ end
103
+
104
+ if tree
105
+ downpath = path.downcase.sub(/\.\w+$/, '')
106
+
107
+ tree.blobs.each do |blob|
108
+ next if page_path_scheduled_for_deletion?(index.tree, fullpath)
109
+
110
+ existing_file = blob.name.downcase.sub(/\.\w+$/, '')
111
+ existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
112
+
113
+ new_file_ext = ::File.extname(path).sub(/^\./, '')
114
+
115
+ if downpath == existing_file && !(allow_same_ext && new_file_ext == existing_file_ext)
116
+ raise DuplicatePageError.new(dir, blob.name, path)
117
+ end
118
+ end
119
+ end
120
+
121
+ fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
122
+
123
+ begin
124
+ data = @wiki.normalize(data)
125
+ rescue ArgumentError => err
126
+ # Swallow errors that arise from data being binary
127
+ raise err unless err.message.include?('invalid byte sequence')
128
+ end
129
+ index.add(fullpath, data)
130
+ end
131
+
132
+ # Update the given file in the repository's working directory if there
133
+ # is a working directory present.
134
+ #
135
+ # dir - The String directory in which the file lives.
136
+ # name - The String name of the page or the stripped filename
137
+ # (should be pre-canonicalized if required).
138
+ # format - The Symbol format of the page.
139
+ #
140
+ # Returns nothing.
141
+ def update_working_dir(dir, name, format)
142
+ unless @wiki.repo.bare
143
+ if @wiki.page_file_dir && dir !~ /^#{@wiki.page_file_dir}/
144
+ dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(@wiki.page_file_dir, dir)
145
+ end
146
+
147
+ path =
148
+ if dir == ''
149
+ @wiki.page_file_name(name, format)
150
+ else
151
+ ::File.join(dir, @wiki.page_file_name(name, format))
152
+ end
153
+
154
+ path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
155
+
156
+ Dir.chdir(::File.join(@wiki.repo.path, '..')) do
157
+ if file_path_scheduled_for_deletion?(index.tree, path)
158
+ @wiki.repo.git.rm(path, :force => true)
159
+ else
160
+ @wiki.repo.git.checkout(path, 'HEAD')
161
+ end
162
+ end
163
+ end
164
+ end
165
+
166
+ # Writes the commit to Git and runs the after_commit callbacks.
167
+ #
168
+ # Returns the String SHA1 of the new commit.
169
+ def commit
170
+ sha1 = index.commit(@options[:message], parents, actor, nil, @wiki.ref)
171
+ @callbacks.each do |cb|
172
+ cb.call(self, sha1)
173
+ end
174
+ sha1
175
+ end
176
+
177
+ # Adds a callback to be fired after a commit.
178
+ #
179
+ # block - A block that expects this Committer instance and the created
180
+ # commit's SHA1 as the arguments.
181
+ #
182
+ # Returns nothing.
183
+ def after_commit(&block)
184
+ @callbacks << block
185
+ end
186
+
187
+ # Determine if a given page (regardless of format) is scheduled to be
188
+ # deleted in the next commit for the given Index.
189
+ #
190
+ # map - The Hash map:
191
+ # key - The String directory or filename.
192
+ # val - The Hash submap or the String contents of the file.
193
+ # path - The String path of the page file. This may include the format
194
+ # extension in which case it will be ignored.
195
+ #
196
+ # Returns the Boolean response.
197
+ def page_path_scheduled_for_deletion?(map, path)
198
+ parts = path.split('/')
199
+ if parts.size == 1
200
+ deletions = map.keys.select { |k| !map[k] }
201
+ downfile = parts.first.downcase.sub(/\.\w+$/, '')
202
+ deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
203
+ else
204
+ part = parts.shift
205
+ if rest = map[part]
206
+ page_path_scheduled_for_deletion?(rest, parts.join('/'))
207
+ else
208
+ false
209
+ end
210
+ end
211
+ end
212
+
213
+ # Determine if a given file is scheduled to be deleted in the next commit
214
+ # for the given Index.
215
+ #
216
+ # map - The Hash map:
217
+ # key - The String directory or filename.
218
+ # val - The Hash submap or the String contents of the file.
219
+ # path - The String path of the file including extension.
220
+ #
221
+ # Returns the Boolean response.
222
+ def file_path_scheduled_for_deletion?(map, path)
223
+ parts = path.split('/')
224
+ if parts.size == 1
225
+ deletions = map.keys.select { |k| !map[k] }
226
+ deletions.any? { |d| d == parts.first }
227
+ else
228
+ part = parts.shift
229
+ if rest = map[part]
230
+ file_path_scheduled_for_deletion?(rest, parts.join('/'))
231
+ else
232
+ false
233
+ end
234
+ end
235
+ end
236
+
237
+ # Proxies methods t
238
+ def method_missing(name, *args)
239
+ args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
240
+ index.send(name, *args)
241
+ end
242
+ end
243
+ end