AutoGist is a Codea program that makes it easy to use version control via GitHub to keep track of changes in your projects, and to share projects with others. It is maintained by Briarfox based on original code by acp.
The AutoGist code lives in its own project in your Codea projects and should be imported in to each project that you want to use it with. In such a project then you add a couple of extra lines which AutoGist then uses to update the relevant gist on GitHub. Once it is installed, the top of a typical project will look something like:
VERSION = "1.5" PROJECTNAME = "Name of your project" function setup() autoGist = AutoGist(PROJECTNAME,"An amazing project that needs version control",VERSION,[true|false]) autoGist:backup() end
Then updating the gist simply involves updating the
Setting up AutoGist involves the following steps:
Signing up for an account on GitHub. This will ask you to choose a username, to give an email address, and to choose a password. As with all such things, use a new password.
Installing the AutoGist project. This is a simple process:
- Create a new project called
AutoGist. Note the spelling and lack of spaces.
- Copy the code from this gist into the
Maintab (completely replacing the automatically generated code).
- Run the project!
- Back out and run AutoGist. It will ask you for your GitHub username and password. It only needs these once and they are discarded afterwards. These are used to get a token which is used for future communication with GitHub. This token is stored in the global Codea data (which means that it is not exported with any particular project, including AutoGist).
- Create a new project called
Using AutoGist in a Project
Once AutoGist is setup, it can be used to create and update gists from your projects. There are a few options: you can bind a project to an existing gist, you can create a public or a private gist.
The difference between a public and a private gist is in discoverability. Public gists are listed on your GitHub user page. Private gists are not. However, if you share the link to a private gist then anyone with that link can download it (only you can ever upload to one of your gists). The public/private nature of a gist is set in stone when it is created and cannot be changed later.
New Private Gist
To create a new private gist from your project, do the following.
- Import the AutoGist project into your project. To do this, from the "tab" view click on the plus sign in the top right corner. From the dependency list click the AutoGist project.
- Add the following lines to your
setupfunction, replacing the fields with the relevant data:
autoGist = AutoGist("<ProjectName>","<Description>","<Version>") autoGist:backup()
Any of the information can be passed as a variable. In particular, it can be useful to have the
"<Version>" in a global variable
VERSION which is set at the very top of the
Main tab. The point is that AutoGist will update the gist if the version is numerically bigger than the previous version so then updating is simply a matter of updating the
VERSION number at the top of the code.
New Public Gist
To create a new public gist, do the same as for a new private gist except that the
AutoGist.backup() line should be:
Create An Installer
- Gist your project.
- Go to the url and copy the last bit. This is your gistID
- Open AutoGist and select Create_Installer
- Enter your project Name and paste it's gist ID
This will create a new gist that you share. It's one file so it's easy to copy. Once ran, it will install the entire project.
Have your project check for updates
- Use autoGist = AutoGist(PROJECTNAME,"description",VERSION,true)
- When you change the version the update code will be added to Main.lua but will not clutter your project!
- If you have a project tab named ChangeLog, the updater will display it's contents on update.