AutoGist v2.2.8 - Version control projects, push/pull, Create Installers/Updaters!

*Project MUST be named “AutoGist”. This is case sensitive.

New AutoGist Installer: https://gist.github.com/briarfox/5762703

The Installer is one file. Copy it and paste it over main in a newly created project named AutoGist. Then just run it! Thanks to @acp for the code.

AutoGist code - https://gist.github.com/briarfox/5525674

AutoGist 2.0 is here! First you will need to create a Github account @ http://www.github.com

-Open AutoGist and supply your username and password. These are not saved and only need to be used once. After you Authenticate it will save your Github token as a global.

-Exit and reload AutoGist

-You can now use AutoGist to pull full projects from a gist id. You Simply create a blank project, open AutoGist Enter the project name and the gist ID from the gist you want to pull.

-AutoGist can now create a single file that will install all tabs from a Gist. This makes it easy for people who do not have a Gist app. Simply Enter the Name of the Project and the gist id from it’s gist. A new gist will be created with one file. That files is ran in place of main and will install the project all in separate tabs.

-You can comment out code that you do not want to appear in the Gist. use

--to comment out code do
--/*
code to comment out
--*/

This is how you include AutoGist into your project to backup.

To backup your projects you simply add this to your main file and include AutoGist in your project:
VERSION = "1.0.1" --This will identify the version to users. Change it to update the Gist.
PROJECTNAME = "your project name" --This is also used for the Updater

--/*
BUILD = true/false 
--BUILD will create a separate gist for builds when set to true, version is ignored
--*/

In setup add:
--/*
autoGist = AutoGist(PROJECTNAME,"DESCRIPTION",VERSION,true|false|functionName)
 -- @param VERSION should be the variable used in setting the version at the top.

--last param will add an update checker and button if set to true or a specific function in main if you pass the function name..

autoGist.backup()
 -- if you pass true in backup, your Version gist will be public.
--*/

Thats it! Future update will include Version tracking as a tab within Codea.


-------------
Version Notes
-------------
VERSION 2.2.8
-Added the ability to specify a function name in main to recieve the update check function. ex. AutoGist(PROJECTNAME,"Description",VERSION,[true|false|functionName]) code by @Slashin8r
-Added Codea tag --# Main to installer. You can now paste the code directly into a new project with a long press on new project.

VERSION 2.2.5
-@Param added to AutoGist(PROJECTNAME,"Description",VERSION,[true|false])
-New param will inject an Version check and update button into main.
-This replaces the old Add_Update button. This is to allow autogist to change the update code when needed.
-Note: ***Please remove the add_update code from your main file***
-Remove: VersionUpdateChecker.check() from under setup and all the code at the bottom.

VERSION 2.2.0
-Added the ability to add an updater to your project. This will check for add a button to your project when an update becomes availiable.

VERSION 2.1.4
-Fixed Manual Gist Tab Order

VERSION 2.1.3
-Installer revamped. Run a created installer once and the project is pulled. It will no longer save json tab.

VERSION 2.1.2
-Preserves the Tab order when a project is pulled or Installer is used.
-New file 1aTabOder is saved to Gist. It is used to save and load the tab order. When using AutoGist, this file will not be pulled into a project.

VERSION 2.1.0
-Small fix in manual gisted project Description
-Now Lets you know if an update is needed

Version 2.08
-All data is stored as a global variable
-AutoGist is now a class so it's called differently in main
-Version can be in any format
-Revision keys are now saved with the version

Version 2.05
-Added an update button that will update AutoGist to the current version.

Version 2.04
-Small fix for the installer. It was looking for the installer tab in "AutoGist Test:Installer" it should be "AutoGist:Installer"

Version 2.01
-Create an Installer for your gists! Simply run AutoGist, add the Name and gist id of the project you want to create the installer for. Then share the link!
-You can now comment out code that you do not want to be part of the gist. such as the functions AutoGist uses.
- to comment out use "-- /*" (no space) to start comment and "-- */" (no space) to end comment

Version 2.00
-Retrieve your Gist Token from inside AutoGist uses basic Auth once then OAuth after
-Added Base64 encoding


Great work @Briarfox

@Jmv38 did you have any issues getting it to work?

I will try this soon, just killing my own bugs at the moment

.@briarfox same as @ignatz

Glad you got it working!

Curious to see what you guys think on how the first backup takes you to the gist page, where the following gist backups do not. I felt it was a good way to verify the backup and allow copying of the link. And of course all feedback is welcome.

@Briarfox I should be able to get around to giving this a shot this weekend, and I can give you some impressions. I do have an initial question: if I set the version number to a previous version, does AutoGist sync up the my project in Codea to that version?

@toadkick it does not. you would have to copy the code from the gist or create a new project and pull the gist. However that is a great idea, I’ll have a look into that. It shouldn’t be that hard. I’ll just have the get and save the revision keys and tie them to version numbers.

Currently AutoGist is an easier way to save copies of code throughout the development process. I tend to use the BUILD=true much more often when I’m tinkering. The version number is great if you have a link posted of the gist. It makes updating it a lot easier. However being able to put in an old version number and pull the code would be very handy.

It may be a good idea to have a gist manager that could be used to create and update all projects that you have pulled from gist. Running it could keep all gists from other people up to date.

@toadkick I did a little playing around today and your request is definatly do able. I’ll have to change the way data is saved. The more I think about it, the more I think I should be saving all AutoGist info into one string. This would be easy by storing all data into a table and using Json to encode it into a string. This would allow me to tie a gist revision to a version number and allow updating of older versions. I’m just not sure how useful this would be.

When you have time to check it out, let me know if this feature would be useful and ill look into it some more.

@Briarfox: I’m not suggesting that you include the feature, I was just curious if AutoGist did/could do that. The main reason I might personally find it useful is because sometimes during development of larger projects being able to revert back to previous revisions can help track down when a bug was introduced.

I might not end up getting a chance to check it out this weekend due to work, but hopefully I can play with it here soon, I’m very intrigued by it.

I am still keen to try it too, just trying to wrestle my current project into submission first

Hi @Briarfox,

Used AutoGistV2 and successfully downloaded one of my private Gists, also run the backup - seemed to work OK.

Thanks,

Bri_G

=;

Got my first Gist pulled)))) superb!
PS: would be great If one could restore a certain revision if a gist (by version number as discussed above).

Glad you guys are liking it. I’m contemplating moving the get gist out of AutoGist and making a GistManager. This would be used to pull all projects and allow for updating all the gists you pulled with an update function. However, this would require those using gist to update their current gists and not make a new one when they update code.

@se24vad I started on changing the way data saves to allow for that. There will be one local saved data that will store each push of a gist and tie the revision key to it. Its being passed back I just haven’t been using it.

Currently to pull an older version, go to your gists, select the revision you want to import. In the url you will see: /5525674/4d0cf9ea5145e363029e9693b1be91b3b6fad071 copy it.

That is the gist id and the revision id. Open AutoGist enter the name of your current project and paste the gistid/revisionid. Your project will then be updated

Hi @Briarfox,

If we have a data tab with name and gist ID in. Table. Could we access the data using the project name?

Later it could be possible to build this from a Gist Manager.

Bri-G

=;

@Bri_G I’m not sure I entirely am following you. Are you asking for the ability to just input a project name into AutoGist that you have previously gisted and have AutoGist already know what the gistid is and pull it? That would be easily accomplished. I had been debating with myself if saving the data local vs global earlier on. It could be moved to global which would allow AutoGist to have access to all gists that have been created. I can be dense, is that what you were saying?

There is now an AutoGist installer. All you have to do is grab one file and AutoGist will download the rest. @acp created this code.

AutoGist Install: https://gist.github.com/briarfox/5562489

Let me know what you guys think of this installer and if it’s something you would find useful when sharing projects. I’m thinking about adding the ability to AutoGist that would create an installer for your project. So only the installer link would need to be shared and it would make it easier for others to grab larger projects.

Can I get someone to please test this out?

I just updated this gist. You now have the ability to create a single install file for your projects. Just run AutoGist put the name of your project and it’s gistID and hit Create Installer.

This will create a single file that you can share. All a person wishing to install your app from gist has to do is run the file twice. then the project will be in their codea library.