Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

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

BriarfoxBriarfox Mod
edited July 2013 in Code Sharing Posts: 1,542

*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.

«134

Comments

  • BriarfoxBriarfox Mod
    edited July 2013 Posts: 1,542

    ------------- 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
  • Jmv38Jmv38 Mod
    Posts: 3,295

    Great work @Briarfox

  • BriarfoxBriarfox Mod
    Posts: 1,542

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

  • IgnatzIgnatz Mod
    Posts: 5,396

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

  • Jmv38Jmv38 Mod
    Posts: 3,295

    .@briarfox same as @ignatz

  • Posts: 666

    Glad you got it working!

  • BriarfoxBriarfox Mod
    Posts: 1,542

    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.

  • Posts: 580

    @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?

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @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.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @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.

  • edited May 2013 Posts: 580

    @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.

  • IgnatzIgnatz Mod
    Posts: 5,396

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

  • Posts: 1,368

    Hi @Briarfox,

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

    Thanks,

    Bri_G

    =;

  • edited May 2013 Posts: 502

    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).

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    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

  • Posts: 1,368

    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

    =;

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @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?

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    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.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    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.

  • Jmv38Jmv38 Mod
    Posts: 3,295

    Ok i did it.
    This project gave me some hard time at the beginning because it must be called AutoGist (with the capitals) and according to my habit i named it 'forum autogist2' (there is already such a project). But after 3 trial it worked fine. I have not tried the author identification yet, but the tabs are all there, and the interface looks great. The whole code looks very clean and commented, i will use it (some day, cause right now i dont understand github enough to jump into it, but thanks to your code i know i'll go for it later). Thanks for sharing this excellent tool.

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    Thanks @Jmv38, I hope my last post didn't come off like I had not received any feedback :) I was asking someone to try the installer, but I wasn't very clear.

    Yeah the naming thing is tricky, but I'm not sure how to work around that. If only Codea could tell what the current project being run was.

    I found an issue. Currently AutoGist will gist the project with the required AutoGist functions. I'm adding a tag that can be inserted that will remove everything between the tags from the gisted version.

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    I added to ability to comment out code that you do not want to appear in the gist.

    --to comment out code use
    --/*
    code that you do not want gisted
    --*/
    
  • IgnatzIgnatz Mod
    Posts: 5,396

    OK, I tried it out, and I loved the way it got the authentication key, so slick

    I tried recovering one of my gists, and it came back, but all into a new tab in the project I created. Perhaps I've missed something, but I thought it was possible to get it back into tabs.

    I haven't tried the installer, but will do so.

    Very nice work ^:)^

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    @Ignatz was the gist a multi file gist or a single file with all codea tabs in it? AutoGist will pull each individual gist file into a tab. I can make it split a single file as well. Did you try out the backup portion? It seems that pople are liking the gist retrieve function by itself. I'm wondering if I should break AutoGist into two applications. GistManager could be used to push and pull gistsas well as keep all your gist projects that you pull upto date by checking the latest gist online and pulling it down.

  • BriarfoxBriarfox Mod
    Posts: 1,542

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

  • Posts: 2,161

    @Briarfox How about making a page on the wiki for these (this?) project. That way we can be sure that we're following the latest instructions for the latest code.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Not a bad idea. I added a utilities page but it might not be a bad idea to explain them a little bit more.

  • Posts: 2,161

    @Briarfox Thanks. This is something that I'd really like to use, but I'm having trouble figuring out which bits are for what (not that I've tried it yet, though).

  • BriarfoxBriarfox Mod
    Posts: 1,542

    AutoGist can be used by itself to pull gists and create a single file install. To use it as a version control, link it to your project.
    All thats needed is

    --at the top
    VERSION = x.xx
    -- if you want a separate gist for build then use BUILD, if its not true then it will only update on version change. If it is true it will update a separate build gist with the version and build number
    BUILD = true
    
    function setup()
    --This is the same as setting saveProjectInfo()
    AutoGist.setProjectInfo("Exact ProjectName","author","Description",VERSION)
    --For a public gist
    AutoGist.backup(true)
    --For a private gist
    AutoGist.backup()
    
    --If you do not want any code to appear in the gisted project you can use
    --/*
    to comment out code from showing up on the gist
    --*/
    
    end
    
  • BriarfoxBriarfox Mod
    Posts: 1,542

    If you do not want the version control from within your project, check out Gister, everything is managed from the Gister app.

  • Posts: 2,161

    I've now gone through the instructions from the first post. Main comment: "Fantastic!". Forget sliced bread, AutoGist is brilliant.

    Minor comments:

    1. May be obvious but still worth saying: in a project that you want to Gist, you need to tag the AutoGist project as an import.
    2. To start from a project, you don't need a project key. I was pretty sure this would be the case but again, it's worth saying. All you need is AutoGist.backup() with no arguments.
    3. With my first project, I just tried AutoGist.backup() and it worked like a dream. But if I now try AutoGist.backup(true) to make it a public gist then it doesn't have an effect. Is it possible to switch a private one to a public one?

    With regard to the wiki, if you have no objection what I'd like to do is for me to write the wiki page. Then you look at it and correct it. I think that will be the best route to ensuring that it is usable by someone who doesn't know the code (that's my role!) and is correct (that's your role). Does that sound okay?

  • Posts: 2,161

    I've made a start on the wiki at https://bitbucket.org/TwoLivesLeft/core/wiki/AutoGist

    New questions:

    1. How do I keep up to date with the AutoGist code itself? Does it know its own gist, so if I just run the AutoGist project will it check for updates?
    2. What's the best way to handle commit messages? Should I just have a ChangeLog file that I add them to?
  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Andrew_Stacey I had not though about making AutoGist self update. Think I'll take a crack at that today. Unfortunatly Gist does not have commit messages. So yeah, a ChangeLog would be a good idea. Thanks for setting up the wiki page, I'lll tweak it some today.

    Thanks for the comments. I don't believe the backup(true) thing is a bug. I can't find the ability on github to change it manually, so you may be stuck with whatever you initially set it up as.

    Have you had a chance to try the BUILD=true setting?

  • Posts: 2,161

    @Briarfox Yes, I looked for how to change a gist from private to public on github as well but couldn't find it - however, this is the first time I've dealt with gists so I decided not to rely on my inability! If this is the case then the simplest way to handle it would be to set up a new gist, which leads to a question: if I want to do that, I presumably have to remove some of the project data. I can figure out what from the AutoGist code, but perhaps a feature to "detach" a project from a gist would be a good idea.

    I'm proceeding in "baby steps" so haven't tried the BUILD=true setting as yet. I don't completely understand what it does but I think that the best way to find out is to try it!

  • Posts: 2,161

    Looking at http://chris.dzombak.name/blog/2011/05/making-private-gist-public.html (the first search hit), it would seem that it isn't possible to make a private gist public, so making a new (public) gist is the way to do it.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Andrew_Stacey I had thought about creating a new gist if its changed to public, however I think it would be a good idea to keep all the revisions. But ti wouldn't be to bad to copy all the old revisions over. In all honesty, public and private dont matter if you share the link. Public just means it can be seen on your gist account and private needs a link.

    I really think having it self update would be a good idea, as in AutoGist. I would also like to rework it and get rid of all the different saved data and just create a table and serialize it. this would allow tracking of all the gists you do so you could pull back older versions from within a project. Instead of needing to open AutoGist and pull from there.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Actually, I've been keeping the Version gist private and using the installer as the public gist on my account.

  • edited May 2013 Posts: 2,161

    Ah, okay. So the difference between public and private gists is in discoverability, not in accessability. If I publish the gist URL then you can still get it even if it is private.

    Let's try that then ... here it is:

    https://gist.github.com/loopspace/909ce641a621841cbd58

    Yup, clicking on that takes me right to the gist (and I'm not logged on to github on this machine).

  • BriarfoxBriarfox Mod
    edited May 2013 Posts: 1,542

    Version 2.05
    -Added an update AutoGist button. Simply click it to keep your AutoGist upto date with the current Version.

    I recommend that anyone who's tried and plans to use AutoGist to update.

    This was a quick fix to keeping AutoGist upto date. A future update will check to see if an update is required then prompt you to update.

  • Posts: 2,161

    I just did the following:

    1. Duplicated the old AutoGist and deleted the original
    2. Reinstalled AutoGist using the above instructions

    It didn't re-ask me for my username and password and Just Worked, so I deleted the duplicate. So simply replacing AutoGist works fine.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Cool, however, by duplicating you might have lost the saved Gist id's from your projects. They are currently saved as local.

  • Posts: 2,161

    But they're in the local data of the individual project, aren't they? It was only the AutoGist project that I deleted and replaced. I just checked and my test project updated properly.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    oh good, I follow what you did now.

    So in order for AutoGist to check for updates I need to store more info and the individual revision keys. This is going to take a re write on how data is stored. I should have it out in a few days.

    @Andrew_Stacey do you think i should just scrap Gister? Its so similar to AutoGist minus the version control. I could just add in the ability to push a gist from AutoGist, thus rendering Gister useless.

  • Posts: 2,161

    @Briarfox: I've just read the description of Gister and I can't see why I would want it given that I already have AutoGist, so unless there's something sneaky that I can't see I'd amalgamate them.

    Okay, next question. Using AutoGist I can pull a gist from somewhere into a project. You've added the "Update AutoGist" button. I'd also like an "Update Project X" button. Namely, AutoGist should remember the gist it used to create a project and have the ability to redownload it upon request (though one problem I can see with this is if the latest version of the project has different tabs to the old one - can one delete tabs programmatically? Still, I could delete the old project and create a new one with the same name which AutoGist could repopulate so it would still be useful to keep a record of the gist and project names.)

    And another feature request: if I pull a gist that is stored as a single file (ie with the --# TabName format), do you think AutoGist could detect that and split it into tabs?

  • BriarfoxBriarfox Mod
    Posts: 1,542

    @Andrew_Stacey Thanks for the suggestions. Currently I need to re write the way data is saved to accomadate all the keys of projects that have been pulled. I should have this done this weekend. However in the meantime, you can manually update by putting in the project name and it's gist id. Press Gist_it and it will update the project. I'm trying to figure out what the best way to show that your projects need to be updated. I was thinking of having an update button appear on the main screen for each project that is out of date. The problemI'm running into is how do you delete a project ifyou no longer wish autogist to update it? I really do not want to add more tabs for the GistManagment part becuase they will be included if you are using the backup features of AutoGist.

    It should be easy to split single files. I'll just get the gist and parse the tabs looking for Codeas break--# TabName.

  • Posts: 2,161

    @Briarfox:

    However in the meantime, you can manually update by putting in the project name and it's gist id.

    Yes, I see that. What I'm trying to avoid is having to remember (or cut-and-paste) the gist id: if I've put it in once, the program should remember it! So then it just needs a table with the gist/name pairs. If you no longer want AutoGist to update it then you just need to delete the pair from the table.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    I follow you, its coming :) Thats just a temp solution if you need to update.

    I'd like to avoid having people need to edit the table key. I just need to find the best way to display what needs updating and a way to stop it from updating. I'd like AutoGist to tell you when a project is a version behind.

  • Posts: 2,161

    I agree that you don't want people editing the table key directly, that was a suggestion as to how the program could do it.

    Oh, and while you're looking at the code, may I suggest a more advanced version comparison. People like all sorts of things as version strings so a simple numerical comparison might not cover all possibilities.

  • BriarfoxBriarfox Mod
    Posts: 1,542

    Yeah I did it that was because it was easy. I mainly wanted to see if there was interest in AutoGist. I feel there is, so I'll add that into the todo as well :)

  • Posts: 2,161

    Just encountered a problem and am not sure if it is solvable. I wanted to upload a large project and the request timed out. The project uploaded successfully, but because it didn't get the confirmation then it doesn't know that it worked so it keeps trying to upload a new gist every time.

    One fix would be for me to manually save the information. What information does AutoGist need to know to know that a successful upload has taken place?

Sign In or Register to comment.