1.0.1 • Published 8 years ago

bundled-gem-spawn v1.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

bundled-gem-spawn

NPM version Build Status Build status Coverage Status Dependency Status devDependency Status

A Node module to launch a new process with the given command in a bundle exec context

const bundledGemSpawn = require('bundled-gem-spawn');

bundledGemSpawn('sass', ['--version'])
.stdout.pipe(process.stdout); //=> 'Sass 3.4.19 (Selective Steve)'

Installation

Use npm.

npm install bundled-gem-spawn

Also make sure Bundler is installed.

API

const bundledGemSpawn = require('bundled-gem-spawn');

bundledGemSpawn(cmd , args, options)

cmd: String (the command to run)
args: Array (additional arguments passed to the command)
options: Object (directly passed to child_process#spawn)
Return: ChildProcess instance

It has exactly the same API as child_process#spawn's. The only difference is that bundled-gem-spawn runs the command in a bundle exec context.

const bundledGemSpawn = require('bundled-gem-spawn');
bundledGemSpawn('rails', ['c'])

// --- is almost the same script as ---

const {spawn} = require('child_process');
spawn('bundle', ['exec', 'rails', 'c'])

Testing

Requires Git, Node v4+ and Docker machine.

  1. Clone this repository and change CWD to the cloned bundled-gem-spawn directory.
  2. Run npm install.
  3. Create and run a container with no additional settings.
  4. Run npm test.

License

Copyright (c) 2015 - 2016 Shinnosuke Watanabe

Licensed under the MIT License.