Wiki Translation Repositories
Official translations of the wiki are not practical due to varying dialects, dodgy translator programs, and the increased workload needed to officially support the translations. A different approach is to have monkeys, who wish to contribute to the community, run their own translation of the wiki.
This tutorial will go into the details of how to setup a copy of the wiki on GitHub that looks and feels like the official wiki, including Travis-CI automatically converting your AsciiDoc content to HTML, then publishing those files on each commit.
You are not required to translate every page or even mirror changes to the official wiki. What is required is a linked wiki be robust enough to actually help other monkeys and that the content is kept current. If it’s deemed worthy, a link to your repository, whether its stored on your own domain or not, will be added to the main page of the wiki under the Languages topic.
Although this is a tutorial on setting up and configuring your own copy of the official wiki, you still must adhere to the jMonkeyEngine licensing. This includes the use of a domain name that includes the jMonkeyEngine name. |
Prerequisites
For this tutorial you can either setup with Git, or the Atom Editor, which uses basic GitHub commands by default. You will be loosely implementing the instructions from Steve Klabnik.
You will need to meet these requirements to continue:
-
A GitHub account.
-
Either Git or the Atom Editor installed on your system.
The Atom editor also has a Git Plus package that uses Git if it’s already on your system. Open and enter “git” into the search box to locate and install.
|
For a list of git commands, use one of these: See also Travis-CI: |
GitHub/Travis CI Setup
This topic applies to both Git and the Atom Editor. You must do this before you do anything else.
-
Create a new repository on github.com for your wiki. (NOT a fork)
-
Enter a unique name for your repository.
-
-
After your repository has been created, you will need to add a new “gh-pages” branch.
-
This will automatically setup your repository for compiling “gh-pages”.
-
After creating the “gh-pages” branch, from your repositories main page, click the Settings link and scroll down to the “GitHub Pages” panel for more configuration options and to see your sites new URL.
There are two URLs you will need for configuration.
-
Your
gh-pages
URL: https://username.github.io/repo-name/ -
Your
repository
URL: https://github.com/username/repo-name
This is how they will be referred to in this tutorial.
-
-
-
Setup GH_TOKEN variable:
-
You need to generate a GH_TOKEN in github.com, and set up Environment Variables in travis-ci.org or travis-ci.com, depending on whether your repository is public or not. This variable will be used in the deploy_ghpages.sh file.
-
Describe it however you wish and then you will need to check some boxes. Check these ones:
-
public_repo
If your repository is private, you can set repo instead.
GitHub will create the token and show a page with the value.
THIS IS THE ONLY TIME YOU GET TO SEE THIS SO DON’T CLICK AWAY IMMEDIATELY! You will need to copy this token into someplace you trust. It’ll never be shown to you after this time, so it’s important to double-check your work. You can always regenerate a new token, but then you will have to change any script or apps that use it.
-
-
-
Click your name icon and select
or the “Marketplace” link at the top of the page header.
-
Click the “Travis-CI” link. If you don’t see one listed, find it using the search box.
-
Scroll to the bottom of the page and under “Pricing and setup” select the “Open Source” option if this is a public_repo or the payment plan of your choice.
-
When ready, select the Install button.
-
Click through until you are redirected to the Travis-Ci website.
-
-
On Travis-CI, flick the repository switch on for your gh-pages project.
You can’t see your project on the list? Click on the Sync account button (top right) and it should be OK. -
Click the cog to go to the settings tab and configure it.
-
Check some options on General:
-
check the Build only if .travis.yml is present option.
-
Check the Build pushed options.
-
-
Create some Environment Variables that will be used in .travis.yml file:
-
GH_TOKEN: the token created on previous step.
Uncheck the Display value in build log option. This is the default action.
-
-
Using Git Command Line to finish
-
Clone the wiki or your fork of the wiki and your new repository. Cloning and pushing takes some time due to the size of the wiki. Be patient.
$ git clone https://github.com/jMonkeyEngine/wiki.git $ git clone https://github.com/user/repository.git $ cd repository $ git checkout master
-
Copy everything from the localized wiki repository to the localized new repository, especially these files:
-
.travis.yml
-
build.gradle
-
deploy_ghpages.sh
-
gradlew
Travis CI
will execute./gradlew asciidoctor
and./deploy_ghpages.sh
after you push your commits.If you have ever forked the official wiki, I suggest you rename it to origin_wiki or official_wiki. Then, you can still contribute to the official wiki with that fork.
-
-
Give gradlew, deploy_ghpages.sh permission to be executed. If you don’t do this, travis-ci.org will fail, due to no permission.
git update-index --chmod=+x deploy_ghpages.sh git update-index --chmod=+x gradlew git push
-
At this point you need to change the wiki specific attributes to complete the setup.
Using Atom Editor to finish
This topic assumes you have already downloaded, installed and configured the Atom Editor as well as cloned the wiki or your fork of the wiki and it’s open in the Atom Editor.
-
In the Atom Editor, select
or Ctrl + Shift + N.
-
Delete the new page that opens by default.
-
-
In the new window, select
or Ctrl + Shift + P.
-
Enter “github” into the search box.
-
Select the GitHub Clone button.
-
Enter the URL to your
repository
. -
When ready, click the Clone button.
-
-
Copy everything from the localized wiki repository to the localized new repository, especially these files:
-
.travis.yml
-
build.gradle
-
deploy_ghpages.sh
-
gradlew
-
-
Give gradlew, deploy_ghpages.sh permission to be executed. If you don’t do this, travis-ci.org will fail, due to no permission.
-
If you use Git Plus, select
and enter these arguments.
Using Git Plusgit update-index --chmod=+x deploy_ghpages.sh git update-index --chmod=+x gradlew git push
-
If you dont have Git, then edit the
travis.yml
file and add this after thebranches:
command.No Git Installedbranches: except: - gh-pages # No git, change permissions here. before_install: - chmod +x deploy_ghpages.sh - chmod +x gradlew
-
-
At this point you need to change the wiki specific attributes to complete the setup.
Changing Wiki Specific Attributes
These changes will make your copy of the wiki, including all links, 100% dependent on your At minimum, you still have to change the attributes “endpoint-url”, “wiki_link_edit_prefix”, and “wiki_link_create_prefix” in the “build.gradle” file. |
-
Using Git Grep or the command line editor of your choice, find and replace the following:
-
Find the official wiki
gh-pages
address ofhttps://wiki.jmonkeyengine.org
. -
Replace it with your
gh-pages
addresshttps://username.github.io/repo-name
. -
Find the official wiki
repository
address ofhttps://github.com/jMonkeyEngine/wiki
. -
Replace it with your
repository
address ofhttps://github.com/username/repo-name
.
-
-
Change the build status link for your repository in the README.adoc page.
image:https://travis-ci.org/jMonkeyEngine/wiki.svg?branch=master["Build Status", link="https://travis-ci.org/jMonkeyEngine/wiki"]
-
After you have done all the above, commit and push to your wiki repository.
-
Select
or Ctrl + Shift + F.
-
Enter the official wiki
gh-pages
address ofhttps://wiki.jmonkeyengine.org
into the search box and then select the Find All button. -
Enter your
gh-pages
addresshttps://username.github.io/repo-name
in the “Replace All” box and when ready, select the Replace All button. -
Enter the official wiki
repository
address ofhttps://github.com/jMonkeyEngine/wiki
into the search box and then select the Find All button. -
Enter your
repository
address ofhttps://github.com/username/repo-name
in the “Replace All” box and when ready, select the Replace All button.
-
-
Change the build status link for your repository in the README.adoc page.
image:https://travis-ci.org/jMonkeyEngine/wiki.svg?branch=master["Build Status", link="https://travis-ci.org/jMonkeyEngine/wiki"]
-
After you have done all the above,
.
-
Open the Git panel,
or Ctrl + 9.
-
Stage All.
-
Enter a “initial commit” message.
-
Commit and push to your wiki repository. You can see the result after a few minutes.
-
Conclusion
Travis should have built your copy of the wiki and moved all the .html to your “gh-pages” branch. If this didn’t happen, then something is wrong with your setup. Examine the logs of your repository from your Travis-CI account to help you troubleshoot where you went wrong. You can expand any of the command tags by clicking on them to get a more in-depth reveal of the logged info.
When you feel your repository is ready, create a thread on the forum requesting it be added to the official wiki. If approved, create a pull request of the wiki documentation page adding your repository link under the “Languages” topic.
Thanks for your interest in removing the language barrier that may prevent other monkeys from learning more about the jMonkeyEngine.