radiate
Development task runner
Last updated 5 years ago by stevelacy .
MIT · Bugs · Original npm · Tarball · package.json
$ cnpm install radiate 
SYNC missed versions from official npm registry.

# Radiate [![Build Status](https://img.shields.io/travis/stevelacy/radiate.svg?style=flat-square)](https://travis-ci.org/stevelacy/radiate) [![NPM version](https://img.shields.io/npm/v/radiate.svg?style=flat-square)](http://badge.fury.io/js/radiate)

development task runner

Run devop tasks, deploy code, and run commands on local and remote machines.

Usage

Install

npm install --global radiate

Use the command radiate to run the tasks in your radiate.js file.

radiate.js file

A radiate file exports a main function which takes one argument, the radiate instance.


'use strict';

module.exports = function(r) {

  // Set config values

  // String, value
  r.set('env', 'development');
  // => r.config.env == 'development'

  // String, true
  r.set('devops');
  // => r.config.devops == true

  // String, Object
  r.set('development-server', {
    host: '127.0.0.1',
    user: 'root',
    source: ['./*'],
    destination: '/var/www/app',
    pass: 'test',
    flags: 'avz',
  });


  // Execute a shell command on the local machine with options
  r.exec('ls', ['-al']);

  // Execute pass through function
  r.exec(function() {
    // Any functions in a task
    // Ex:
    fs.mkdirSync('test');
  });

  // deploy (push) code to a remote server
  // You must set the config for the server prior to the `deploy` command
  // this will use the config set in `r.set('<server name>', {})`
  // Ex: `r.set('development-server', {host: '127.0.0.1'})`
  r.deploy('development-server');

  // Run commands on the remote server
  // Also requires the config set in `r.set('<server name>', {})`
  r.remote('development-server', 'ls -al /tmp', function() {
    // do stuff
  });

};

CLI

Default task: $ radiate Radiate will run the main exported function by default

module.exports = function(r) {
  // r.exec ...
}

Individual tasks: $ radiate deploy Radiate will run any task names which are exported

module.exports = {
  build: function(r) {
    // r.exec('build-assets', 'gulp');
  },
  deploy: function(r) {
    // r.deploy('production');
  }
}

set(String, String<opt> || Object<opt>)

This also sets the server config for the commands deploy and remote

Set a string to true

r.set('name');
// => r.config.name == true

Set a string to a value

r.set('name', 'value');
// => r.config.name == 'value'

Set a string to an object

r.set('name', {key: 'value'});
// => r.config.name == {key: 'value'}

Setting servers for deploy or remote tasks:

rsync is used to transfer the files. simple-ssh is used for the SSH sessions.

Example with Custom ssh keys/locations. The param shell allows you to add pure SSH Rsync commands as rsync(1) lists under option --rsh or -e

r.set('development-server', {
  host: '127.0.0.1',
  user: 'root',
  key: fs.readFileSync('/home/root/.ssh/id_rsa'),
  source: ['./*'],
  destination: '/tmp/',
  shell: 'ssh -i /home/root/.ssh/id_rsa -oIdentitiesOnly=yes -oStrictHostKeyChecking=no',
  flags: 'avz',
});

Refer to their docs for more complex connection settings.

exec(String, Array<opt>, Function<opt>)

Execute a shell command on the process machine (local)

r.exec('ls', ['-al'], function () {

});

deploy(String, Object<opt>, Function<opt>)

Deploy to the specified server via config This uses the preset server config from #set

r.deploy('development-server', function(r) {

})

remote(String, Object || String, Function<opt>)

Execute a shell command on the remote machine as defined by the server name in the config.

Second param as String(<command>)

r.remote('development-server', 'ls -al', function(r) {
  // do stuff
});

Second param as Object({cmd: <command> })

r.remote('development-server', {cmd: 'ls -al'}, function(r) {
  // do stuff
});

License MIT

Current Tags

  • 0.1.3                                ...           latest (5 years ago)

4 Versions

  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (6)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |