angelabilities v0.0.3
angelabilities
A collection of angel abilities.
io
When used angel.output
and angel.input
will be references to process.stdout
and process.stdin
angel.log(string, ...)
Does a fancy console.log using angel.cmdData embeded
string
: pattern with{placeholder}
support usingangel.cmdData
as source
shell
Helper methods wrapper of shellreactions-exec
.
All commands support {placeholder}
replacement which uses for data angel.cmdData
angel.exec(commands , next)
commands
: String or Array of commands.next
: optionalfunction(err, result)
, if not present an reactionfunction(angel, next)
will be returned.
angel.cmdData.value = "test"
// with next
angel.exec("echo {value}", function(err, result){
// result == "test"
})
// without next
var fn = angel.exec("echo {value}")
fn(angel, function(err, result){
// result == "test"
})
angel.ssh(remote, commands , next)
remote
: String. Its value will be used to get the correspondingangel.cmdData[remote]
value for ssh connection be madecommands
: String or Array of commands.next
: optionalfunction(err, result)
, if not present an reactionfunction(angel, next)
will be returned.
angel.cmdData.value = "test"
angel.cmdData.remoteA = "production"
angel.cmdData.remoteB = "production2"
// with next
angel.ssh("remoteA", "echo {value}", function(err, result){
// result == "test"
})
// without next
var fn = angel.ssh("remoteB", "echo {value}")
fn(angel, function(err, result){
// result == "test"
})
reactions
Helper methods wrapper of reactions
.
angel.series(fnArray , next)
fnArray
: Array offunction(angel, next)
to be executed in seriesnext
: optional,function(err, result)
, if not present an reactionfunction(angel, next)
will be returned. Note thatresult
will be an Array allfnArray
results.
var reaction = [
function(angel, next) {
next(null, "test")
},
function(angel, next) {
next(null, "test2")
}
]
// with next
angel.series(reaction, function(err, result){
// result[0] == "test", result[1] == "test2"
})
// without next
var fn = angel.series(reaction)
fn(angel, function(err, result){
// result[0] == "test", result[1] == "test2"
})
angel.series.wrap(fn, args... )
fn
: any function having callback as last argumentargs
: arguments to be passed tofn
angel.series( angel.series.wrap(fs.exists, angel.cmdData.value), ... )
Filesystem
angel.fs.cp(src, dest, ignoreList)
Returns reaction function(angel, next)
wrapped arguments and impl.
src
: String, name of thecmdData
property to be used for sourcedest
: String, name of thecmdaData
property to be used for destinationignoreList
: String, matched agains every file
angel.fs.chdir(path)
Returns reaction function(angel, next)
wrapped arguments and impl.
path
: String, name of thecmdData
property to be used for current directory path
angel.fs.tempfolder()
Returns temporary
folder path.
Format
angel.format(value)
Returns String
where any {placeholder}
are replaced using angel.cmdData as source
Thanks to
reactions
https://github.com/vbogdanov/reactions
underscore
shellreactions-exec
https://github.com/outbounder/shellreactions-exec
organic-angel
https://github.com/outbounder/organic-angel
jasmine-node
https://github.com/mhevery/jasmine-node
ncp
https://github.com/AvianFlu/ncp