1.0.1 • Published 9 years ago
bundled-gem-spawn v1.0.1
bundled-gem-spawn
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
npm install bundled-gem-spawnAlso 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.
- Clone this repository and change CWD to the cloned
bundled-gem-spawndirectory. - Run
npm install. - Create and run a container with no additional settings.
- Run
npm test.
License
Copyright (c) 2015 - 2016 Shinnosuke Watanabe
Licensed under the MIT License.