+4
-4
| # .editorconfig <https://github.com/tunnckoCore/dotfiles> | ||
| # | ||
| # Copyright (c) 2014 Charlike Mike Reagent, contributors. | ||
| # Copyright (c) 2015 Charlike Mike Reagent, contributors. | ||
| # Released under the MIT license. | ||
@@ -16,5 +16,2 @@ # | ||
| [*.{json,cson,yml,yaml,md,jade,css,stylus}] | ||
| indent_size = 2 | ||
| [*.{js,php}] | ||
@@ -28,2 +25,5 @@ indent_size = 2 | ||
| [*.{json,cson,yml,yaml,html,md,jade,css,stylus}] | ||
| indent_size = 2 | ||
| [Makefile] | ||
@@ -30,0 +30,0 @@ indent_size = 2 |
+1
-1
| # .gitattributes <https://github.com/tunnckoCore/dotfiles> | ||
| # | ||
| # Copyright (c) 2014 Charlike Mike Reagent, contributors. | ||
| # Copyright (c) 2015 Charlike Mike Reagent, contributors. | ||
| # Released under the MIT license. | ||
@@ -5,0 +5,0 @@ # |
+5
-6
@@ -69,9 +69,9 @@ { | ||
| "requireSpacesInNamedFunctionExpression": { | ||
| "requireSpacesInFunctionExpression": { | ||
| "beforeOpeningCurlyBrace": true | ||
| }, | ||
| "requireSpacesInAnonymousFunctionExpression": { | ||
| "beforeOpeningCurlyBrace": true | ||
| "disallowSpacesInFunctionExpression": { | ||
| "beforeOpeningRoundBrace": true | ||
| }, | ||
| "disallowSpacesInAnonymousFunctionExpression": { | ||
| "disallowSpacesInFunctionDeclaration": { | ||
| "beforeOpeningRoundBrace": true | ||
@@ -115,5 +115,4 @@ }, | ||
| "temp/**", | ||
| "tmp/**", | ||
| "fixtures/**" | ||
| "tmp/**" | ||
| ] | ||
| } |
+2
-2
@@ -7,5 +7,5 @@ language: node_js | ||
| allow_failures: | ||
| - node_js: "0.11" | ||
| - node_js: "0.10" | ||
| fast_finish: true | ||
| script: "npm run-script test-travis" | ||
| after_script: "npm install coveralls@2.11.2 && cat ./coverage/lcov.info | coveralls" | ||
| after_script: "npm install coveralls && cat ./coverage/lcov.info | coveralls" |
+5
-0
@@ -0,1 +1,6 @@ | ||
| ## v1.0.4 / January 21, 2015 | ||
| - make it **hybrid** (with hybrid api) using `hybridify` | ||
| - add more keywords | ||
| - update license year and dotfiles | ||
| ## v1.0.3 / December 21, 2014 | ||
@@ -2,0 +7,0 @@ - fix badge`s heading |
+14
-1
@@ -13,4 +13,17 @@ /** | ||
| var Deferred = require('native-or-another'); | ||
| var handleCallback = require('handle-callback'); | ||
| var handleArguments = require('handle-arguments'); | ||
| module.exports = function execCmd(cmd, args, opts) { | ||
| module.exports = function hybridExecCmd() { | ||
| var argz = handleArguments(arguments); | ||
| var promise = execCmd.apply(this, argz.args); | ||
| if (argz.callback) { | ||
| promise = handleCallback(promise, argz.callback); | ||
| } | ||
| return promise; | ||
| } | ||
| function execCmd(cmd, args, opts) { | ||
| var stdout = new Buffer(''); | ||
@@ -17,0 +30,0 @@ var stderr = new Buffer(''); |
+23
-12
| { | ||
| "name": "exec-cmd", | ||
| "version": "1.0.3", | ||
| "version": "1.0.4", | ||
| "description": "Simple, fast and cross-platform executing commands (with child_process spawn) using Bluebird or Native Promise", | ||
@@ -21,18 +21,27 @@ "scripts": { | ||
| "keywords": [ | ||
| "api", | ||
| "apis", | ||
| "aplus", | ||
| "bluebird", | ||
| "cmd", | ||
| "cmds", | ||
| "command", | ||
| "commands", | ||
| "cross", | ||
| "cross-platform", | ||
| "easy", | ||
| "exec", | ||
| "execute", | ||
| "spawn", | ||
| "fast", | ||
| "hybrid", | ||
| "hybridify", | ||
| "hybridify-api", | ||
| "hybridify-apis", | ||
| "native", | ||
| "platform", | ||
| "promise", | ||
| "promises", | ||
| "promises-aplus", | ||
| "cmd", | ||
| "command", | ||
| "commands", | ||
| "bluebird", | ||
| "native", | ||
| "cross-platform", | ||
| "simple", | ||
| "fast", | ||
| "cross", | ||
| "platform" | ||
| "spawn" | ||
| ], | ||
@@ -45,2 +54,4 @@ "license": { | ||
| "cross-spawn": "^0.2.3", | ||
| "handle-arguments": "^1.0.2", | ||
| "handle-callback": "^1.0.1", | ||
| "native-or-another": "^2.0.0" | ||
@@ -54,2 +65,2 @@ }, | ||
| } | ||
| } | ||
| } |
+26
-3
| ## [![npm versi][npmjs-img]][npmjs-url] [![mit license][license-img]][license-url] [![build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![deps status][daviddm-img]][daviddm-url] | ||
| > Simple, fast and cross-platform executing commands (with child_process spawn) using Bluebird or Native Promise | ||
| > Simple, fast and cross-platform executing commands (with child_process spawn) using Bluebird or Native Promise. **The package is [hybrid][hybridify] - with [hybridify][hybridify] api!** | ||
| ## Install | ||
@@ -24,2 +25,21 @@ ```bash | ||
| }) | ||
| var promise = exec('echo', [ | ||
| 'hello world' | ||
| ], function(err, res) { | ||
| assert(!err) | ||
| // console.log('from cb') | ||
| strictEqual(res.trim(), 'hello world'); | ||
| }) | ||
| .then(function(stdout) { | ||
| // console.log('from then (promise)') | ||
| strictEqual(stdout.trim(), 'hello world'); | ||
| done(); | ||
| }) | ||
| .catch(function(stderr) { | ||
| /* istanbul ignore next */ | ||
| notStrictEqual(stderr.trim(), 'hello world'); | ||
| /* istanbul ignore next */ | ||
| done(); | ||
| }) | ||
| ``` | ||
@@ -38,3 +58,3 @@ | ||
| ## License [![MIT license][license-img]][license-url] | ||
| Copyright (c) 2014 [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf]. | ||
| Copyright (c) 2015 [Charlike Mike Reagent][contrib-more], [contributors][contrib-graf]. | ||
| Released under the [`MIT`][license-url] license. | ||
@@ -68,2 +88,5 @@ | ||
| _Powered and automated by [readdirp + hogan.js](https://github.com/tunnckoCore), December 21, 2014_ | ||
| _Powered and automated by [kdf](https://github.com/tunnckoCore), January 21, 2015_ | ||
| [hybridify]: https://github.com/tunnckoCore/hybridify |
+19
-0
@@ -42,2 +42,21 @@ /** | ||
| it('should be with hybrid api', function(done) { | ||
| var promise = exec('echo', [ | ||
| 'hello world' | ||
| ], function(err, res) { | ||
| assert(!err) | ||
| strictEqual(res.trim(), 'hello world'); | ||
| }) | ||
| .then(function(stdout) { | ||
| strictEqual(stdout.trim(), 'hello world'); | ||
| done(); | ||
| }) | ||
| .catch(function(stderr) { | ||
| /* istanbul ignore next */ | ||
| notStrictEqual(stderr.trim(), 'hello world'); | ||
| /* istanbul ignore next */ | ||
| done(); | ||
| }) | ||
| }); | ||
| it('should pass args to node fixtures/hellow-world.js', function(done) { | ||
@@ -44,0 +63,0 @@ var promise = exec('node', [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18538
9.87%212
15.22%89
32.84%4
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added