738f8ed462
* 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.
197 lines
5.9 KiB
Markdown
197 lines
5.9 KiB
Markdown
# Contributing to Gollum
|
|
|
|
Thanks for your interest in the gollum project!
|
|
|
|
## Submitting an Issue
|
|
|
|
Please note that the issue tracker is meant for:
|
|
|
|
1. Bug reports.
|
|
2. Feature requests.
|
|
|
|
If your have problems using or installing the software which stem from bugs in the software or a lack of documentation, we are always happy to help out! However, **for ordinary usage questions, please consider asking elsewhere**, for instance on [StackOverflow](http://stackoverflow.com/questions/tagged/gollum-wiki).
|
|
|
|
Gollum supports [custom macros](https://github.com/gollum/gollum/wiki#macros) for the creation of additional wiki markup tags. Please **do not** use this tracker to request macros specific to your situation. However, if you have or are working on a macro that you think may be useful to more users, you can share it as a GitHub [gist](https://gist.github.com) and link to it in the [wiki](https://github.com/gollum/gollum/wiki/Custom-macros).
|
|
|
|
Before submitting an issue, **please carefully look through the following places** to make sure your problem is not already addressed:
|
|
|
|
1. The issue tracker.
|
|
1. The [README](https://github.com/gollum/gollum/blob/master/README.md).
|
|
1. The project's [wiki](https://github.com/gollum/gollum/wiki).
|
|
|
|
Security vulnerabilities can be reported directly to the maintainers using these GPG keys:
|
|
|
|
* [@dometto](https://keys.openpgp.org/vks/v1/by-fingerprint/02354CC9F820B52CC2791979BB8CCC95FD83B795)
|
|
|
|
Lastly, please **consider helping out** by opening a Pull Request!
|
|
|
|
## Triaging Issues [](https://www.codetriage.com/gollum/gollum)
|
|
|
|
You can triage issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to gollum on CodeTriage](https://www.codetriage.com/gollum/gollum).
|
|
|
|
## Set up your development environment
|
|
|
|
If you want to hack on Gollum, you'll need to set up a development
|
|
environment.
|
|
|
|
To get started, you'll need:
|
|
|
|
- A recent version of [Git][git]
|
|
- A recent version of [Ruby][rubylang].
|
|
- A recent version of [Node JS][nodejs].
|
|
|
|
Refer to their installation instructions. Installation methods differ depending
|
|
on your operating system.
|
|
|
|
Once you have those:
|
|
|
|
- Install Bundler, the Ruby package manager. In a terminal:
|
|
```sh
|
|
gem install bundler
|
|
```
|
|
- Install Yarn, a JavaScript package manager. [See Yarn's install
|
|
guide][yarn-install].
|
|
|
|
Now, you can start setting up Gollum to run locally:
|
|
|
|
1. Clone the git repository. In a terminal:
|
|
|
|
```sh
|
|
git clone https://github.com/gollum/gollum.git
|
|
```
|
|
2. Change directory into the cloned project:
|
|
```sh
|
|
cd gollum
|
|
```
|
|
3. Bundle the project's Ruby dependencies using Bundler:
|
|
```sh
|
|
[sudo] bundle install
|
|
```
|
|
4. Install the project's JavaScript dependencies using Yarn:
|
|
```sh
|
|
yarn install
|
|
```
|
|
If all went well, you should now be able to run the test suite using the
|
|
following command:
|
|
|
|
```sh
|
|
bundle exec rake
|
|
```
|
|
|
|
If you already have a Gollum wiki, you can also browse it via your local version
|
|
of Gollum:
|
|
|
|
```sh
|
|
bundle exec gollum <path/to/my/wiki/root>
|
|
```
|
|
|
|
Or you can clone an example wiki and browse that:
|
|
|
|
```sh
|
|
git clone test/examples/lotr.git ~/lotr-wiki
|
|
bundle exec gollum ~/lotr-wiki
|
|
```
|
|
|
|
With this, you're ready to start contributing and open your first [pull
|
|
request](#opening-a-pull-request).
|
|
|
|
[git]: https://git-scm.com/downloads
|
|
[nodejs]: https://nodejs.org
|
|
[rubylang]: https://www.ruby-lang.org
|
|
[yarn-install]: https://yarnpkg.com/getting-started/install
|
|
|
|
## Opening a Pull Request
|
|
|
|
Pull Requests fixing bugs, implementing new features, or updating documentation and dependencies are all very welcome! If you would like to help out with the project, you can pick an open issue from the issue tracker. We're more than happy to help you get started! Here's how you can proceed:
|
|
|
|
1. Fork and clone Gollum. See [Set up your development
|
|
environment](#set-up-your-development-environment).
|
|
2. Create a thoughtfully named topic branch to contain your changes.
|
|
3. If you haven't installed dependencies yet, navigate to your clone and execute:
|
|
```
|
|
[sudo] bundle install
|
|
```
|
|
4. Hack away.
|
|
5. Add your own tests and make sure they're all still passing.
|
|
6. If some of your changes deserve a mention on Gollum's home page, edit the README accordingly.
|
|
7. If necessary, rebase your commits into logical chunks, without errors.
|
|
8. Push the branch to your fork on GitHub.
|
|
9. Create a pull request for Gollum.
|
|
|
|
Do not change Gollum's version number, we will do that on our own.
|
|
|
|
### Running tests
|
|
|
|
1. Install [Bundler](http://bundler.io/).
|
|
2. Navigate to the cloned source of Gollum.
|
|
3. Install dependencies:
|
|
```
|
|
[sudo] bundle install
|
|
```
|
|
4. Run the tests:
|
|
```
|
|
bundle exec rake test
|
|
```
|
|
|
|
To profile slow tests, you can use the `--verbose` flag:
|
|
|
|
```sh
|
|
bundle exec rake test TESTOPTS="--verbose"
|
|
```
|
|
|
|
You can also run a single test file with the following command:
|
|
|
|
```sh
|
|
bundle exec ruby <test/test_the_file_i_want_to_run.rb>
|
|
```
|
|
|
|
### Working with test repositories
|
|
|
|
An example of how to add a test file to the bare repository lotr.git.
|
|
|
|
```
|
|
mkdir tmp
|
|
cd tmp
|
|
git clone ../test/examples/lotr.git/
|
|
git log
|
|
echo "test" > test.md
|
|
git add .
|
|
git commit -am "Add test"
|
|
git push ../lotr.git/ master
|
|
```
|
|
|
|
## Updating static assets
|
|
|
|
This is necessary whenever changes have been made to the assets in
|
|
`lib/gollum/public/gollum/javascript` (mostly SASS, CSS, and JS files), to
|
|
ensure the changes are also present in the [released](#releasing-the-gem)
|
|
version of the gem.
|
|
|
|
Steps:
|
|
|
|
1. `git rm -r lib/gollum/public/assets`
|
|
1. `bundle exec rake precompile`
|
|
1. `git add lib/gollum/public/assets`
|
|
1. `git commit`
|
|
|
|
## Releasing the gem
|
|
|
|
Gollum uses [Semantic Versioning](http://semver.org/).
|
|
|
|
x.y.z
|
|
|
|
For z releases:
|
|
|
|
```
|
|
rake bump
|
|
rake release
|
|
```
|
|
|
|
For x.y releases:
|
|
|
|
```
|
|
# First update VERSION in lib/gollum.rb and then:
|
|
rake gemspec
|
|
rake release
|
|
```
|