shipit-cli
Universal automation and deployment tool written in JavaScript.
Last updated 6 months ago by neoziro .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install shipit-cli 
SYNC missed versions from official npm registry.

shipit-cli

Build Status version MIT License

Shipit command line interface.

npm install --save-dev shipit-cli

Usage

Usage: shipit <environment> <tasks...>

Options:

  -V, --version         output the version number
  --shipitfile <file>   Specify a custom shipitfile to use
  --require <files...>  Script required before launching Shipit
  --tasks               List available tasks
  --environments        List available environments
  -h, --help            output usage information

shipitfile.js

module.exports = shipit => {
  shipit.initConfig({
    staging: {
      servers: 'myproject.com',
    },
  })

  shipit.task('pwd', async () => {
    await shipit.remote('pwd')
  })
}

API

shipit.task(name, [deps], fn)

Create a new Shipit task. If a promise is returned task will wait for completion.

shipit.task('hello', async () => {
  await shipit.remote('echo "hello on remote"')
  await shipit.local('echo "hello from local"')
})

shipit.blTask(name, [deps], fn)

Create a new Shipit task that will block other tasks during its execution. If a promise is returned other task will wait before start.

shipit.blTask('hello', async () => {
  await shipit.remote('echo "hello on remote"')
  await shipit.local('echo "hello from local"')
})

shipit.start(tasks)

Run Shipit tasks.

shipit.start('task')
shipit.start('task1', 'task2')
shipit.start(['task1', 'task2'])

shipit.local(command, [options])

Run a command locally and streams the result. See ssh-pool#exec.

shipit
  .local('ls -lah', {
    cwd: '/tmp/deploy/workspace',
  })
  .then(({ stdout }) => console.log(stdout))
  .catch(({ stderr }) => console.error(stderr))

shipit.remote(command, [options])

Run a command remotely and streams the result. Run a command locally and streams the result. See ssh-pool#connection.run.

shipit
  .remote('ls -lah')
  .then(([server1Result, server2Result]) => {
    console.log(server1Result.stdout)
    console.log(server2Result.stdout)
  })
  .catch(error => {
    console.error(error.stderr)
  })

shipit.copyToRemote(src, dest, [options])

Make a remote copy from a local path to a remote path. See ssh-pool#connection.copyToRemote.

shipit.copyToRemote('/tmp/workspace', '/opt/web/myapp')

shipit.copyFromRemote(src, dest, [options])

Make a remote copy from a remote path to a local path. See ssh-pool#connection.copyFromRemote.

shipit.copyFromRemote('/opt/web/myapp', '/tmp/workspace')

shipit.log(...args)

Log using Shipit, same API as console.log.

shipit.log('hello %s', 'world')

Workflow tasks

When the system initializes it automatically emits events:

  • Emit event "init"
  • Emit event "init:after_ssh_pool"

Each shipit task also generates events:

  • Emit event "task_start"
  • Emit event "task_stop"
  • Emit event "task_err"
  • Emit event "task_not_found"

Inside the task events, you can test for the task name.

shipit.on('task_start', event => {
  if (event.task == 'first_task') {
    shipit.log("I'm the first task")
  }
})

License

MIT

Current Tags

  • 5.3.0                                ...           latest (6 months ago)

25 Versions

  • 5.3.0                                ...           6 months ago
  • 5.2.0                                ...           7 months ago
  • 5.1.0                                ...           a year ago
  • 5.0.0                                ...           a year ago
  • 4.2.0                                ...           2 years ago
  • 4.1.2                                ...           2 years ago
  • 4.1.1                                ...           2 years ago
  • 4.1.0                                ...           2 years ago
  • 4.0.2                                ...           3 years ago
  • 4.0.1                                ...           3 years ago
  • 4.0.0                                ...           3 years ago
  • 3.0.0                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.5.2                                ...           4 years ago
  • 1.5.1                                ...           4 years ago
  • 1.4.1                                ...           5 years ago
  • 1.4.0                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
  • 0.0.1                                ...           6 years ago
Maintainers (2)
Downloads
Today 0
This Week 77
This Month 227
Last Day 3
Last Week 68
Last Month 208
Dependencies (9)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |