Project Updater

Downloaded 531 times
Average rating
(0 votes)
updater.png

Provides a way to keep procedure files in sync with releases on IgorExchange. This is not a package manager for multi-file projects, just a way to keep individual procedure files updated as new versions are released.

Igor 7 allows procedure files to be updated by external editors. The idea here is to parse the releases page on IgorExchange to find new updates. When a more recent release is found Updater will ask you if you want to download the new release and overwrite the existing file. After the file has been updated, Igor will give the option of reloading the updated version of the procedure file.

If you're an end-user of packages that can be updated this way, all you need to do is to save this package, updater.ipf, in the Igor Procedures folder (look in the Help menu for "Show Igor Pro User Files").

The default settings for Igor Pro will result in Igor presenting the user with a dialog after the procedure file has been updated, giving an option to reload the updated file. For more seamless updating, you can tell Igor to automatically reload any updated file. Choose Misc->Miscellaneous Settings, click Text Editing in the left pane, click the External Editor tab, and select Reload Automatically, As Soon as Modification is Detected. For more information, execute displayHelpTopic "A Plain Text File Has Been Modified Externally" from the command line.

If you're developing a package and wish to use this updater:

  1. Save this package, updater.ipf, in the Igor Procedures folder
  2. Add the following code to your procedure file:
    #pragma version=1.00 // Needed, edit number to match release on IgorExchange
    #pragma moduleName=MyPackage // Recommended. Doesn't have to be same as ksSHORTNAME.
    static constant kCHECK_FOR_UPDATES=1  // Needed. Set to 1 to check for updates on init.
    static strconstant ksSHORTNAME="MyPackage" // The project shortname on IgorExchange, needed if not the same as moduleName.
     
    static function CheckForUpdates()
    	if(kCHECK_FOR_UPDATES)
    		#if (exists("Updater#UpdateCheck")==6)
    			return Updater#UpdateCheck("fileloc:"+FunctionPath(""))
    		#endif
    	endif
    	return 0
    end

    You should edit the values of the constants to match your file.

  3. In the initializing function of your package insert these lines:
    if (CheckForUpdates())
    	return 0 // this file has been updated; quit execution to allow user to reload
    endif

Notes

  • Version 2 introduces a new, simpler, and more robust way to call updater from a procedure. Future versions of packages that work with Project Updater will use this new method. The original code used in prior versions is included for backward compatibility.
  • This package relies on being able to access and interpret the 'All Releases' page at IgorExchange for the project to be updated. New releases should be uploaded to IgorExchange as a plain text, i.e. uncompressed, Igor Pro procedure file.
  • Updater has a menu-driven option (Help -> Updater: Check for new releases) for checking manually for new releases for all open eligible procedure files. To be eligible for checking, a procedure file must have updater headers and functions as described above, and have a regular module name defined by #pragma moduleName = MyPackage.
  • Getting this to work with independent modules is a bit more complicated. View pending patches for more information.
  • User is presented with a doAlert dialog before overwriting any file, but I cannot guarantee that nothing is going to go wrong with this. If the target procedure is somehow corrupted by my code (hasn't happened yet, but I can imagine unforeseen errors related to character encoding or something), replace the procedure file with a fresh copy downloaded from IgorExchange, turn off checking by setting kCHECK_FOR_UPDATES=0, and let me know that I've goofed!
  • Updater selects for download the most recent release that's compatible with the version of Igor that you're using. To roll back to an earlier version of a project release, download the older release from IgorExchange and set kCHECK_FOR_UPDATES=0 in the downloaded file to prevent updater from checking that file.

Projects that work with Project Updater

I've added updater capabilities to most of my packages:

Arc Hull Baseline
Baseline Fitting
CalcPad
Encircle
Spidergram
Tracer

and, of course, Updater can update itself.

More to follow.

Releases

Official releasesDateSizeLinksStatus


Back to top