gollum 5.2.3 → 5.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +41 -0
- data/Gemfile +18 -4
- data/HISTORY.md +3 -3
- data/LATEST_CHANGES.md +13 -0
- data/README.md +38 -26
- data/Rakefile +55 -12
- data/bin/gollum +6 -4
- data/bin/gollum-migrate-tags +40 -28
- data/docker-run.sh +18 -0
- data/gollum.gemspec +19 -14
- data/lib/gollum/app.rb +66 -42
- data/lib/gollum/public/assets/.sprockets-manifest-160337b312f8e438181baac4aaa37319.json +1 -0
- data/lib/gollum/public/assets/{app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css → app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css} +1 -1
- data/lib/gollum/public/assets/{app-ad43ca64b295d8444b10f22ee868f18429268af498f1bc515434878b690e37a2.css.gz → app-309be032396e783b13a47df58f389b7c8e11c2b2d42640560b874f677c25f6e5.css.gz} +0 -0
- data/lib/gollum/public/assets/{app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js → app-f05401ee374f0c7f48fc2bc08e30b4f4db705861fd5895ed70998683b383bfb5.js} +2 -2
- data/lib/gollum/public/assets/{app-0fd228e26bfbe6fe31a2da268eb0e98e780c1191c1a918adf383377946e9c838.js.gz → app-f05401ee374f0c7f48fc2bc08e30b4f4db705861fd5895ed70998683b383bfb5.js.gz} +0 -0
- data/lib/gollum/public/assets/criticmarkup-31ae5d3282bbb8e7b7c3c9917e9fb68e3315a6b4a75da6cec48d21b8846905c4.css.gz +0 -0
- data/lib/gollum/public/assets/{editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js → editor-9881d0c7ae663293f0e3a7e72729eec7e940fa613185c076709b76d292f5703a.js} +2 -2
- data/lib/gollum/public/assets/{editor-db10c8351306e92f1926ba225d0cd9c8e886482b3b9820a85825ec3abab5f1cf.js.gz → editor-9881d0c7ae663293f0e3a7e72729eec7e940fa613185c076709b76d292f5703a.js.gz} +0 -0
- data/lib/gollum/public/assets/print-512498c368be0d3fb1ba105dfa84289ae48380ec9fcbef948bd4e23b0b095bfb.css.gz +0 -0
- data/lib/gollum/public/gollum/javascript/app.js +1 -0
- data/lib/gollum/public/gollum/javascript/date.min.js +123 -0
- data/lib/gollum/public/gollum/javascript/editor/gollum.editor.js +1 -1
- data/lib/gollum/public/gollum/javascript/gollum.js.erb +20 -2
- data/lib/gollum/public/gollum/stylesheets/editor.scss +1 -0
- data/lib/gollum/public/gollum/stylesheets/template.scss.erb +8 -0
- data/lib/gollum/templates/commit.mustache +4 -2
- data/lib/gollum/templates/compare.mustache +10 -4
- data/lib/gollum/templates/create.mustache +7 -4
- data/lib/gollum/templates/edit.mustache +7 -4
- data/lib/gollum/templates/history.mustache +10 -3
- data/lib/gollum/templates/latest_changes.mustache +8 -5
- data/lib/gollum/templates/layout.mustache +1 -0
- data/lib/gollum/templates/navbar.mustache +9 -2
- data/lib/gollum/templates/overview.mustache +7 -4
- data/lib/gollum/templates/search.mustache +7 -1
- data/lib/gollum/templates/wiki_content.mustache +4 -2
- data/lib/gollum/views/commit.rb +4 -0
- data/lib/gollum/views/create.rb +3 -2
- data/lib/gollum/views/edit.rb +2 -5
- data/lib/gollum/views/has_math.rb +11 -0
- data/lib/gollum/views/helpers/locale_helpers.rb +82 -0
- data/lib/gollum/views/history.rb +17 -12
- data/lib/gollum/views/latest_changes.rb +15 -10
- data/lib/gollum/views/layout.rb +6 -1
- data/lib/gollum/views/page.rb +23 -18
- data/lib/gollum/views/template_cascade.rb +40 -0
- data/lib/gollum.rb +10 -6
- metadata +55 -28
- data/lib/gollum/public/assets/.sprockets-manifest-de7bb79aec424e55af1acdcc4237b301.json +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc6498c3f4201b606f4fc3919ce8c900b708e95f4599e8d768eb449f7265b422
|
4
|
+
data.tar.gz: c777311336b3da982568b1d6200bed36fef5f1d4cacdebb94fd3dbdd507faa8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24f98884dcef45d1522c94c74da652c72b4ec350b78eb7f073f38144eb30aae41451dd3daefdf751902b17ff20da3a03ba327b82f97859b253428dba97fac868
|
7
|
+
data.tar.gz: 7ec0150d4a1d0f9246924cde38ce0e951059838f9df2a915320f7af83d85b445d7959cdefddc8aaf067fa40a8e486c3be33db2cbbd8699ecde897b3825759d03
|
data/Dockerfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
FROM ruby:2.7-alpine AS builder
|
2
|
+
|
3
|
+
RUN apk add \
|
4
|
+
build-base \
|
5
|
+
cmake \
|
6
|
+
git \
|
7
|
+
icu-dev \
|
8
|
+
openssl-dev
|
9
|
+
|
10
|
+
COPY Gemfile* /tmp/
|
11
|
+
COPY gollum.gemspec* /tmp/
|
12
|
+
WORKDIR /tmp
|
13
|
+
RUN bundle install
|
14
|
+
|
15
|
+
RUN gem install \
|
16
|
+
asciidoctor \
|
17
|
+
creole \
|
18
|
+
wikicloth \
|
19
|
+
org-ruby \
|
20
|
+
RedCloth \
|
21
|
+
bibtex-ruby \
|
22
|
+
&& echo "gem-extra complete"
|
23
|
+
|
24
|
+
WORKDIR /app
|
25
|
+
COPY . /app
|
26
|
+
RUN bundle exec rake install
|
27
|
+
|
28
|
+
|
29
|
+
FROM ruby:2.7-alpine
|
30
|
+
|
31
|
+
COPY --from=builder /usr/local/bundle/ /usr/local/bundle/
|
32
|
+
|
33
|
+
RUN apk add \
|
34
|
+
bash \
|
35
|
+
git \
|
36
|
+
libc6-compat
|
37
|
+
|
38
|
+
VOLUME /wiki
|
39
|
+
WORKDIR /wiki
|
40
|
+
COPY docker-run.sh /docker-run.sh
|
41
|
+
ENTRYPOINT ["/docker-run.sh"]
|
data/Gemfile
CHANGED
@@ -1,9 +1,23 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
gem 'warbler', platforms: :jruby
|
4
|
+
|
5
|
+
# FIXME:
|
6
|
+
#
|
7
|
+
# There's an issue in 1.12.5 that causes XHTML elements to be generated badly,
|
8
|
+
# causing Gollum's test suite to fail.[1] The issue has been fixed upstream,
|
9
|
+
# but we're still waiting for a new Nokogiri point release.
|
10
|
+
#
|
11
|
+
# However, 1.12.5 is a security patch, so we don't want end users to use an
|
12
|
+
# older version of Nokogiri. But this is safe to do in our CI environment.
|
13
|
+
#
|
14
|
+
# Once there's a new Nokogiri release, we can remove this dependency and JRuby
|
15
|
+
# CI should pass normally again.
|
16
|
+
#
|
17
|
+
# Note that Nokogiri 1.11+ does not support Ruby v2.4.x anymore. So to make our
|
18
|
+
# current CI workflows pass, we should only try to install this version of
|
19
|
+
# Nokogiri for newer Ruby versions.
|
6
20
|
|
7
21
|
gemspec
|
8
22
|
|
9
|
-
gem 'rake', '~> 13.0'
|
23
|
+
gem 'rake', '~> 13.0'
|
data/HISTORY.md
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
# 5.2.3 2021-04-18
|
1
|
+
# 5.2.3 / 2021-04-18
|
2
2
|
|
3
3
|
* Fix bug preventing page titles from being displayed
|
4
4
|
|
5
|
-
# 5.2.1 2021-02-25
|
5
|
+
# 5.2.1 / 2021-02-25
|
6
6
|
|
7
7
|
* Fix include call to a missing asset (@benjaminwil). This caused slow first page loads on JRuby.
|
8
8
|
|
9
|
-
# 5.2 2021-02-24
|
9
|
+
# 5.2 / 2021-02-24
|
10
10
|
|
11
11
|
* Improved styling and Primer upgrade (@benjaminwil)
|
12
12
|
* Add redirect to rename commit (@ViChyavIn)
|
data/LATEST_CHANGES.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# 5.3.0 / 2022-05-24
|
2
|
+
|
3
|
+
* Feature: allow for overriding only specific Mustache templates/partials (@beporter)
|
4
|
+
* Feature: Add option to show browser's local time (@NikitaIvanovV)
|
5
|
+
* Improvement: presentation on mobile devises (@benjaminwil)
|
6
|
+
* Improvement: Add page context to template filter. #1603 (@tevino)
|
7
|
+
* Fix: restore normalize check on file upload (@manofstick)
|
8
|
+
* Fix mathjax on edit and create pages. #1772 (@fhchl)
|
9
|
+
* Fix utf-8 issues: #1721 #1758 #1801 (@basking2, @dometto)
|
10
|
+
* Fix an IME rendering issue. #1735 (@yy0931)
|
11
|
+
* Fix broken history button when viewing historical deleted file. (@NikitaIvanovV)
|
12
|
+
* Fix: non-ascii characters in page names are not rendered correctly in the preview tab of the "Edit" page. #1739 (@yy0931)
|
13
|
+
* Fix: anchors and header display on JRuby. #1779
|
data/README.md
CHANGED
@@ -2,23 +2,27 @@ gollum -- A git-based Wiki
|
|
2
2
|
====================================
|
3
3
|
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/gollum.svg)](http://badge.fury.io/rb/gollum)
|
5
|
-
|
5
|
+
![Build Status](https://github.com/gollum/gollum/actions/workflows/test.yaml/badge.svg)
|
6
6
|
[![Open Source Helpers](https://www.codetriage.com/gollum/gollum/badges/users.svg)](https://www.codetriage.com/gollum/gollum)
|
7
7
|
[![Cutting Edge Dependency Status](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/svg 'Cutting Edge Dependency Status')](https://dometto-cuttingedge.herokuapp.com/github/gollum/gollum/info)
|
8
|
+
[![Docker Pulls](https://img.shields.io/docker/pulls/gollumwiki/gollum)](https://hub.docker.com/r/gollumwiki/gollum)
|
8
9
|
|
9
|
-
|
10
|
+
See the [wiki](https://github.com/gollum/gollum/wiki) for extensive documentation, along with [screenshots](https://github.com/gollum/gollum/wiki/Screenshots) of Gollum's features.
|
10
11
|
|
11
12
|
## DESCRIPTION
|
12
13
|
|
13
14
|
Gollum is a simple wiki system built on top of Git. A Gollum Wiki is simply a git repository of a specific nature:
|
15
|
+
|
14
16
|
* A Gollum repository's contents are human-editable text or markup files.
|
15
17
|
* Pages may be organized into directories any way you choose.
|
16
18
|
* Other content can also be included, for example images, PDFs and headers/footers for your pages.
|
17
19
|
* Gollum pages:
|
18
20
|
* May be written in a variety of [markups](#markups).
|
19
|
-
* Can be edited with your favourite
|
21
|
+
* Can be edited with your favourite editor (changes will be visible after committing) or with the built-in web interface.
|
20
22
|
* Can be displayed in all versions, reverted, etc.
|
21
|
-
* Gollum strives to be compatible with GitHub
|
23
|
+
* Gollum strives to be [compatible](https://github.com/gollum/gollum/wiki/5.0-release-notes#compatibility-option) with [GitHub](https://docs.github.com/en/communities/documenting-your-project-with-wikis/about-wikis) and [GitLab](https://docs.gitlab.com/ee/user/project/wiki/#create-or-edit-wiki-pages-locally) wikis.
|
24
|
+
* Just clone your GitHub/GitLab wiki and view and edit it locally!
|
25
|
+
|
22
26
|
* Gollum supports advanced functionality like:
|
23
27
|
* [UML diagrams](https://github.com/gollum/gollum/wiki#plantuml-diagrams)
|
24
28
|
* [BibTeX and Citation support](https://github.com/gollum/gollum/wiki/BibTeX-and-Citations)
|
@@ -31,41 +35,48 @@ Gollum is a simple wiki system built on top of Git. A Gollum Wiki is simply a gi
|
|
31
35
|
|
32
36
|
### SYSTEM REQUIREMENTS
|
33
37
|
|
34
|
-
Gollum runs on Unix-like systems using its [adapter](https://github.com/gollum/rugged_adapter) for [rugged](https://github.com/libgit2/rugged)
|
38
|
+
Gollum runs on Unix-like systems using its default [adapter](https://github.com/gollum/rugged_adapter) for [rugged](https://github.com/libgit2/rugged). You can also run Gollum on [JRuby](https://github.com/jruby/jruby) via its [adapter](https://github.com/repotag/gollum-lib_rjgit_adapter) for [RJGit](https://github.com/repotag/rjgit/). On Windows, Gollum runs only on JRuby.
|
35
39
|
|
36
40
|
## INSTALLATION
|
37
41
|
|
38
|
-
|
39
|
-
|
42
|
+
### As a Ruby Gem
|
43
|
+
|
44
|
+
Ruby is best installed either via [RVM](https://rvm.io/) or a package manager of choice. Then simply:
|
40
45
|
```
|
41
|
-
|
46
|
+
gem install gollum
|
42
47
|
```
|
43
48
|
|
44
49
|
Installation examples for individual systems can be seen [here](https://github.com/gollum/gollum/wiki/Installation).
|
45
50
|
|
46
51
|
To run, simply:
|
47
52
|
|
48
|
-
1. Run: `gollum /path/to/wiki
|
53
|
+
1. Run: `gollum /path/to/wiki` where `/path/to/wiki` is an initialized Git repository.
|
49
54
|
2. Open `http://localhost:4567` in your browser.
|
50
55
|
|
56
|
+
### Via Docker
|
57
|
+
|
58
|
+
See [here](https://github.com/gollum/gollum/wiki/Gollum-via-Docker) for instructions on how to run Gollum via Docker.
|
59
|
+
|
60
|
+
### Misc
|
61
|
+
|
51
62
|
See [below](#running-from-source) for information on running Gollum from source, as a Rack app, and more.
|
52
63
|
|
53
|
-
|
64
|
+
## MARKUPS
|
54
65
|
|
55
66
|
Gollum allows using different markup languages on different wiki pages. It presently ships with support for the following markups:
|
56
67
|
* [Markdown](http://daringfireball.net/projects/markdown/syntax) (see [below](#Markdown-flavors) for more information on Markdown flavors)
|
57
68
|
* [RDoc](http://rdoc.sourceforge.net/)
|
58
69
|
|
59
70
|
You can easily activate support for other markups by installing additional renderers (any that are supported by [github-markup](https://github.com/github/markup)):
|
60
|
-
* [AsciiDoc](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/) -- `
|
61
|
-
* [Creole](http://www.wikicreole.org/wiki/CheatSheet) -- `
|
62
|
-
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `
|
63
|
-
* [Org](http://orgmode.org/worg/dev/org-syntax.html) -- `
|
71
|
+
* [AsciiDoc](http://asciidoctor.org/docs/asciidoc-syntax-quick-reference/) -- `gem install asciidoctor`
|
72
|
+
* [Creole](http://www.wikicreole.org/wiki/CheatSheet) -- `gem install creole`
|
73
|
+
* [MediaWiki](http://www.mediawiki.org/wiki/Help:Formatting) -- `gem install wikicloth`
|
74
|
+
* [Org](http://orgmode.org/worg/dev/org-syntax.html) -- `gem install org-ruby`
|
64
75
|
* [Pod](http://perldoc.perl.org/perlpod.html) -- requires Perl >= 5.10 (the `perl` command must be available on your command line)
|
65
76
|
* Lower versions should install `Pod::Simple` from CPAN.
|
66
|
-
* [ReStructuredText](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html) -- requires python >=
|
67
|
-
* Note that Gollum will also need you to install `docutils` for
|
68
|
-
* [Textile](http://redcloth.org/hobix.com/textile/quick.html) -- `
|
77
|
+
* [ReStructuredText](http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html) -- requires python >= 3
|
78
|
+
* Note that Gollum will also need you to install `docutils` for python
|
79
|
+
* [Textile](http://redcloth.org/hobix.com/textile/quick.html) -- `gem install RedCloth`
|
69
80
|
|
70
81
|
### Markdown flavors
|
71
82
|
|
@@ -83,19 +94,15 @@ See [here](https://github.com/gollum/gollum/wiki/Custom-rendering-gems) for inst
|
|
83
94
|
|
84
95
|
### Rack
|
85
96
|
|
86
|
-
Gollum can also be
|
97
|
+
Gollum can also be run with any [rack-compatible web server](https://github.com/rack/rack#supported-web-servers). More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Rack).
|
87
98
|
|
88
99
|
### Rack, with an authentication server
|
89
100
|
|
90
|
-
Gollum can also be
|
91
|
-
|
92
|
-
### Docker
|
93
|
-
|
94
|
-
Gollum can also be ran via [Docker](https://www.docker.com/). More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Docker).
|
101
|
+
Gollum can also be run alongside a CAS (Central Authentication Service) SSO (single sign-on) server. With a bit of tweaking, this adds basic user-support to Gollum. To see an example and an explanation, navigate [over here](https://github.com/gollum/gollum/wiki/Gollum-via-Rack-and-CAS-SSO).
|
95
102
|
|
96
103
|
### Service
|
97
104
|
|
98
|
-
Gollum can also be
|
105
|
+
Gollum can also be run as a service. More on that [over here](https://github.com/gollum/gollum/wiki/Gollum-as-a-service).
|
99
106
|
|
100
107
|
## CONFIGURATION
|
101
108
|
|
@@ -105,7 +112,7 @@ Gollum comes with the following command line options:
|
|
105
112
|
| ----------------- | --------- | ----------- |
|
106
113
|
| --host | [HOST] | Specify the hostname or IP address to listen on. Default: '0.0.0.0'.<sup>1</sup> |
|
107
114
|
| --port | [PORT] | Specify the port to bind Gollum with. Default: `4567`. |
|
108
|
-
| --config | [FILE] | Specify path to Gollum's configuration file. |
|
115
|
+
| --config | [FILE] | Specify path to Gollum's [configuration file](#Config-file). |
|
109
116
|
| --ref | [REF] | Specify the git branch to serve. Default: `master`. |
|
110
117
|
| --bare | none | Tell Gollum that the git repository should be treated as bare. |
|
111
118
|
| --adapter | [ADAPTER] | Launch Gollum using a specific git adapter. Default: `rugged`.<sup>2</sup> |
|
@@ -116,6 +123,7 @@ Gollum comes with the following command line options:
|
|
116
123
|
| --css | none | Tell Gollum to inject custom CSS into each page. Uses `custom.css` from wiki root.<sup>3</sup> |
|
117
124
|
| --js | none | Tell Gollum to inject custom JS into each page. Uses `custom.js` from wiki root.<sup>3</sup> |
|
118
125
|
| --no-edit | none | Disable the feature of editing pages. |
|
126
|
+
| --local-time | none | Use the browser's local timezone instead of the server's for displaying dates. Default: false.
|
119
127
|
| --follow-renames, --no-follow-renames | none | Follow pages across renames in the History view. Default: true.
|
120
128
|
| --allow-uploads | [MODE] | Enable file uploads. If set to `dir`, Gollum will store all uploads in the `/uploads/` directory in repository root. If set to `page`, Gollum will store each upload at the currently edited page.<sup>4</sup> |
|
121
129
|
| --mathjax | none | Enables MathJax (renders mathematical equations). By default, uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.<sup>5</sup> |
|
@@ -125,7 +133,7 @@ Gollum comes with the following command line options:
|
|
125
133
|
| --no-display-metadata | none | Do not render metadata tables in pages. |
|
126
134
|
| --user-icons | [MODE] | Tell Gollum to use specific user icons for history view. Can be set to `gravatar`, `identicon` or `none`. Default: `none`. |
|
127
135
|
| --mathjax-config | [FILE] | Specify path to a custom MathJax configuration. If not specified, uses the `mathjax.config.js` file from repository root. |
|
128
|
-
| --template-dir | [PATH] | Specify custom mustache template directory. |
|
136
|
+
| --template-dir | [PATH] | Specify custom mustache template directory. Only overrides templates that exist in this directory. |
|
129
137
|
| --template-page | none | Use _Template in root as a template for new pages. Must be committed. |
|
130
138
|
| --emoji | none | Parse and interpret emoji tags (e.g. `:heart:`) except when the leading colon is backslashed (e.g. `\:heart:`). |
|
131
139
|
| --lenient-tag-lookup | none | Internal links resolve case-insensitively, will treat spaces as hyphens, and will match the first page found with a certain filename, anywhere in the repository. Provides compatibility with Gollum 4.x. |
|
@@ -149,3 +157,7 @@ When `--config` option is used, certain inner parts of Gollum can be customized.
|
|
149
157
|
## CONTRIBUTING
|
150
158
|
|
151
159
|
Please consider helping out! See [CONTRIBUTING](CONTRIBUTING.md) for information on how to submit issues, and how to start hacking on gollum.
|
160
|
+
|
161
|
+
## THANKS TO
|
162
|
+
|
163
|
+
[![Testing Powered By SauceLabs](https://opensource.saucelabs.com/images/opensauce/powered-by-saucelabs-badge-gray.png?sanitize=true "Testing Powered By SauceLabs")](https://saucelabs.com)
|
data/Rakefile
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
require 'date'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
#############################################################################
|
6
7
|
#
|
@@ -8,6 +9,10 @@ require 'date'
|
|
8
9
|
#
|
9
10
|
#############################################################################
|
10
11
|
|
12
|
+
def date
|
13
|
+
Time.now.strftime("%Y-%m-%d")
|
14
|
+
end
|
15
|
+
|
11
16
|
def name
|
12
17
|
@name ||= Dir['*.gemspec'].first.split('.').first
|
13
18
|
end
|
@@ -17,6 +22,14 @@ def version
|
|
17
22
|
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
18
23
|
end
|
19
24
|
|
25
|
+
def latest_changes_file
|
26
|
+
'LATEST_CHANGES.md'
|
27
|
+
end
|
28
|
+
|
29
|
+
def history_file
|
30
|
+
'HISTORY.md'
|
31
|
+
end
|
32
|
+
|
20
33
|
# assumes x.y.z all digit version
|
21
34
|
def next_version
|
22
35
|
# x.y.z
|
@@ -38,14 +51,6 @@ def bump_version
|
|
38
51
|
new_version
|
39
52
|
end
|
40
53
|
|
41
|
-
def date
|
42
|
-
Date.today.to_s
|
43
|
-
end
|
44
|
-
|
45
|
-
def rubyforge_project
|
46
|
-
name
|
47
|
-
end
|
48
|
-
|
49
54
|
def gemspec_file
|
50
55
|
"#{name}.gemspec"
|
51
56
|
end
|
@@ -114,6 +119,7 @@ task :release => :build do
|
|
114
119
|
puts "You must be on the master branch to release!"
|
115
120
|
exit!
|
116
121
|
end
|
122
|
+
Rake::Task[:changelog].execute
|
117
123
|
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
118
124
|
sh "git pull --rebase origin master"
|
119
125
|
sh "git tag v#{version}"
|
@@ -143,12 +149,9 @@ task :gemspec => :validate do
|
|
143
149
|
spec = File.read(gemspec_file)
|
144
150
|
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
145
151
|
|
146
|
-
# replace name
|
152
|
+
# replace name and version
|
147
153
|
replace_header(head, :name)
|
148
154
|
replace_header(head, :version)
|
149
|
-
replace_header(head, :date)
|
150
|
-
#comment this out if your rubyforge_project has a different name
|
151
|
-
replace_header(head, :rubyforge_project)
|
152
155
|
|
153
156
|
# determine file list from git ls-files
|
154
157
|
files = `git ls-files`.
|
@@ -179,6 +182,46 @@ task :validate do
|
|
179
182
|
end
|
180
183
|
end
|
181
184
|
|
185
|
+
desc 'Build changlog'
|
186
|
+
task :changelog do
|
187
|
+
[latest_changes_file, history_file].each do |f|
|
188
|
+
unless File.exists?(f)
|
189
|
+
puts "#{f} does not exist but is required to build a new release."
|
190
|
+
exit!
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
latest_changes = File.open(latest_changes_file)
|
195
|
+
version_pattern = "# #{version}"
|
196
|
+
|
197
|
+
if !`grep "#{version_pattern}" #{history_file}`.empty?
|
198
|
+
puts "#{version} is already described in #{history_file}"
|
199
|
+
exit!
|
200
|
+
end
|
201
|
+
|
202
|
+
begin
|
203
|
+
unless latest_changes.readline.chomp! =~ %r{#{version_pattern}}
|
204
|
+
puts "#{latest_changes_file} should begin with '#{version_pattern}'"
|
205
|
+
exit!
|
206
|
+
end
|
207
|
+
rescue EOFError
|
208
|
+
puts "#{latest_changes_file} is empty!"
|
209
|
+
exit!
|
210
|
+
end
|
211
|
+
|
212
|
+
body = latest_changes.read
|
213
|
+
body.scan(/\s*#\s+\d\.\d.*/) do |match|
|
214
|
+
puts "#{latest_changes_file} may not contain multiple markdown headers!"
|
215
|
+
exit!
|
216
|
+
end
|
217
|
+
|
218
|
+
temp = Tempfile.new
|
219
|
+
temp.puts("#{version_pattern} / #{date}\n#{body}\n")
|
220
|
+
temp.close
|
221
|
+
`cat #{history_file} >> #{temp.path}`
|
222
|
+
`cat #{temp.path} > #{history_file}`
|
223
|
+
end
|
224
|
+
|
182
225
|
desc 'Precompile assets'
|
183
226
|
task :precompile do
|
184
227
|
require './lib/gollum/app.rb'
|
data/bin/gollum
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
1
|
+
#!/usr/bin/env -S ruby -Eutf-8
|
2
2
|
|
3
3
|
$:.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
4
|
|
@@ -112,6 +112,9 @@ MSG
|
|
112
112
|
opts.on('--no-edit', 'Disable the feature of editing pages.') do
|
113
113
|
wiki_options[:allow_editing] = false
|
114
114
|
end
|
115
|
+
opts.on('--local-time', "Use the browser's local timezone instead of the server's for displaying dates.") do
|
116
|
+
wiki_options[:show_local_time] = true
|
117
|
+
end
|
115
118
|
opts.on('--follow-renames', 'Follow pages across renames in the History view. Default: true.') do
|
116
119
|
wiki_options[:follow_renames] = true
|
117
120
|
end
|
@@ -149,7 +152,7 @@ MSG
|
|
149
152
|
'Can be set to \'gravatar\' or \'identicon\'. Default: standard avatar.') do |mode|
|
150
153
|
wiki_options[:user_icons] = mode.to_s
|
151
154
|
end
|
152
|
-
opts.on('--template-dir [PATH]', 'Specify custom mustache template directory.') do |path|
|
155
|
+
opts.on('--template-dir [PATH]', 'Specify custom mustache template directory. Only overrides templates that exist in this directory.') do |path|
|
153
156
|
wiki_options[:template_dir] = path
|
154
157
|
end
|
155
158
|
opts.on('--template-page', 'Use _Template.{ext} as a template for new pages.') do
|
@@ -206,7 +209,7 @@ begin
|
|
206
209
|
rescue OptionParser::InvalidOption => e
|
207
210
|
puts "gollum: #{e.message}"
|
208
211
|
puts 'gollum: try \'gollum --help\' for more information'
|
209
|
-
exit
|
212
|
+
exit 1
|
210
213
|
end
|
211
214
|
|
212
215
|
# --gollum-path wins over ARGV[0]
|
@@ -271,7 +274,6 @@ else
|
|
271
274
|
Precious::App.set(:environment, ENV.fetch('RACK_ENV', :production).to_sym)
|
272
275
|
Precious::App.set(:gollum_path, gollum_path)
|
273
276
|
Precious::App.set(:wiki_options, wiki_options)
|
274
|
-
Precious::App.settings.mustache[:templates] = wiki_options[:template_dir] if wiki_options[:template_dir]
|
275
277
|
|
276
278
|
if cfg = options[:config]
|
277
279
|
# If the path begins with a '/' it will be considered an absolute path,
|
data/bin/gollum-migrate-tags
CHANGED
@@ -11,8 +11,11 @@ migrate_options = {
|
|
11
11
|
:hyphenate => true
|
12
12
|
}
|
13
13
|
|
14
|
-
def setting(
|
15
|
-
|
14
|
+
def setting(variable_name)
|
15
|
+
class_variable_name = :"@@#{variable_name.to_s}"
|
16
|
+
|
17
|
+
Object.class_variable_defined?(class_variable_name) &&
|
18
|
+
Object.class_variable_get(class_variable_name)
|
16
19
|
end
|
17
20
|
|
18
21
|
opts = OptionParser.new do |opts|
|
@@ -25,7 +28,7 @@ It finds and repairs Gollum link tags that no longer work under 5.x for three re
|
|
25
28
|
* 5.x wiki internal links are no longer 'global'.
|
26
29
|
|
27
30
|
* NB: you can use the --lenient-tag-lookup option in gollum >= 5.x to enable 4.x-backwards compatible tags.
|
28
|
-
|
31
|
+
|
29
32
|
See https://github.com/gollum/gollum/wiki/5.0-release-notes#filename-handling for more information.
|
30
33
|
Usage of this script comes without any warranty.
|
31
34
|
|
@@ -38,7 +41,7 @@ You can use the --page-file-dir and --config options as you would normally with
|
|
38
41
|
Requires a non-bare repository. Recommended usage:
|
39
42
|
|
40
43
|
1. Clone your wiki's repository to create a backup.
|
41
|
-
2. Run this script on your cloned repo.
|
44
|
+
2. Run this script on your cloned repo.
|
42
45
|
3. If all looks sane, run the script with the --write option. This will overwrite files in your working directory, but not commit the changes, so you have time to review them.
|
43
46
|
4. Do a 'git diff' to inspect the changes.
|
44
47
|
5. Commit the changes if all looks sane, and push/pull them back into your original repo.
|
@@ -52,23 +55,23 @@ EOF
|
|
52
55
|
opts.on('--page-file-dir [PATH]', 'Specify the subdirectory for all pages. Default: repository root.') do |path|
|
53
56
|
wiki_options[:page_file_dir] = path
|
54
57
|
end
|
55
|
-
|
58
|
+
|
56
59
|
opts.on('--prefer-relative-links', 'When specified, will try to replace broken links with relative links (\'[[Foo/Bar]]\' instead of \'[[/Subdir/Foo/Bar]]\') where possible.') do
|
57
60
|
migrate_options[:prefer_relative] = true
|
58
61
|
end
|
59
|
-
|
62
|
+
|
60
63
|
opts.on('--hyphenate', 'Default. Repair links that use spaces instead of hyphens: [[Bilbo Baggins]] -> [[Bilbo-Baggins]]') do
|
61
64
|
migrate_options[:hyphenate] = true
|
62
65
|
end
|
63
|
-
|
66
|
+
|
64
67
|
opts.on('--no-hyphenate', 'Turn off the --hyphenate option.') do
|
65
68
|
migrate_options[:hyphenate] = false
|
66
69
|
end
|
67
|
-
|
70
|
+
|
68
71
|
opts.on('--run-silent', 'Don\'t output anything.') do
|
69
72
|
migrate_options[:run_silent] = true
|
70
73
|
end
|
71
|
-
|
74
|
+
|
72
75
|
opts.on('--write', 'No dry run: actually perform the substitutions.') do
|
73
76
|
migrate_options[:no_dry_run] = true
|
74
77
|
end
|
@@ -78,8 +81,11 @@ end
|
|
78
81
|
begin
|
79
82
|
opts.parse!
|
80
83
|
migrate_options.each do |setting, value|
|
81
|
-
|
82
|
-
|
84
|
+
variable_name = :"@@#{setting.to_s}"
|
85
|
+
|
86
|
+
unless Object.class_variable_defined?(variable_name)
|
87
|
+
Object.class_variable_set(variable_name, value)
|
88
|
+
end
|
83
89
|
end
|
84
90
|
wiki_options[:page_file_dir] = setting(:page_file_dir) ? setting(:page_file_dir) : wiki_options[:page_file_dir] # Allow settings :page_file_dir through PAGE_FILE_DIR constant.
|
85
91
|
rescue OptionParser::InvalidOption
|
@@ -88,7 +94,7 @@ rescue OptionParser::InvalidOption
|
|
88
94
|
exit
|
89
95
|
end
|
90
96
|
|
91
|
-
|
97
|
+
wiki_directory = ARGV[0] || Dir.pwd
|
92
98
|
|
93
99
|
require 'gollum-lib'
|
94
100
|
|
@@ -98,7 +104,7 @@ if cfg = options[:config]
|
|
98
104
|
cfg = File.join(Dir.getwd, cfg) unless cfg.slice(0) == File::SEPARATOR
|
99
105
|
require cfg
|
100
106
|
end
|
101
|
-
|
107
|
+
|
102
108
|
class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
|
103
109
|
def extract(data)
|
104
110
|
case @markup.format
|
@@ -126,7 +132,7 @@ class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
|
|
126
132
|
next '' if m_end.length < m_start.length
|
127
133
|
lang = m_lang ? m_lang.strip.split.first : nil
|
128
134
|
cache_codeblock($~.to_s)
|
129
|
-
end
|
135
|
+
end
|
130
136
|
end
|
131
137
|
|
132
138
|
data.gsub!(/^([ ]{0,3})``` ?([^\r\n]+)?\r?\n(.+?)\r?\n[ ]{0,3}```[ \t]*\r?$/m) do
|
@@ -134,7 +140,7 @@ class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
|
|
134
140
|
end
|
135
141
|
data
|
136
142
|
end
|
137
|
-
|
143
|
+
|
138
144
|
def process(data)
|
139
145
|
return data if data.nil? || data.size.zero? || @map.size.zero?
|
140
146
|
@map.each do |id, block| ## Just put the code blocks back in verbatim
|
@@ -142,23 +148,23 @@ class Gollum::Filter::CodeMigrator < Gollum::Filter::Code
|
|
142
148
|
end
|
143
149
|
data
|
144
150
|
end
|
145
|
-
|
151
|
+
|
146
152
|
def cache_codeblock(block)
|
147
153
|
id = "#{open_pattern}#{Digest::SHA1.hexdigest(block)}#{close_pattern}"
|
148
154
|
@map[id] = block
|
149
155
|
id
|
150
156
|
end
|
151
157
|
end
|
152
|
-
|
158
|
+
|
153
159
|
class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
|
154
160
|
def process_tag(tag)
|
155
161
|
link_part, extra = parse_tag_parts(tag)
|
156
162
|
orig_tag = %{[[#{tag}]]}
|
157
163
|
return orig_tag if link_part.nil?
|
158
|
-
|
164
|
+
|
159
165
|
img_args = extra ? [extra, link_part] : [link_part]
|
160
166
|
mime = MIME::Types.type_for(::File.extname(img_args.first.to_s)).first
|
161
|
-
|
167
|
+
|
162
168
|
# For any kind of tag other than an internal link: just return the tag.
|
163
169
|
if tag =~ /^_TOC_/ || link_part =~ /^_$/ || link_part =~ /^#{INCLUDE_TAG}/ || (mime && mime.content_type =~ /^image/) || process_external_link_tag(link_part, extra) || process_file_link_tag(link_part, extra)
|
164
170
|
return orig_tag
|
@@ -168,7 +174,7 @@ class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
|
|
168
174
|
link = link_part
|
169
175
|
page = find_page_or_file_from_path(link)
|
170
176
|
anchor = nil
|
171
|
-
|
177
|
+
|
172
178
|
if page.nil? # No match yet, now try finding the page with anchor removed
|
173
179
|
if pos = link.rindex('#')
|
174
180
|
anchor = link[pos..-1]
|
@@ -203,12 +209,12 @@ class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
|
|
203
209
|
pick = possibles.first
|
204
210
|
return tag_for_pick(pick, orig_tag, extra, anchor, @markup.page.path)
|
205
211
|
end
|
206
|
-
|
212
|
+
|
207
213
|
end
|
208
214
|
end
|
209
|
-
|
215
|
+
|
210
216
|
private
|
211
|
-
|
217
|
+
|
212
218
|
def tag_for_pick(pick, orig_tag, extra, anchor, linking_page_path)
|
213
219
|
pick = if setting(:prefer_relative)
|
214
220
|
overlapping_path = Pathname.new(linking_page_path).dirname.to_s
|
@@ -220,7 +226,7 @@ class ::Gollum::Filter::TagMigrator < Gollum::Filter::Tags
|
|
220
226
|
end
|
221
227
|
new_tag = extra.nil? ? %{[[#{pick}#{anchor}]]} : %{[[#{extra}|#{pick}#{anchor}]]}
|
222
228
|
log(:info, "#{@markup.page.path}: Changing #{orig_tag} -> #{new_tag}")
|
223
|
-
new_tag
|
229
|
+
new_tag
|
224
230
|
end
|
225
231
|
end
|
226
232
|
|
@@ -232,8 +238,12 @@ end
|
|
232
238
|
|
233
239
|
filter_chain = [:PlainTextMigrator, :CodeMigrator, :TagMigrator]
|
234
240
|
|
235
|
-
wiki = ::Gollum::Wiki.new(
|
236
|
-
|
241
|
+
wiki = ::Gollum::Wiki.new(wiki_directory, wiki_options.merge({:filter_chain => filter_chain}))
|
242
|
+
|
243
|
+
Object.class_variable_set(
|
244
|
+
:"@@wiki_tree",
|
245
|
+
wiki.tree_list(wiki.ref, true, true).map {|file| ::File.join('/', file.path)}
|
246
|
+
)
|
237
247
|
|
238
248
|
def find_linked(link)
|
239
249
|
link.gsub!(' ', '-') if setting(:hyphenate) # Match paths containing dashes instead of spaces
|
@@ -243,7 +253,9 @@ def find_linked(link)
|
|
243
253
|
test_path = ::File.extname(link).empty? ? /#{link}\..+/ : link
|
244
254
|
# Select pages from the wiki whose path =~ 'Foo/Bar/Samwi.*'
|
245
255
|
# Match case-insenstively to mimic 4.x behavior!
|
246
|
-
|
256
|
+
Object.class_variable_get(:"@@wiki_tree").select { |path|
|
257
|
+
path =~ /^\/(.*\/)?#{test_path}/i
|
258
|
+
}
|
247
259
|
end
|
248
260
|
|
249
261
|
def log(kind, msg = nil)
|
@@ -268,4 +280,4 @@ wiki.pages.each do |page|
|
|
268
280
|
f.close
|
269
281
|
end
|
270
282
|
log(:none, '====')
|
271
|
-
end
|
283
|
+
end
|
data/docker-run.sh
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# Initialize the wiki
|
4
|
+
if [ ! -d .git ]; then
|
5
|
+
git init
|
6
|
+
fi
|
7
|
+
|
8
|
+
# Set git user.name and user.email
|
9
|
+
if [ ${GOLLUM_AUTHOR_USERNAME:+1} ]; then
|
10
|
+
git config user.name "${GOLLUM_AUTHOR_USERNAME}"
|
11
|
+
fi
|
12
|
+
if [ ${GOLLUM_AUTHOR_EMAIL:+1} ]; then
|
13
|
+
git config user.email "${GOLLUM_AUTHOR_EMAIL}"
|
14
|
+
fi
|
15
|
+
|
16
|
+
# Start gollum service
|
17
|
+
[[ "$@" != *--mathjax* ]] && echo "WARNING: Mathjax will soon be disabled by default. To explicitly enable it, use --mathjax" >&2
|
18
|
+
exec gollum $@ --mathjax
|