LocalMachinepacks.writeMachineFile()

Write a new machine file to disk at the specified path.

Usage

Hover over inputs/exits for more info.

var LocalMachinepacks = require('machinepack-localmachinepacks');


// Write a new machine file to disk at the specified path.

LocalMachinepacks.writeMachineFile({

destination: '/Users/mikermcneil/machinepack-foobar/machines/some-machine.js',

friendlyName: 'Do something',

description: 'Do something useful given stuff; maybe return something else.',

moreInfoUrl: 'http://api.stuff.org/foo/bar?v=3.1',

extendedDescription: '...lots of words...',

sync: true,

cacheable: true,

idempotent: true,

inputs: {},

exits: {},

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Something already exists at destination path (probably another machine with the same identity)

alreadyExists: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

destination required

The output path where the machine should be written

'/Users/mikermcneil/machinepack-foobar/machines/some-machine.js'
friendlyName

The human-readable label for this machine. Should be short (<5 words, <50 characters) and written in the imperative mood.

'Do something'
description

A clear, 1-sentence description (< 80 characters) of what this machine does.

'Do something useful given stuff; maybe return something else.'
moreInfoUrl

A URL with supplemental information about this machine

'http://api.stuff.org/foo/bar?v=3.1'
extendedDescription

A markdown string providing additional details about this machine.

'...lots of words...'
sync

A flag indicating that this machine is immediate (i.e. executes synchronously / blocks)

true
cacheable

A flag indicating whether or not this machine is cacheable

true
idempotent

A flag indicating whether or not this machine is idempotent

true
inputs

A dictionary specifying the inputs that the machine accepts at runtime.

{}
exits

A dictionary specifying the exit scenarios played out by the machine at runtime.

{}

Exits

error

An unexpected error occurred.

alreadyExists

Something already exists at destination path (probably another machine with the same identity)

success

OK.