Automatically build satis package definition files for well-tagged projects without composer.json
PHP
Switch branches/tags
Nothing to show
Clone or download

README.md

fitchlearning/satisfy

A tool to automatically build satis package definition files for well-tagged projects without composer.json

Composer provides for easy management of dependency packages written in PHP which follow sematic versioning in their branches, but won't install anything that doesn't contain a composer.json file. Satis allows the presence of missing remote composer.json files to be simulated, by applying a custom package specification locally, but this then has to be repeated for every version of the target package.

Satisfy takes a specification file that maps locally composer-compatible package names and definitions to remote git repositories, scans the remote repository for "version-like" tags (not branches, as yet), and outputs a satis.json file that satis can use to index all versions of the project, and so make the available for installation.

Usage

satisfy --repofile satis.json --packagefile packagelist.json [--output satis.expanded.json [--cachedays=7]]

'repofile' is a standard satis.json file with your hand-added "repositories" references

'packagefile' is the list of remote git repositories to scan

'output' is generated by satisfy (if it's less than an option 'cachedays' old) by adding the result of scanning 'packagefile'

'outputfile' can then be used by satis:

satis build satis.expanded.json satis-output-directory/

File format

packagelist.json by example:

{
    "twitter/bootstrap": {
        "url": "git://github.com/twbs/bootstrap.git",
        "minversion": "2.0",
        "defaults": {
            "homepage": "http://getbootstrap.com/",
            "description": "Bootstrap is funky"
        }
    },
    "mbostock/d3": {
        "url": "https://github.com/mbostock/d3.git",
        "minversion": "3.0",
        "defaults": {
            "description": "d3 is quite clever too",
            "homepage": "https://github.com/mbostock/d3"
        }
    }
}

package/name (eg twitter/bootstrap) is standard composer.json / satis.json package name format; it does not have to match the github repo path.

url in the immediate context of the package is the clone URL of a git repo (no non-git support yet).

minversion is the lowest version (as per PHP's version_compare) which will be added to the output.

defaults contains pretty much everything you'd put in composer.json or satis.json/repositories/package and will be copied into the output. Don't include a version here.

Requirements

git must be in your path

Caveats

GIGO: if each target repo isn't a readable git repo with at least one tag that matches preg_match('/^v?(\d+.\d+.\d+)(-((rc|alpha|beta).?(\d+)))?$/', the script will blow up.