This repository can be used to quickly set up a website hosted by
GitHub for GAP packages using a GitHub repository.
Specifically, this uses GitHub pages
by adding a gh-pages
branch to your package repository which
contains data generated from the PackageInfo.g
file of your package.
The following instructions assume you do not already have a gh-pages
branch in your repository. If you do have one, you should delete it before
following these instructions.
-
Go into your clone of your package repository.
-
Setup a
gh-pages
branch in agh-pages
subdirectory.Users with a recent enough git version (recommended is >= 2.11) can do this using a "worktree", via the following commands:
# Add a new remote pointing to the GitHubPagesForGAP repository git remote add gh-gap https://github.com/gap-system/GitHubPagesForGAP git fetch gh-gap # Create a fresh gh-pages branch from the new remote git branch gh-pages gh-gap/gh-pages --no-track # Create a new worktree and change into it git worktree add gh-pages gh-pages cd gh-pages
Everybody else should instead do the following, with the URL in the initial clone command suitably adjusted:
# Create a fresh clone of your repository, and change into it git clone https://github.com/USERNAME/REPOSITORY gh-pages cd gh-pages # Add a new remote pointing to the GitHubPagesForGAP repository git remote add gh-gap https://github.com/gap-system/GitHubPagesForGAP git fetch gh-gap # Create a fresh gh-pages branch from the new remote git checkout -b gh-pages gh-gap/gh-pages --no-track
-
Add in copies of your
PackageInfo.g
,README
(orREADME.md
) and manual:cp -f ../PackageInfo.g ../README* . cp -f ../doc/*.{css,html,js,txt} doc/
-
Now run the
update.g
GAP script. This extracts data from yourPackageInfo.g
file and puts that data into_data/package.yml
. From this, the website template can populate the web pages with some sensible default values.gap update.g
-
Commit and push everything.
git add PackageInfo.g README* doc/ _data/package.yml git commit -m "Setup gh-pages based on GitHubPagesForGAP" git push --set-upstream origin gh-pages
That's it. You can now see your new package website under https://USERNAME.github.io/REPOSITORY/ (of course after adjusting USERNAME and REPOSITORY suitably).
GitHubPagesForGAP tries to automatically provide good defaults for most packages. However, you can tweak everything about it:
-
To adjust the page layout, edit the files
stylesheets/styles.css
and_layouts/default.html
. -
To adjust the content of the front page, edit
index.md
(resp. for the content of the sidebar, edit_layouts/default.html
-
You can also add additional pages, in various formats (HTML, Markdown, Textile, ...).
For details, please consult the Jekyll manual.
If you would like to test your site on your own machine, without uploading it to GitHub (where it is visible to the public), you can do so by installing Jekyll, the static web site generator used by GitHub to power GitHub Pages.
Once you have installed Jekyll as described on its homepage, you can test the website locally as follows:
-
Go to the
gh-pages
directory we created above. -
Run jekyll (this launches a tiny web server on your machine):
jekyll serve -w
-
Visit the URL http://localhost:4000 in a web browser.
Whenever you make a release of your package (and perhaps more often than
that), you will want to update your website. The easiest way is to use
the release
script from the ReleaseTools. However, you can also do
it manually. The steps for doing it are quite similar to the above:
-
Go to the
gh-pages
directory we created above. -
Add in copies of your
PackageInfo.g
,README
(orREADME.md
) and manual:cp -f ../PackageInfo.g ../README* . cp -f ../doc/*.{css,html,js,txt} doc/
-
Now run the
update.g
GAP script. -
Commit and push the work we have just done.
git add PackageInfo.g README* doc/ _data/package.yml git commit -m "Update web pages" git push
A few seconds after you have done this, your changes will be online under https://USERNAME.github.io/REPOSITORY/ .
Normally you should not have to ever do this. However, if you really want to, you can attempt to update to the most recent version of GitHubPagesForGAP via the following instructions. The difficulty of such an update depends on how much you tweaked the site after initially cloning GitHubPagesForGAP.
-
Go to the
gh-pages
directory we created above. Make sure that there are no uncommitted changes, as they will be lost when following these instructions. -
Make sure the
gh-gap
remote exists and has the correct URL. If in doubt, just re-add it:git remote remove gh-gap git remote add gh-gap https://github.com/gap-system/GitHubPagesForGAP
-
Attempt to merge the latest GitHubPagesForGAP.
git pull gh-gap gh-pages
-
If this produced no errors and just worked, skip to the next step. But it is quite likely that you will have conflicts in the file
_data/package.yml
, or in yourREADME
orPackageInfo.g
files. These can usually be resolved by entering this:cp ../PackageInfo.g ../README* . gap update.g git add PackageInfo.g README* _data/package.yml
If you are lucky, these were the only conflicts (check with
git status
). If no merge conflicts remain, finish with this command:git commit -m "Merge gh-gap/gh-pages"
If you still have merge conflicts, and don't know how to resolve them, or get stuck some other way, you can abort the merge process and revert to the original state by issuing this command:
git merge --abort
-
You should be done now. Don't forget to push your changes if you want them to become public.
Packages using GitHubPagesForGAP include the following:
- https://gap-packages.github.io/anupq
- https://gap-packages.github.io/cvec
- https://gap-packages.github.io/genss
- https://gap-packages.github.io/io
- https://gap-packages.github.io/NormalizInterface
- https://gap-packages.github.io/nq
- https://gap-packages.github.io/orb
- https://gap-packages.github.io/polenta
- https://gap-packages.github.io/recog
- https://gap-packages.github.io/recogbase
- https://gap-packages.github.io/SingularInterface
Please submit bug reports, suggestions for improvements and patches via the issue tracker.
You can also contact me directly via email.
Copyright (c) 2013-2018 Max Horn