Update Checker for GitHub

Posted on
Sun Jan 24, 2016 11:43 am
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Update Checker for GitHub

Just wanted to pass along a simplistic update checker that uses the GitHub Releases feature. If you use GitHub for managing your releases, this checker will look at the latest published release and compare to your current plugin version. It's pretty slick, because you can attach files to your release to avoid download issues with Dropbox or other services. It also gives you a nice place to manage the release notes & source files.

The updater file is located here. I may pull this out to a separate project at some point to make sharing easier, but that all depends on how often it is used and how much free time I have.

Currently, I'm using this in my Prowl Notify plugin for Indigo. Feel free to snag it and give it a shot in your plugin. It's pretty basic at this point, but it seems to work well. In the future, maybe it will even download the latest release for you :D

Please let me know if you end up using it or have any other questions / issues. Thanks!

Posted on
Mon Jan 25, 2016 4:40 pm
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Update Checker for GitHub

Sweet - I knew there was some way to do it but hadn't spent any time with it. I'm going to try to get something like this into Indigo 7 for plugins hosted on Github.

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Tue Jan 26, 2016 8:59 am
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Re: Update Checker for GitHub

Version Update

Well, I spent more time messing around with this updater more than the plugin I was originally making. To help with that (and to make this more manageable), I split the updater out into its own project.

Source Code: https://github.com/jheddings/indigo-ghpu
Current Version: 1.1.2

The project is itself a plugin to provide examples and a place to work on the updater. It isn't intended to be installed in normal usage, but might be interesting for developers. With a little work, the plugin could be made to check on other plugins, but that may come at a later time.

Posted on
Fri Jan 29, 2016 10:54 am
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Automatic Updates!

This version adds the ability to automatically download and upgrade a plugin within Indigo. To install, you simply need the ghpu.py file to your plugin and import it. More details are in the project's README file.

Download

Release Information

Change Log
* Added ability to upgrade plugins
* Improved behavior for partial upgrades
* Corrected plugin reload on update

NOTE: the upgrade mechanism uses Indigo's built-in plugin installer / updater. Users will have the option to accept an upgrade before it happens.

Posted on
Fri Jan 29, 2016 11:50 am
jay (support) offline
Site Admin
User avatar
Posts: 18199
Joined: Mar 19, 2008
Location: Austin, Texas

Re: Update Checker for GitHub

Sweet!

Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Posted on
Fri Jan 29, 2016 1:34 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Update Checker for GitHub

NOTE: the upgrade mechanism uses Indigo's built-in plugin installer / updater. Users will have the option to accept an upgrade before it happens.

One suggestion - you may want to make this configurable or only automatically update when the user clicks a button to initialize the process. Otherwise, users could come back to their server Mac (many or most probably don't often see the server's screen) with multiple update prompts -- from both the same and differing plugins.

Posted on
Fri Jan 29, 2016 3:45 pm
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Update Checker for GitHub

You bet... The intent of this "plugin" is just to serve as an example for using the updater. By integrating into your own plugin, you can initialize the update how ever you'd like.

The class provides methods to check for an update or to perform the update. While the former may be run automatically, I would only ever imagine the update process initialized from a plugin's menu.


Sent from my iPhone using Tapatalk

Posted on
Sat Mar 12, 2016 10:18 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Update Checker for GitHub

I'm trying to integrate ghpu with one of my plugins, and having some issues.

First, I think there might be a problem because we lay out our Github repositories differently. Your layout is:

"/indigo-ghpu-master/Contents/Info.plist"

Mine is:

"/BetterEmail-master/Better Email.indigoPlugin/Contents/Info.plist"

I do it that way so there's an actual plugin bundle in the download file so users can double-click to install.

Second, it appears that it's searching for a commit number in the archive. Which isn't in there.

Here's the error I'm getting:

Code: Select all
Better Email Error              A new version is available: https://github.com/FlyingDiver/BetterEmail/releases/tag/v1.2.0
Better Email Debug              Workspace: /tmp
Better Email Debug              Downloading zip file: https://api.github.com/repos/FlyingDiver/BetterEmail/zipball/v1.2.0
Better Email Debug              Verifying zip file (41447 bytes)...
Better Email Debug              Searching for plugin info: FlyingDiver-BetterEmail-6db74dd/Contents/Info.plist
Better Email Error              "There is no item named 'FlyingDiver-BetterEmail-6db74dd/Contents/Info.plist' in the archive"


Thoughts?

joe

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Mar 12, 2016 10:26 am
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Re: Update Checker for GitHub

I think you are right about the directory layout being the issue... I'll work on a solution today.

Posted on
Sat Mar 12, 2016 10:42 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Update Checker for GitHub

While you're at it, it would be nice if the updater has a built in frequency limiter so I don't have to put code in the main plugin to limit how often it checks.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Mar 12, 2016 2:09 pm
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Re: Update Checker for GitHub

I've added a "path" configuration option to the updater... Would you mind taking a look and see if it fixes your problem? Note that you'll need to set up the configuration file and change the interface to the updater's constructor. If it works, I'll take a look at an automatic update schedule at some point.

https://github.com/jheddings/indigo-ghpu

Posted on
Sat Mar 12, 2016 4:55 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Update Checker for GitHub

Works except for one error message that doesn't seem to actually be a problem:

Code: Select all
 Better Email                    Checking for updates...
  Better Email Debug              Plugin version detected: 1.2.0
  Better Email Debug              Current version is: 1.2.0
  Better Email Debug              Getting latest release from FlyingDiver/BetterEmail...
  Better Email Debug              GET /repos/FlyingDiver/BetterEmail/releases/latest
  Better Email Debug              HTTP 200 OK
  Better Email Debug              Latest release is: 1.2.1
  Better Email Error              A new version is available: https://github.com/FlyingDiver/BetterEmail/releases/tag/v1.2.1
  Better Email Debug              Workspace: /tmp
  Better Email Debug              Downloading zip file: https://api.github.com/repos/FlyingDiver/BetterEmail/zipball/v1.2.1
  Better Email Debug              Verifying zip file (39258 bytes)...
  Better Email Debug              Searching for plugin info: FlyingDiver-BetterEmail-e8f0bca/Better Email.indigoPlugin/Contents/Info.plist
  Better Email Debug              Detected plugin in zipfile: com.flyingdiver.indigoplugin.betteremail
  Better Email Debug              Found plugin: Better Email-1.2.1
  Better Email Debug              Destination directory: /tmp/FlyingDiver-BetterEmail-e8f0bca/
  Better Email Debug              Plugin source path: /tmp/FlyingDiver-BetterEmail-e8f0bca/Better Email.indigoPlugin
  Better Email Debug              Extracting files...
  Better Email Debug              Installing Better Email-1.2.1
 Better Email Error              global name 'indigoPlugin' is not defined


I reloaded the plugin after the update and no additional errors.

joe

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Mar 12, 2016 5:12 pm
jheddings offline
User avatar
Posts: 149
Joined: Dec 01, 2013
Location: Denver, CO

Re: Update Checker for GitHub

Ah, I missed a variable I was renaming. I'll get that fixed and clean some thing up. When I have an update, I'll post on this thread. Thanks for the bug report and testing.


Sent from my iPhone using Tapatalk

Posted on
Sat Apr 09, 2016 3:57 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Update Checker for GitHub

I just updated my plugin with the latest version of ghpu.py from GitHub. All the debug messages appear correct, but the new update does not get installed.

Code: Select all
  Better Email Debug              Plugin version detected: 1.2.4
  Better Email Debug              Current version is: 1.2.4
  Better Email Debug              Getting latest release from FlyingDiver/BetterEmail...
  Better Email Debug              GET /repos/FlyingDiver/BetterEmail/releases/latest
  Better Email Debug              HTTP 200 OK
  Better Email Debug              Latest release is: 1.2.5
  Better Email Error              A new version is available: https://github.com/FlyingDiver/BetterEmail/releases/tag/v1.2.5
  Better Email Debug              Workspace: /tmp
  Better Email Debug              Downloading zip file: https://api.github.com/repos/FlyingDiver/BetterEmail/zipball/v1.2.5
  Better Email Debug              Verifying zip file (39797 bytes)...
  Better Email Debug              Reading plugin info: FlyingDiver-BetterEmail-0e17765/Better Email.indigoPlugin/Contents/Info.plist
  Better Email Debug              Verifying plugin info: com.flyingdiver.indigoplugin.betteremail
  Better Email Debug              Verified plugin: Better Email
  Better Email Debug              Destination directory: /tmp/FlyingDiver-BetterEmail-0e17765/
  Better Email Debug              Plugin source path: /tmp/FlyingDiver-BetterEmail-0e17765/Better Email.indigoPlugin
  Better Email Debug              Extracting files...
  Better Email Debug              Loading plugin info: /tmp/FlyingDiver-BetterEmail-0e17765/Better Email.indigoPlugin/Contents/Info.plist
  Better Email Debug              Verifying plugin info: com.flyingdiver.indigoplugin.betteremail
  Better Email Debug              Verified plugin: Better Email
  Better Email Debug              Installing Better Email
  Better Email Debug              Installation complete


I looked in the /tmp directory path referenced in the log, and the correct (v.1.2.5) version is there. It's just not getting copied to the Plugins directory.

Any ideas?

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Apr 10, 2016 3:26 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: Update Checker for GitHub

Nevermind. User error.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Who is online

Users browsing this forum: No registered users and 1 guest