opmjsonupdateeditor

From Free Pascal wiki
Revision as of 13:39, 17 December 2016 by Minesadorada (talk | contribs) (Directory Structure)

Online Package Manager External Update json Editor

Screenshots

jp mainwindow.jpg

jp filemenu.jpg

jp helpmenu.jpg

Purpose

  • To make and maintain package information for Online Package Manager easily, accurately and quickly.

Installation

  • There is a Windows Installer and a Zipfile of Linux executables (see Download below) available.
  • Source code is also available to compile with Lazarus v1.62+ and FPC v3.00+ (best with Laz1.7+/fpc3.11+)

Directory Structure

  • JsonEditor is designed to be deployed in the same folder as your component.
    • If you maintain multiple components, a copy of JsonEditor should be deployed in the main folder of each one.
    • Each copy of JsonEditor will maintain its own distinct cfg file in the GetAppConfigDir location.
  • When first started up, JsonEditor will make the subfolders:
- \updates
- \locale


  • Suggested structure for your component:
- \componentfolder
- \componentfolder\stable_version
- \componentfolder\stable_version\updates
- \componentfolder\stable_version\locale
  • \componentfolder - contains the working version of your component code
  • \componentfolder\stable_version - contains the published version (source code only), and also a copy of JsonEditor(.exe)
  • \componentfolder\stable_version\updates - contains the update json and update Zipfile
  • \componentfolder\stable_version\locale - contains the language files for JsonEditor
    • This works very well in practise, especially if your project is under version control (svn, github etc)

Making a new OnlinePackageManager update json

  • Fire up JsonEditor and fill in all the fields for your package.
    • It is essential that the package lpk name exactly matches the one already installed in OPM, otherwise you can choose whatever filenames you like.
  • The first time you use JsonEditor, a pop-up hint window will show you what each field is for.
  • When you click [Save], if any field needs amending a dialog will tell you what is wrong, and problem fields will highlight.
    • Only a validated json will be saved to disk.
    • By default the json is named update_<zipfilename>.json and saved to the \updates folder
    • JsonEditor will also offer to copy the Zipfile to the \updates folder if it was in a different folder
    • JsonEditor will offer to Auto-Load the same component info when it is next opened.
  • If you have a multiple components entry in OPM (e.g. Designtime and Runtime), you can make an update_json file for them all (Click [Add] in JsonEditor)
    • Each can have its own version number and other characteristics
  • Finally, upload the Zipfile and json file to a place where OnlinePackageManager can find it.
    • Please note: After you uploaded the JSON the changes are not immediately visible in the tree. Usually it takes 1-2 min. or less.

Maintaining a package with OnlinePackageManager and JsonEditor

  • Make a new update Zipfile and put it into the \updates folder
    • Pay attention to embedded paths in the zip
    • You can include example/demo source code in the Zip
    • Be sure to prune out anything not needed, like /backup /lib folders and executables etc.
  • Fire up JsonEditor and click File/Load
    • If Auto-Load was chosen, it will already have loaded the last-saved package info
  • Update the version info for your package(s) thus:

"DownloadZipURL" --> Link to your new, updated package

"DisableInOPM" --> If you want to temporary disable your package, set this boolean to true. It's useful for maintenance, the package will be grayed out in the tree. The user cannot download/install/update the package.

"Version"/"ForceNotify"/"InternalVersion" --> To trigger an update message on the users computer, you can either:

  • Increase the "Version" number. Useful when you want to release a new version of the package.
  • Set "ForceNotify" to true. Useful after a minor change in your source, that does not require a version change or in case of trunk version. To prevent continous error messages, "ForceNotify" must be used in combination with "InternalVersion". After the user updates the package, OPM locally stores the "InternalVersion" value. If you want to trigger a new message, increase "InternalVersion" with one. If "ForceNotify" is true, "Version" is always ignored.

The most common scenario is this:

  • Modify "DownloadZipURL"
  • Increase version number when necessary.
  • Click [Save] in JsonEditor
  • Finally, upload the Zipfile and json file to a place where OPM can find it.
    • Please note: After you uploaded the JSON the changes are not immediately visible in the tree. Usually it takes 1-2 min. or less.

Licence

  • JsonEditor is published under a general GPL license.

Download