A very basic explanation of the extension and what does it provide.
The extension assumes the following url parameters to be present in your pages.
gist-id
The id of the gist being viewed (or processed)sha1
The unique hash of the specific revision of a gist (not mandatory)All datasources works almost the same way.
At first, the datasource will run as usual. If the data is found in the db, then it's returned.
If the data can't be found then it's grabbed from github and stored in the db. The datasource is then run again.
You can force the db to update by appending ?update
to the url.
This datasource download the whole gist and store it in the filesystem.
If the gist compiles, the result is stored as a file too.
Expects xml
and xsl
fields to be sent via post and create a new gist.
This one is a little tricky.
With this event you are able to:
You can do multiple actions at once (i.e. renaming a file and deleting another one).
<textarea name="files[my-filename.xml]"></textarea>
<textarea name="files[nother-file.xml]"></textarea>
<input type="submit" name="action[update-gist]" />
This will update both my-filename.xml
and nother-file.xml
.
If you don't specifically send a file that's already stored it won't be
deleted, it will just be retained as is, so you don't need to send the
whole dataset everytime you make a change.
<input type="hidden" name="deletes[my-file-todelete.xml]" value="any value, really" />
<input type="submit" name="action[update-gist]" />
This will remove the file my-file-todelete.xml
.
<input type="text" name="rename[old-filename.xml]" value="new-filename.xml" />
<input type="submit" name="action[update-gist]" />
This will rename old-filename.xml
to new-filename.xml
.
<input type="text" name="new-file[filename]" value="new-filename.xml" />
<textarea name="new-file[content]"></textarea>
<input type="submit" name="action[update-gist]" />
This will create a new file named new-filename.xml
.
<input type="submit" name="action[fork-gist]" />
Fork the current $gist-id
.
<input type="submit" name="action[star-gist]" value="Star this gist" />
<input type="submit" name="action[unstar-gist]" value="Unstar this gist" />
Star/Unstar the current $gist-id
.
<textarea name="comment"></textarea>
<input type="submit" name="action[add-comment]" />
Add a comment :)
To update gists you need a valid oauth token from github.
The github oauth token extension provides
an easy way to do that.
Just make sure the user has authenticated before making any changes (the extension is already integrated with it).
You might also need to register a github application to set the proper callbacks for your environment.
Apps can be registered here while you might find
useful this thread to
setup the oauth extension correctly.