In the editor, the help text for "Emoji" included a dead link. This
changes the link to a non-dead link.
After changing the JS, assets needed to be recompiled.
Resolves#1775.
There was an order-dependent test failure that plagued a couple of my
recent pull requests:
Failure:
Default_keybindings#test_keybinding_unset
[/home/runner/work/gollum/gollum/test/test_app.rb:1098]
Minitest::Assertion: Expected: true
Actual: false
This commit ensures that `default_keybinding` is set to `nil` before
each test, and that the first line of each test changes the
configuration to the setting under test explicitly.
I also refactored the teardown to `nil` out all instance values so
they'll all certainly be reset when the next set of tests is run.
On my system, Chrome is not in the location that the
`Selenium::WebDriver` expects it to be by default. This configuration
setting lets a developer set the path to the Chrome binary explicitly if
necessary.
Any Capybara-related test setup has been moved to `capybara_helper.rb`.
Now we just must require this file in order to run tests with Capybara.
I also moved the `#console_log` helper to this file to showcase how
other global helper methods could be defined in this file.
I saw a random (??) failure on the test on line 1098. This trivial chang
e just ensures that the configuration under test (the default
keybinding) is explicitly being set to `nil` after test runs.
In issue #1815, it was reported that Gollum RSS feeds attempt to put
entire commit messages into a feed item's `<title>` element.
Given that commit messages can be many paragraphs long, this is not an
acceptable way to render a feed item title.
If a commit has many lines or paragraphs, we now put those inside the
`<description>` element as of this commit.
While I was editing this view, I decided it would be a good time to
increase test coverage, as this view renderer was not under test at
all. I also fixed a typo ("Commited" should say "Committed"). There are
implicit dependencies on other gems that provide the
`Gollum::Git::Commit`, `Gollum::Git::Actor`, and `Rugged::Commit`
classes here, so mocking out simple versions of their interfaces seemed
like the path of least resistance to setting up controllable tests.
I also removed some now-duplicated assertions from `test/test_app.rb`.
* Internationalize `Views::Compare` templates
* Internationalize `Views::Error` templates
* Internationalize `Views::History` templates
* Internationalize `Views::LatestChanges` templates
* Internationalize `Views::Layout` templates
* Internationalize `Views::Overview` templates
* Internationalize `Views::Search` templates
* Reset I18n load path after I18n helper tests
* Create locale helper for global translations
There are some translation strings we should use across multiple views.
Instead of duplicating the translations, we can use a different locale
helper method, `#tt`, to get a hash of all available translations.
Then, in a partial view like `pagination.mustache`, we can render
translations regardless of what the current view class is.
This commit adds the necessary helper, tests, and uses the new method to
render translations on the `pagination.mustache` template, which is used
by many other view classes (latest changes, history, and search).
* Start using `yarn` for vendor assets
Until this commit, Gollum has included JavaScript assets by committing
the source code to the `lib/gollum/public/gollum/javascript/` directory
and including them for compilation in the Sprockets asset manifest file
at `lib/gollum/public/gollum/javascript/app.js`. This has been a
reasonable way to deal with third-party JavaScript, but there are a few
downsides:
- It's a burden to find out if JavaScript dependencies have been
updated and require updating in Gollum.
- It doesn't give us good visibility into the JavaScript dependencies
required by our dependencies.
- It forces us to commit external code to our repository, which can
make our developer tools more difficult to configure or use. For
example: when I search for key words in the repository using
Ripgrep, I often get "garbage" results from minified JavaScript.
Managing JavaScript dependencies via a JS package manager can resolve
all of these issues.
This commit allows us to manage JavaScript dependencies using the Yarn
package manager for Node JS modules[1]. I chose Yarn over NPM for one
reason: Yarn is the JavaScript package manager that Rails uses by
default. So many Ruby developers will already be familiar with Yarn.
To demonstrate how this can change how we manage JS assets in Gollum,
I've configured Yarn and started to manage the `mousetrap` dependency
with it. I chose `mousetrap` to start because it's a smaller, mostly
uncomplicated dependency. I was easily able to manually test that
`mousetrap` is still working after re-compiling the assets.
Hopefully this gives anyone reading enough context to jump in and start
moving our third-party JS assets out of the codebase.
[1]: https://yarnpkg.com/
* Recompile assets
* Add dev environment setup info to CONTRIBUTING
Now that we require additional tooling to manage JavaScript
dependencies, it seemed reasonable to add more documentation around
setting up one's development environment.
* Don't compile assets without `yarn`-managed ones
If a developer compiled assets without first running `yarn install`, we
would get incomplete collection of up-to-date assets.
Let's ensure that the developer has all the required assets by enforcing
this in the precompile task they should be using to compile production
assets to begin with.
We've had some reports (#1342, #1809) of `rdoc` not being installed
in some environments, causing Gollum to error in unpleasant ways.
This isn't an issue that's unique to Gollum, and I don't think `rdoc`
should actually be a hard dependency of this project. But since we can
side-step the issue by requiring `rdoc`, something that most users who
install Gollum via RubyGems would already have installed, I don't think
this is a horrible solution.