103 Commits

Author SHA1 Message Date
benjamin wil 95d35d38da Switch from TestUnit to Minitest (#1805)
* Use `Minitest::Test`

`Test::Unit` is deprecated, and we can switch to `Minitest::Test` with
almost no side effects.

This commit does all of the work required to make Minitest tests run
with Gollum's existing test helpers.

* Change Minitest output format

- The `DefaultReporter` seems to have cleaner output than what we had
  before.
- `color: true` ensures things are colorized. It's pretty nice.

* Tweak test formatting; fix order-dependent failure

The order-dependent failure has been been commented in code.

After manually bisecting the test suite, I was able to determine that
the template cascade tests were leaving the `@@template_priority_path`
set to an overridden value in tests run afterward.

* Tweak setting initialization

I could not see a meaningful reason behind calling `forbid` so early in
the settings initialization block. But moving the `forbid` call until
later resolved this issue.

In the real world, I don't see how this would cause issues. But I found
that calling `forbid` when `wiki_options[:allow_editing]` was set to
false caused order-dependent test errors where Sprockets would end up
being badly configured and left without an initialized
`Sprockets::Environment` object, which is required by the
`sprockets-helpers` gem to resolve asset paths.

The test that would cause errors is also in this commit diff. I've
updated it to be a bit more readable.

I also took this opportunity to review and clean up the `@allow_editing`
assignment, which seemed a bit obfuscated.

* Update migration script to test run warnings

When running the entire test suite, many warnings would be output:

/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant HYPHENATE
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of HYPHENATE was here
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant PAGE_FILE_DIR
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of PAGE_FILE_DIR was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: already initialized constant REPO
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: previous definition of REPO was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: already initialized constant TREE
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: previous definition of TREE was here
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: already initialized constant PAGE_FILE_DIR
/Users/bw/Projects/gollum/test/test_migrate.rb:37: warning: previous definition of PAGE_FILE_DIR was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: already initialized constant REPO
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:91: warning: previous definition of REPO was here
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: already initialized constant TREE
/Users/bw/Projects/gollum/bin/gollum-migrate-tags:236: warning: previous definition of TREE was here

While it's unlikely that end users would ever see these warnings, as
they'd only be running the migration script once, they will always be
shown in our local test runs and CI run output.

So instead of using constants in our migration script, I change the
script to use class variables instead. This should not effect the
functionality of the migration script whatsoever.

* Use `File.exist?` instead of `File.exists?`

In Ruby 3.x, `File.exists?` is deprecated and outputs a warning.

* Improve "allow editing" tests

While making changes to the test suite, I ran into some issues with
these tests failing on occasion.

I added some setup and teardown to help with this.

But one thing I did notice is that the word "Upload" appears in the
response body whether uploading is enabled or not, so I made these
assertions more specific to the HTML rather than other places the word
"Upload" might appear (which is related to Critic Markup).

* Do not attempt to modify frozen strings

Using `#gsub!` here now results in an error. I am not entirely sure why
this hasn't happened before, but the error is straightforward:

     FrozenError: can't modify frozen String: "Author %{author} is from %{location}"
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:45:in `gsub!'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:45:in `fill_argument_content'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:37:in `block in autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `each'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `map'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:35:in `block in autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `each'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `map'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:33:in `autofill'
        /home/runner/work/gollum/gollum/lib/gollum/views/helpers/locale_helpers.rb:21:in `t'
        /home/runner/work/gollum/gollum/test/gollum/views/test_locale_helper.rb:95:in `block (4 levels) in <top (required)>'

`#gsub!` attempts to modify a string in-place, which does not work when
a string is frozen. It seems that in some Ruby environments, strings
from YAML files are frozen.

* Fix another order-dependent test failure

Very occasionally, this test fails due to `Precious::App` settings set
in previous tests. You can reproduce this failure using this seed:

    bundle exec rake TESTOPTS="--seed=42898"
2022-04-27 08:25:54 -07:00
Dawa Ometto 4b2dc8e5c0 Set encoding explicitly in bin/gollum (#1801)
Resolves #1699
2022-01-13 21:45:49 +01:00
Nikita Ivanov 6f870501a0 Add option to show browser's local time (#1653)
* Add tests for --local-time option
* Update Readme
2022-01-13 18:19:22 +01:00
Dawa Ometto 93d3d10453 Update gollum (#1786)
Exit with code 1 (error) when invalid option is given
2021-12-22 18:08:20 +01:00
Brian Porter 7517389072 Allow for overriding only specific Mustache templates/partials. (#1719)
* Allow for overriding only specific templates/partials. Resolves  #1450.
2021-09-07 17:32:46 +02:00
Bart Kamphorst 6c0796733d Filter _Template content. Resolves #1603 and #1640. (#1612)
* Filter _Template content. Resolves #1603 and #1640.

* Introduces a Gollum::TemplateFilter class with methods to easily add _Template Filters.

* Adds support for relative _Template pages with fallback to _Template in root.
2020-12-26 14:10:02 +01:00
Dawa Ometto b9d7375dba Fix migration script when using page-file-dir (#1542) 2020-04-04 13:43:29 +02:00
Dawa Ometto 676811206d Add tests for base_path (#1540) 2020-04-03 17:12:09 +02:00
Dawa Ometto 5a8750a975 Fix migrate script path argument. Fix gollum --version (#1538) 2020-04-02 14:08:17 +02:00
Dawa Ometto f0bb300e03 Update docs 2020-03-29 22:28:23 +02:00
Dawa Ometto 862c6d5d2e Restore --bare option 2020-03-29 20:04:45 +02:00
Dawa Ometto 16676e0788 Update README.md (#1508)
* Update --css and --js documentation in bin/gollum

See https://github.com/gollum/gollum/issues/1507
2020-03-27 16:06:40 +01:00
Dawa Ometto 36811490d0 Add --lenient-tag-lookup option (#1505) 2020-03-27 12:20:52 +01:00
Dawa Ometto 0b1d7ab01c Update migration script (#1497)
* Add whitespace -> hyphens

* Update README
2020-03-25 12:29:39 +01:00
Dawa Ometto a45101cfe9 Package assets (#1493)
* Package static assets
* Fixed cancel button in editor
* Fix rake compilation task
* Add asset path helper
* Serve MathJax statically
* Fix mathjax in preview
2020-03-24 15:55:28 +01:00
Dawa Ometto d5970d6274 Tag compatibility. Resolves #1487 (#1492)
* Add --global-tag-lookup

* Add bin/gollum-migrate-tags

* Add migration tests (not on Travis)
2020-03-22 17:40:13 +01:00
Dawa Ometto 707648bde8 Remove old reference to livepreview (#1490) 2020-03-18 20:32:41 +01:00
Dawa Ometto f6f81b39f8 Remove more references to grit and start updating readme (#1486)
* Remove more references to grit

* Update History and Readme
2020-03-18 18:17:22 +01:00
Dawa Ometto f0b04f1334 gollum --versions: output used markdown gem (#1471) 2020-03-09 14:22:02 +01:00
Dawa Ometto d1b1375629 Fix usericons (#1408)
* Fix and refactor user icons, add Basic tests
* Remove identicon_canvas, use identicon.js
* Use octicon by default
2019-09-01 21:45:55 +02:00
Dawa Ometto f72e8610da Merge branch 'use_path_helpers' of https://github.com/repotag/gollum into repotag-use_path_helpers 2018-12-28 23:41:56 +01:00
Bart Kamphorst 006dd36078 Make mathjax.config.js the standard filename. Fixes #1340. 2018-12-28 22:07:07 +01:00
Dawa Ometto 8f6c19b3fd Move precompilation task to Rakefile 2018-12-10 19:50:49 +01:00
Bart Kamphorst ae853e074a Commit @dometto's fix for asset precompilation. 2018-11-20 16:16:25 +01:00
Bart Kamphorst 5de2442540 Merge branch '5.x' into critic_markup_styling 2018-11-12 16:39:45 +01:00
Bart Kamphorst 6d0b42b18f Fix superfluous code in edit.rb. Add more descriptive help sentence for CriticMarkup. 2018-11-11 15:35:51 +01:00
Bart Kamphorst 769f8ec8d6 Implements frontend support for CriticMarkup. Related to #1016. 2018-11-08 16:11:38 +01:00
Bart Kamphorst 64c4ee9c05 Improve upload handling (server-side and UI). 2018-11-07 11:06:25 +01:00
Dawa Ometto 83fbb16c3b Fix precompilation 2018-10-20 00:47:15 +02:00
Dawa Ometto a6167d88cd Fix base_path bugs in bin/gollum (#1329) 2018-10-14 17:54:39 +02:00
Bart Kamphorst 012f1fcd47 Remove fileview from gollum and rely on /pages. 2018-09-23 14:38:09 +02:00
Bart Kamphorst 92e42236f5 Add --versions flag to the gollum binary that outputs the version numbers of auxiliary gems. Resolves #1022. 2018-09-17 22:41:31 +02:00
Dawa Ometto dac91e9998 CSS to SCSS (#1247)
* CSS to SCSS

* Fix travis

* Use sprockets

* Use Sprockets helpers

* Fix gollum.editor.js error when changing language

* Fix fileview styles, use same style as Pages View.

* Add keybinding files required by ace and some ace ext files that are required or might be useful.
2018-01-14 16:47:47 +01:00
Sven Schwyn 6f11ce71c4 Minor rewording 2017-04-30 17:30:10 +02:00
Sven Schwyn f41a85ced9 Document how to escape emoji 2017-04-30 15:54:55 +02:00
Dawa Ometto 750e2ee677 Fix syntax error in bin/gollum 2017-04-14 00:28:44 +02:00
Dawa Ometto 64fd56e8ef Merge branch '5.x' into remove_livepreview 2017-04-13 20:00:59 +02:00
Dawa Ometto 5aa5bccda3 Remove livepreview 2017-04-12 23:03:11 +02:00
Dawa Ometto 16ea6245e3 Follow page renames in history view 2017-04-12 23:00:07 +02:00
Dawa Ometto 8aa10fe400 Yaml frontmatter (#1217)
Render YAML frontmatter

* Fix tests on 5.x

* Update README

* Refactor Page view #table

* Minor refactor

* Refactor
2017-04-09 19:26:04 +02:00
Daniele Grandini 37a11546fa rebasing 2017-02-24 13:49:28 +01:00
Daniele Grandini 643a42aea6 Merge branch 'template_page' of https://github.com/QuaeNocentDocent/gollum into template_page
rebasing
2017-02-24 13:43:42 +01:00
Daniele Grandini 2b8497531d rebasing 2017-02-24 13:41:52 +01:00
Daniele Grandini d702026134 final 2017-02-24 13:32:20 +01:00
Horacio Sanson 72c8e1aff3 Add option to configure PlantUML endpoint 2017-02-24 13:32:20 +01:00
Daniele Grandini a50fcd31e2 final 2016-08-25 10:11:22 +02:00
Dawa Ometto 07ca53a778 Merge branch 'rc' into master
Conflicts:
	bin/gollum
2016-08-07 21:36:13 +02:00
Sven Schwyn fa1bcf9608 Add support for emojione 2016-05-19 20:33:25 +02:00
André Luis Leal Cardoso Junior 5a53c58b04 Sanitize basepath options when adding with more than one / at the start. Fixes #1066 2015-12-05 23:23:22 -02:00
SkyCrawl d1d81a0043 Syncing BIN with README + fixes & enhancements 2015-08-23 14:44:18 +02:00