App Updater helper for Levure

Collaborate on tools, libraries, and applications beyond the IDE

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

App Updater helper for Levure

Post by trevordevore » Wed Sep 26, 2018 5:44 pm

Hi,

I've been working on the App Updater helper for Levure. The goal is to make automatic updating of Levure applications really straightforward. The helper leverages Sparkle on macOS and WinSparkle on Windows (the two desktop platforms I develop for). I used the Foreign Function Interface (FFI) in LiveCode Builder (LCB) to incorporate Sparkle and WinSparkle.

Here are the relevant links. The README has all of the instructions. The release page has the downloadable files. I would be interested in hearing from anybody who tries to implement this in their own application.

Project:
https://github.com/trevordevore/levureh ... pp_updater

Release page:
https://github.com/trevordevore/levureh ... r/releases

Levure:
https://github.com/trevordevore/levure

What is a Levure helper?
https://github.com/trevordevore/levure/wiki/helpers

For those who might want to incorporate Sparkle or WinSparkle in their app but don't use Levure here are links to the individual GitHub repos:

Sparkle: https://github.com/trevordevore/lc-sparkle

WinSparkle: https://github.com/trevordevore/lc-winsparkle
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Fri Nov 02, 2018 3:25 am

In the appcast.xml file is see that the url for the Mac version update seems to be expecting a .dmg file. So the update needs to be saved as a disk image? If so I guess I need to work on the dropDMG helper before I can proceed further.

The instructions say to modify the info.plist file for Mac. Would that mean copying that from an executable, modifying as stated and then in the standalone settings to choose that plist file to import into the application bundle? Or is there a different plist file I should be looking at?

I have yet to set things up on my server but think I have everything (mostly) right and I have successfully built apps with the update helper configured (except for the above) Yet in the update build folder there is an empty version # folder and the appcast.xml file but nothing else. What have I missed.

Thanks,
Marty

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Fri Nov 02, 2018 5:02 am

It looks like I need to add some more info to the Readme. Here are some additional notes based on your questions.

Sparkle Distribution

You can distribute using a variety of formats. Take a look at this section of the Sparkle docs:

https://sparkle-project.org/documentati ... g-your-app

Info.plist

In the Mac Standalone Settings tab of the Standalone Builder Settings you can specify a custom Info.plist to include when building a standalone. You do this by selecting the "Choose a PLIST file to import into the application bundle" radio button and then selecting the Info.list file. You will want to extract the Info.plist file from a Mac Standalone and the place it alongside the standalone.livecode file in your app folder.

You can make any edits you need to this file such as adding the key required by Sparkle. You can then select that Info.plist file in the Mac Standalone Settings tab and it will be used whenever Levure packages your app.

You can use the Levure packager to package up your app and then extract the Info.plist file from the resulting standalone that is created.

Packaging

The appcast.xml file and the version # folder are all that are included when packaging. Refer to the following section of the README:

https://github.com/trevordevore/levureh ... pplication

The folder is where you place your release_notes.html file. It would be nice if there was an automated way of generating the releaser_notes.html file but for now you have to do it by hand. The appcast.xml will contain the links to your Windows installer/Mac DMG files. Those files are created by other helpers or by hand.

I use the DropDMG and Inno Setup helpers to help generate the Mac DMG and the Windows installer. Links to the helpers can be found on the 3rd party Helper page:

https://github.com/trevordevore/levure/ ... ty-helpers
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Sat Nov 03, 2018 1:00 am

OK I'm too the point that when I check for updates in Windows it's telling me I have the current version. Haven't tried an actual update yet, so that's as expected. On Mac it's not updating the info.plist file with the URL to the appcast.xml file. To see if that was the only issue, I manually entered the url into the plist file and then run the app - that works and tells me I have the current version as expected.

I noticed that as it's doing the build the message box updates with what it's doing and though the build.log shows that it's "Done packaging application," the last thing in the message box (to the right of the little icons along the top) is "revErrorDisplay." Is that as expected?

I'm very stoked about this! What a slick system.
Attachments
revErrorDisplay.png
revErrorDisplay.png (12.78 KiB) Viewed 15776 times

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Sat Nov 03, 2018 1:47 am

Making progress!

Regarding errors - In the ./Contents/Info.plist of your packaged macOS standalone is there the string "[[SUFeedURL]]"? If so then there is most likely an error that is occurring.

Is revErrorDisplay visible on the screen? If not then maybe "go stack revErrorDisplay" and see if it shows a message.

You can also check the ./builds/build.log file to see if everything completed. If the build was successful then the log will end with "Done packaging application". Otherwise it will say "Don't packaging application with error:" and will have an error message.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Sat Nov 03, 2018 1:59 am

Yes I have included the placeholder in the plist file:
<key>SUFeedURL</key>
<string>[[SUFeedURL]]</string>
<key>SUEnableAutomaticChecks</key>
<true/>

And if I manually enter the url then it works. I just tried a build and there's no revErrorDisplay window and the build.log shows "Done packaging application" at the end.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Sat Nov 03, 2018 4:14 am

Hmm, I wonder if there is some code I need to commit to the `master` branch and release before the search/replace will work. I will look at it tomorrow.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Sun Nov 04, 2018 6:41 am

Marty - the problem is that the App Updater helper needs code that is in the `develop` branch of Levure. If you are familiar with how to download alternative branche in a GitHut account then you download it. I will be making a new release of Levure on the `master` branch early next week.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Mon Nov 05, 2018 8:53 pm

Marty,

I've updated Levure to version 0.9.8 which has the necessary changes for the app updater helper to work. If you are using Git to manage your project then you can just pull the latest from master. Otherwise you can download the ZIP file from the Releases page:

https://github.com/trevordevore/levure/releases
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Thu Nov 08, 2018 11:59 pm

Thanks Trevor. That seems to be working for me now.

If I wanted to set up a preference option where the user could toggle off/on the framework automatically checking for updates when the app starts up, would I use the command:

appupdaterSetAutomaticallyCheckForUpdates (true/false)?

If so, would this work in the background and only alert the user if an update was available?

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Fri Nov 09, 2018 1:09 am

Yes, you can call `appupdaterSetAutomaticallyCheckForUpdates` to change automatic checking in the background. And yes, it would only alert the user if an update is available.

Be aware that the default setting can be controlled with the `<key>SUEnableAutomaticChecks</key>` key in the Info.plist file. When you call `appupdaterSetAutomaticallyCheckForUpdates` a preference will be set that will override the Info.plist setting.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Fri Nov 09, 2018 8:15 pm

Perfect. So in my Preference stack I have a checkbox to "always check for updates on launch," then that sets appupdaterSetAutomaticallyCheckForUpdates to true or false. Then when the app starts up it looks for the preference setting and if true then it calls appupdaterCheckForUpdatesInBackground. Works great.

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Fri Nov 09, 2018 8:22 pm

In your preferences stack you can set the checkbox using the value returned by `appupdaterAutomaticallyCheckForUpdates()`. Sparkle will automatically check the value in your Info.plist file or the value in your preferences set when you call `appupdaterSetAutomaticallyCheckForUpdates` and check for updates for you.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1005
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Re: App Updater helper for Levure

Post by trevordevore » Fri Nov 09, 2018 8:23 pm

Sparkle performs that check when you call `appupdaterInitialize` in `InitializeApplication`.
Trevor DeVore
ScreenSteps - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

martyknapp
Posts: 52
Joined: Fri Mar 24, 2006 5:33 pm
Location: Blaine, Washington - USA

Re: App Updater helper for Levure

Post by martyknapp » Fri Nov 09, 2018 11:20 pm

I was just noticing that the appcast.xml file included with the update helper has the path configured as:

url="https://www.your-company.com/download/your-app/1_0/[[BUILD_PROFILE]]/[[MACOS_INSTALLER_NAME]]%20[[VERSION]]-[[BUILD]].dmg"

But to match the way the updater creates an update folder named by version-build which goes in the build profile folder, doesn't it need /[[VERSION]]-[[BUILD]] right after the [[BUILD_PROFILE]] ?

Locked

Return to “Community Projects”