cpliakas/manifest-publisher

A command line tool that builds and publishes a herrera-io/php-phar-update manifest.json file

0.2.0 2017-12-19 03:01 UTC

This package is auto-updated.

Last update: 2024-11-25 13:55:40 UTC


README

Build Status HHVM Status Scrutinizer Code Quality Latest Stable Version License

Want to implement and sustain a self-update capability in your phar that is similar to Composer's self-update command?

Manifest Publisher is a CLI tool that builds on top of the Box and Phar Update projects in order to make it easy to implement and sustain a self-update capability in your phar. From a technical standpoint, it automatically generates and publishes the manifest.json file used by the Phar Update library to determine when an update is available for your application. The manifest.json file can be published to various targets, usually GitHub Pages.

Background

Distributing a CLI application as a phar is surprisingly simple thanks to the excellent work of Kevin Herrera on the Box project. He even took it a step further and made it trivial to implement a self-update capability similar to Composer's php composer.phar self-update command so that your users can easily keep the application up to date. Refer to the Distributing a PHP CLI app with ease blog post by Matthieu Moquet for a detailed walkthrough of the Phar Update tool. This project picks up where the blog post leaves off and provides a more robust tool that automatically generates and publishes the manifest.json file to various targets.

Installation

Download the manifest.phar file from https://github.com/cpliakas/manifest-publisher/releases via the browser, or download the latest stable version via the command line:

  • curl -O http://www.chrispliakas.com/manifest-publisher/download/latest/manifest.phar

Usage

Generate the manifest.json for the vendor/repository project and publish it to GitHub Pages.

  • php manifest.phar publish:gh-pages vendor/repository

Update the manifest.phar application to the latest stable version (Yes, this project drinks its own champagne).

  • php manifest.phar self-update

Assumptions

  • You are acting on a repository hosted on GitHub that you have push access to
  • A box.json file is present in the project's root directory
  • The gh-pages branch has been set up according to GitHub's documentation
  • The phar is distributed via GitHub Releases with tag names exactly matching the corresponding VCS tags

Gotchas

  • Ensure the vendor/herrera-io/phar-update/res/schema.json is included in box.json
  • Manifest Publisher currently does not work with private Github repos