gollum-lib 5.0.a.4-java → 5.0.5-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -1
  3. data/HISTORY.md +4 -0
  4. data/README.md +12 -7
  5. data/Rakefile +8 -7
  6. data/gemspec.rb +17 -10
  7. data/gollum-lib.gemspec +8 -6
  8. data/gollum-lib_java.gemspec +2 -2
  9. data/lib/gollum-lib.rb +9 -9
  10. data/lib/gollum-lib/blob_entry.rb +2 -8
  11. data/lib/gollum-lib/committer.rb +23 -61
  12. data/lib/gollum-lib/file.rb +105 -82
  13. data/lib/gollum-lib/file_view.rb +8 -4
  14. data/lib/gollum-lib/filter.rb +12 -0
  15. data/lib/gollum-lib/filter/code.rb +9 -13
  16. data/lib/gollum-lib/filter/critic_markup.rb +97 -0
  17. data/lib/gollum-lib/filter/emoji.rb +11 -8
  18. data/lib/gollum-lib/filter/macro.rb +5 -2
  19. data/lib/gollum-lib/filter/plantuml.rb +1 -1
  20. data/lib/gollum-lib/filter/remote_code.rb +3 -2
  21. data/lib/gollum-lib/filter/render.rb +25 -2
  22. data/lib/gollum-lib/filter/sanitize.rb +1 -8
  23. data/lib/gollum-lib/filter/tags.rb +57 -46
  24. data/lib/gollum-lib/filter/toc.rb +17 -21
  25. data/lib/gollum-lib/filter/yaml.rb +1 -1
  26. data/lib/gollum-lib/git_access.rb +0 -25
  27. data/lib/gollum-lib/helpers.rb +13 -3
  28. data/lib/gollum-lib/macro.rb +4 -0
  29. data/lib/gollum-lib/macro/audio.rb +9 -0
  30. data/lib/gollum-lib/macro/global_toc.rb +2 -1
  31. data/lib/gollum-lib/macro/navigation.rb +8 -6
  32. data/lib/gollum-lib/macro/note.rb +19 -0
  33. data/lib/gollum-lib/macro/octicon.rb +12 -0
  34. data/lib/gollum-lib/macro/series.rb +2 -2
  35. data/lib/gollum-lib/macro/warn.rb +11 -0
  36. data/lib/gollum-lib/markup.rb +17 -32
  37. data/lib/gollum-lib/markups.rb +13 -8
  38. data/lib/gollum-lib/page.rb +80 -166
  39. data/lib/gollum-lib/pagination.rb +7 -6
  40. data/lib/gollum-lib/redirects.rb +42 -0
  41. data/lib/gollum-lib/sanitization.rb +32 -357
  42. data/lib/gollum-lib/version.rb +1 -1
  43. data/lib/gollum-lib/wiki.rb +216 -404
  44. metadata +65 -27
  45. data/ROADMAP +0 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3579bcfc342afcfe2b398241c190fbba84cfe2c5c922576aaaecb512bab5cd8
4
- data.tar.gz: 9387c63c0f369902cf50439b750864fc2c4f86834da46576da7e1c8dc51464c6
3
+ metadata.gz: 58d6a76ac3ff4e944c5954024fe52ba50cf208f86c9623131bb3aac6011c8540
4
+ data.tar.gz: 59b0439f772973507254aaa566e134984c5c1761f7242b4c09c9ef3fe9e34aab
5
5
  SHA512:
6
- metadata.gz: 4a9bfdbb8a78a024d9c66c4cfa3d185b4156c3bd86068006ea26977db3dcb456691863a19359917cd3e5d70bf5c92f261bd4b47b977d21727608c783b6f0ce58
7
- data.tar.gz: 29ac662c80e6b90fad991b7bb421486cf2b1a5b5a3838f342bbdfb0d26f23a6680a98cd6372077a5ed3e8e07578a9470600a4c9a427346fcc36700e735f8f9c5
6
+ metadata.gz: 047b9eae8522314a1cd2300fb6eacfa58376595a0ed84c514b35d0a1a61f16625bf12793f47b76339a328ae57add678b0829265086352de3d0cde285030131fc
7
+ data.tar.gz: 9ab4e40babd84d9baa3041e7212431fb05a95855dd428964e4d5467ebebd75b2405a1a7fbbb038a5ab8ca0ae14401f172eaf2f6f0e6fd8f510358e7b0f5cbb3c
data/Gemfile CHANGED
@@ -1,2 +1,3 @@
1
1
  source 'https://rubygems.org'
2
- gemspec :name => 'gollum-lib'
2
+
3
+ gemspec :name => 'gollum-lib'
data/HISTORY.md CHANGED
@@ -1,3 +1,7 @@
1
+ # v5.0.1
2
+
3
+ Bugfix release: fix emoji when using base path. Thanks to @heavywatal.
4
+
1
5
  # v5.0
2
6
 
3
7
  For a detailed overview of changes in 5.0 and a guide to migrating your wiki, see https://github.com/gollum/gollum/wiki/5.0-release-notes
data/README.md CHANGED
@@ -19,10 +19,9 @@ Gollum-lib follows the rules of [Semantic Versioning](http://semver.org/) and us
19
19
 
20
20
  ## SYSTEM REQUIREMENTS
21
21
 
22
- - Python 2.5+ (2.7.3 recommended)
23
- - Ruby 2.1.0+ (>= 2.3.3 recommended)
22
+ - Ruby 2.4.0+
24
23
  - Unix like operating system (OS X, Ubuntu, Debian, and more)
25
- - Will not work on Windows with the default [grit](https://github.com/github/grit) adapter, but might work via JRuby (please let us know!)
24
+ - Will not work on Windows with the default [rugged](https://github.com/github/grit) adapter, but works via JRuby.
26
25
 
27
26
  ## INSTALLATION
28
27
 
@@ -92,7 +91,13 @@ Note that `base_path` just modifies the links.
92
91
  Get the latest version of the given human or canonical page name:
93
92
 
94
93
  ```ruby
95
- page = wiki.page('page-name')
94
+ page = wiki.page('/page name') # Finds pages in the root directory of the wiki that are named 'page name' with a valid extension.
95
+ # => <Gollum::Page>
96
+
97
+ page = wiki.page('page name') # For convenience, you can leave out the '/' in front. Paths are assumed to be relative to '/'.
98
+ # => <Gollum::Page>
99
+
100
+ page = wiki.page('page name.md') # You can also specifiy the extension explicitly to disambiguate between pages with the same name, but different formats.
96
101
  # => <Gollum::Page>
97
102
 
98
103
  page.raw_data
@@ -141,7 +146,7 @@ vsns.first.authored_date
141
146
  Get a specific version of a given canonical page file:
142
147
 
143
148
  ```ruby
144
- wiki.page('page-name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
149
+ wiki.page('page name', '5ec521178e0eec4dc39741a8978a2ba6616d0f0a')
145
150
  ```
146
151
 
147
152
  Get the latest version of a given static file:
@@ -182,10 +187,10 @@ commit = { :message => 'commit message',
182
187
  ```
183
188
 
184
189
  Write a new version of a page (the file will be created if it does not already
185
- exist) and commit the change. The file will be written at the repo root.
190
+ exist) and commit the change. The file will be written at the repo root if no subdirectory is specified.
186
191
 
187
192
  ```ruby
188
- wiki.write_page('Page Name', :markdown, 'Page contents', commit)
193
+ wiki.write_page('Subdirectory/Page Name', :markdown, 'Page contents', commit)
189
194
  ```
190
195
 
191
196
  Update an existing page. If the format is different than the page's current
data/Rakefile CHANGED
@@ -51,11 +51,11 @@ def gemspec_file
51
51
  end
52
52
 
53
53
  def gemspecs
54
- ["#{name}.gemspec", "#{name}_java.gemspec"]
54
+ ["#{name}.gemspec", "#{name}_java.gemspec"]
55
55
  end
56
56
 
57
57
  def gem_files
58
- ["#{name}-#{version}.gem", "#{name}-#{version}-java.gem"]
58
+ ["#{name}-#{version}.gem", "#{name}-#{version}-java.gem"]
59
59
  end
60
60
 
61
61
  def replace_header(head, header_name)
@@ -75,6 +75,7 @@ Rake::TestTask.new(:test) do |test|
75
75
  test.libs << 'lib' << 'test' << '.'
76
76
  test.pattern = 'test/**/test_*.rb'
77
77
  test.verbose = true
78
+ test.warning = false
78
79
  end
79
80
 
80
81
  desc "Generate RCov test coverage and open in your browser"
@@ -107,7 +108,7 @@ end
107
108
 
108
109
  desc "Build and install"
109
110
  task :install => :build do
110
- sh "gem install --local --no-ri --no-rdoc pkg/#{name}-#{version}.gem"
111
+ sh "gem install --local --no-document pkg/#{name}-#{version}.gem"
111
112
  end
112
113
 
113
114
  #############################################################################
@@ -118,14 +119,14 @@ end
118
119
 
119
120
  desc 'Create a release build'
120
121
  task :release => :build do
121
- unless `git branch` =~ /gollum-lib-5.x/
122
- puts "You must be on the gollum-lib-5.x branch to release!"
122
+ unless `git branch` =~ /master/
123
+ puts "You must be on the master branch to release!"
123
124
  exit!
124
125
  end
125
126
  sh "git commit --allow-empty -a -m 'Release #{version}'"
126
- sh "git pull --rebase origin gollum-lib-5.x"
127
+ sh "git pull --rebase origin master"
127
128
  sh "git tag v#{version}"
128
- sh "git push origin gollum-lib-5.x"
129
+ sh "git push origin master"
129
130
  sh "git push origin v#{version}"
130
131
  sh "gem push pkg/#{name}-#{version}.gem"
131
132
  sh "gem push pkg/#{name}-#{version}-java.gem"
data/gemspec.rb CHANGED
@@ -3,12 +3,12 @@ def specification(version, default_adapter, platform = nil)
3
3
  s.specification_version = 2 if s.respond_to? :specification_version=
4
4
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
5
5
  s.rubygems_version = '0.0.1'
6
- s.required_ruby_version = '>= 2.1'
6
+ s.required_ruby_version = '>= 2.4'
7
7
 
8
8
  s.name = 'gollum-lib'
9
9
  s.version = version
10
10
  s.platform = platform if platform
11
- s.date = '2018-09-17'
11
+ s.date = '2020-08-03'
12
12
  s.date = '2017-04-13'
13
13
  s.rubyforge_project = 'gollum-lib'
14
14
  s.license = 'MIT'
@@ -28,27 +28,29 @@ def specification(version, default_adapter, platform = nil)
28
28
  s.add_dependency *default_adapter
29
29
  s.add_dependency 'rouge', '~> 3.1'
30
30
  s.add_dependency 'nokogiri', '~> 1.8'
31
- s.add_dependency 'stringex', '~> 2.6'
32
- s.add_dependency 'sanitize', '~> 2.1'
33
- s.add_dependency 'github-markup', '~> 1.6'
34
- s.add_dependency 'gemojione', '~> 3.2'
31
+ s.add_dependency 'loofah', '~> 2.3'
32
+ s.add_dependency 'github-markup', '~> 3.0'
33
+ s.add_dependency 'gemojione', '~> 4.1'
34
+ s.add_dependency 'octicons', '~> 8.5'
35
35
  s.add_dependency 'twitter-text', '1.14.7'
36
36
 
37
37
  s.add_development_dependency 'org-ruby', '~> 0.9.9'
38
- s.add_development_dependency 'kramdown', '~> 1.13'
38
+ s.add_development_dependency 'kramdown', '~> 2.1.0'
39
+ s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1.0'
39
40
  s.add_development_dependency 'RedCloth', '~> 4.2.9'
40
41
  s.add_development_dependency 'mocha', '~> 1.2.0'
41
42
  s.add_development_dependency 'shoulda', '~> 3.5.0'
42
43
  s.add_development_dependency 'wikicloth', '~> 0.8.3'
43
44
  s.add_development_dependency 'bibtex-ruby', '~> 4.3'
44
45
  s.add_development_dependency 'citeproc-ruby', '~> 1.1'
45
- s.add_development_dependency 'rake', '~> 10.4.0'
46
+ s.add_development_dependency 'unicode_utils', '~> 1.4.0' # required by citeproc-ruby on ruby < 2.4
47
+ s.add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
46
48
  s.add_development_dependency 'pry', '~> 0.10.1'
47
49
  # required by pry
48
50
  s.add_development_dependency 'rb-readline', '~> 0.5.1'
49
51
  # updating minitest-reporters requires a new minitest which fails with gollum's tests.
50
52
  s.add_development_dependency 'test-unit', '~> 3.1.5'
51
- s.add_development_dependency 'minitest-reporters', '~> 0.14.16'
53
+ s.add_development_dependency 'minitest-reporters', '~> 1.4'
52
54
  s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
53
55
  # required by guard
54
56
  s.add_development_dependency 'guard', '~> 2.8.2'
@@ -63,7 +65,6 @@ def specification(version, default_adapter, platform = nil)
63
65
  HISTORY.md
64
66
  LICENSE
65
67
  README.md
66
- ROADMAP
67
68
  Rakefile
68
69
  docs/sanitization.md
69
70
  gemspec.rb
@@ -77,6 +78,7 @@ def specification(version, default_adapter, platform = nil)
77
78
  lib/gollum-lib/filter.rb
78
79
  lib/gollum-lib/filter/bibtex.rb
79
80
  lib/gollum-lib/filter/code.rb
81
+ lib/gollum-lib/filter/critic_markup.rb
80
82
  lib/gollum-lib/filter/emoji.rb
81
83
  lib/gollum-lib/filter/macro.rb
82
84
  lib/gollum-lib/filter/pandoc_bib.rb
@@ -93,14 +95,19 @@ def specification(version, default_adapter, platform = nil)
93
95
  lib/gollum-lib/hook.rb
94
96
  lib/gollum-lib/macro.rb
95
97
  lib/gollum-lib/macro/all_pages.rb
98
+ lib/gollum-lib/macro/audio.rb
96
99
  lib/gollum-lib/macro/global_toc.rb
97
100
  lib/gollum-lib/macro/navigation.rb
101
+ lib/gollum-lib/macro/note.rb
102
+ lib/gollum-lib/macro/octicon.rb
98
103
  lib/gollum-lib/macro/series.rb
99
104
  lib/gollum-lib/macro/video.rb
105
+ lib/gollum-lib/macro/warn.rb
100
106
  lib/gollum-lib/markup.rb
101
107
  lib/gollum-lib/markups.rb
102
108
  lib/gollum-lib/page.rb
103
109
  lib/gollum-lib/pagination.rb
110
+ lib/gollum-lib/redirects.rb
104
111
  lib/gollum-lib/sanitization.rb
105
112
  lib/gollum-lib/version.rb
106
113
  lib/gollum-lib/wiki.rb
@@ -1,8 +1,10 @@
1
1
  require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
2
  require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
3
- if RUBY_PLATFORM == 'java' then
4
- default_adapter = ['gollum-rjgit_adapter', '~> 0.3']
5
- else
6
- default_adapter = ['gollum-grit_adapter', '~> 1.0']
7
- end
8
- Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter)
3
+ # This file needs to conditionally define the default adapter for MRI and Java, because this is the file that is included from the Gemfile.
4
+ # In addition, the default Java adapter needs to be defined in gollum-lib_java.gemspec beause that file is used to *build* the Java gem.
5
+ if RUBY_PLATFORM == 'java' then
6
+ default_adapter = ['gollum-rjgit_adapter', '~> 0.6']
7
+ else
8
+ default_adapter = ['gollum-rugged_adapter', '~> 1.0']
9
+ end
10
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter)
@@ -1,4 +1,4 @@
1
1
  require File.join(File.dirname(__FILE__), 'gemspec.rb')
2
2
  require File.join(File.dirname(__FILE__), 'lib', 'gollum-lib', 'version.rb')
3
- default_adapter = ['gollum-rjgit_adapter', '~> 0.3']
4
- Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter, "java")
3
+ default_adapter = ['gollum-rjgit_adapter', '~> 0.6']
4
+ Gem::Specification.new &specification(Gollum::Lib::VERSION, default_adapter, "java")
@@ -5,15 +5,17 @@ require 'digest/sha1'
5
5
  require 'ostruct'
6
6
  require 'pathname'
7
7
 
8
- DEFAULT_ADAPTER = RUBY_PLATFORM == 'java' ? 'rjgit' : 'grit'
8
+ DEFAULT_ADAPTER = RUBY_PLATFORM == 'java' ? 'rjgit' : 'rugged'
9
9
 
10
+ module Gollum; end
10
11
  Gollum::GIT_ADAPTER = DEFAULT_ADAPTER if !defined?(Gollum::GIT_ADAPTER)
11
12
  require "#{Gollum::GIT_ADAPTER.downcase}_adapter"
12
13
 
13
14
  # external
14
15
  require 'github/markup'
15
- require 'sanitize'
16
+ require 'erb'
16
17
  require 'gemojione'
18
+ require 'loofah'
17
19
 
18
20
  # internal
19
21
  require File.expand_path('../gollum-lib/git_access', __FILE__)
@@ -22,9 +24,10 @@ require File.expand_path('../gollum-lib/committer', __FILE__)
22
24
  require File.expand_path('../gollum-lib/pagination', __FILE__)
23
25
  require File.expand_path('../gollum-lib/blob_entry', __FILE__)
24
26
  require File.expand_path('../gollum-lib/wiki', __FILE__)
27
+ require File.expand_path('../gollum-lib/redirects', __FILE__)
28
+ require File.expand_path('../gollum-lib/file', __FILE__)
25
29
  require File.expand_path('../gollum-lib/page', __FILE__)
26
30
  require File.expand_path('../gollum-lib/macro', __FILE__)
27
- require File.expand_path('../gollum-lib/file', __FILE__)
28
31
  require File.expand_path('../gollum-lib/file_view', __FILE__)
29
32
  require File.expand_path('../gollum-lib/markup', __FILE__)
30
33
  require File.expand_path('../gollum-lib/markups', __FILE__)
@@ -40,19 +43,16 @@ module Gollum
40
43
  class Error < StandardError; end
41
44
 
42
45
  class DuplicatePageError < Error
43
- attr_accessor :dir
44
- attr_accessor :existing_path
45
46
  attr_accessor :attempted_path
46
47
 
47
- def initialize(dir, existing, attempted, message = nil)
48
- @dir = dir
49
- @existing_path = existing
48
+ def initialize(attempted, message = nil)
50
49
  @attempted_path = attempted
51
- super(message || "Cannot write #{@dir}/#{@attempted_path}, found #{@dir}/#{@existing_path}.")
50
+ super(message || "Cannot write #{@attempted_path}: path already exists.")
52
51
  end
53
52
  end
54
53
 
55
54
  class InvalidGitRepositoryError < StandardError; end
56
55
  class NoSuchPathError < StandardError; end
56
+ class IllegalDirectoryPath < StandardError; end
57
57
 
58
58
  end
@@ -47,10 +47,7 @@ module Gollum
47
47
  #
48
48
  # Returns a Gollum::Page instance.
49
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
50
+ ::Gollum::Page.new(wiki, self.blob(wiki.repo), self.dir, commit)
54
51
  end
55
52
 
56
53
  # Gets a File instance for this blob.
@@ -59,10 +56,7 @@ module Gollum
59
56
  #
60
57
  # Returns a Gollum::File instance.
61
58
  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
59
+ ::Gollum::File.new(wiki, self.blob(wiki.repo), self.dir, commit)
66
60
  end
67
61
 
68
62
  def inspect
@@ -30,7 +30,6 @@ module Gollum
30
30
  @wiki = wiki
31
31
  @options = options
32
32
  @callbacks = []
33
- after_commit { |*args| Hook.execute(:post_commit, *args) }
34
33
  end
35
34
 
36
35
  # Public: References the Git index for this commit.
@@ -55,7 +54,7 @@ module Gollum
55
54
  @actor ||= begin
56
55
  @options[:name] = @wiki.default_committer_name if @options[:name].nil?
57
56
  @options[:email] = @wiki.default_committer_email if @options[:email].nil?
58
- Gollum::Git::Actor.new(@options[:name], @options[:email])
57
+ Gollum::Git::Actor.new(@options[:name], @options[:email], @options[:time])
59
58
  end
60
59
  end
61
60
 
@@ -71,82 +70,46 @@ module Gollum
71
70
  end
72
71
  end
73
72
 
74
- # Adds a page to the given Index.
73
+ # Adds a path to the Index.
75
74
  #
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.
75
+ # path - The String path to be added
80
76
  # data - The String wiki data to store in the tree map.
81
77
  #
82
- # Raises Gollum::DuplicatePageError if a matching filename already exists.
78
+ # Raises Gollum::DuplicatePageError if a matching filename already exists, unless force_overwrite is explicitly enabled.
83
79
  # This way, pages are not inadvertently overwritten.
84
80
  #
85
81
  # Returns nothing (modifies the Index in place).
86
- def add_to_index(dir, name, format, data)
87
- path = @wiki.page_file_name(name, format)
88
-
89
- dir = '/' if dir.strip.empty?
90
-
91
- fullpath = ::File.join(*[dir, path])
92
- fullpath = fullpath[1..-1] if fullpath =~ /^\//
93
-
94
- if index.current_tree && (tree = index.current_tree / (@wiki.page_file_dir || '/'))
95
- tree = tree / dir unless tree.nil?
96
- end
97
-
98
- if tree
99
- downpath = path.downcase.sub(/\.\w+$/, '')
100
-
101
- tree.blobs.each do |blob|
102
- next if page_path_scheduled_for_deletion?(index.tree, fullpath)
103
-
104
- existing_file = blob.name.downcase.sub(/\.\w+$/, '')
105
- existing_file_ext = ::File.extname(blob.name).sub(/^\./, '')
106
-
107
- new_file_ext = ::File.extname(path).sub(/^\./, '')
108
-
109
- if downpath == existing_file && (new_file_ext == existing_file_ext)
110
- raise DuplicatePageError.new(dir, blob.name, path)
111
- end
82
+ def add_to_index(path, data, options = {}, force_overwrite = false)
83
+ if tree = index.current_tree
84
+ unless page_path_scheduled_for_deletion?(index.tree, path) || force_overwrite
85
+ raise DuplicatePageError.new(path) if tree / path
112
86
  end
113
87
  end
114
88
 
115
- fullpath = fullpath.force_encoding('ascii-8bit') if fullpath.respond_to?(:force_encoding)
116
-
117
- begin
118
- data = @wiki.normalize(data)
119
- rescue ArgumentError => err
120
- # Swallow errors that arise from data being binary
121
- raise err unless err.message.include?('invalid byte sequence')
89
+ unless options[:normalize] == false
90
+ begin
91
+ data = @wiki.normalize(data)
92
+ rescue ArgumentError => err
93
+ # Swallow errors that arise from data being binary
94
+ raise err unless err.message.include?('invalid byte sequence')
95
+ end
122
96
  end
123
- index.add(fullpath, data)
97
+ index.add(path, data)
124
98
  end
125
99
 
126
100
  # Update the given file in the repository's working directory if there
127
101
  # is a working directory present.
128
102
  #
129
- # dir - The String directory in which the file lives.
130
- # name - The String name of the page or the stripped filename
131
- # (should be pre-canonicalized if required).
132
- # format - The Symbol format of the page.
103
+ # path - The String path to update
133
104
  #
134
105
  # Returns nothing.
135
- def update_working_dir(dir, name, format)
106
+ def update_working_dir(path)
136
107
  unless @wiki.repo.bare
137
- if @wiki.page_file_dir && dir !~ /^#{@wiki.page_file_dir}/
138
- dir = dir.size.zero? ? @wiki.page_file_dir : ::File.join(@wiki.page_file_dir, dir)
108
+ if @wiki.page_file_dir && !path.start_with?(@wiki.page_file_dir)
109
+ # Skip the path if it is not under the wiki's page file dir
110
+ return nil
139
111
  end
140
112
 
141
- path =
142
- if dir == ''
143
- @wiki.page_file_name(name, format)
144
- else
145
- ::File.join(dir, @wiki.page_file_name(name, format))
146
- end
147
-
148
- path = path.force_encoding('ascii-8bit') if path.respond_to?(:force_encoding)
149
-
150
113
  Dir.chdir(::File.join(@wiki.repo.path, '..')) do
151
114
  if file_path_scheduled_for_deletion?(index.tree, path)
152
115
  @wiki.repo.git.rm(path, :force => true)
@@ -165,6 +128,7 @@ module Gollum
165
128
  @callbacks.each do |cb|
166
129
  cb.call(self, sha1)
167
130
  end
131
+ Hook.execute(:post_commit, self, sha1)
168
132
  sha1
169
133
  end
170
134
 
@@ -192,8 +156,7 @@ module Gollum
192
156
  parts = path.split('/')
193
157
  if parts.size == 1
194
158
  deletions = map.keys.select { |k| !map[k] }
195
- downfile = parts.first.downcase.sub(/\.\w+$/, '')
196
- deletions.any? { |d| d.downcase.sub(/\.\w+$/, '') == downfile }
159
+ deletions.any? { |d| d == parts.first }
197
160
  else
198
161
  part = parts.shift
199
162
  if (rest = map[part])
@@ -230,7 +193,6 @@ module Gollum
230
193
 
231
194
  # Proxies methods t
232
195
  def method_missing(name, *args)
233
- args.map! { |item| item.respond_to?(:force_encoding) ? item.force_encoding('ascii-8bit') : item }
234
196
  index.send(name, *args)
235
197
  end
236
198
  end