Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

commander mode init

  • Loading branch information...
commit 2a1cb902a3f50bf474f97701e333280af521d177 1 parent af69119
@fengmk2 fengmk2 authored
View
1  .gitignore
@@ -1,4 +1,5 @@
lib-cov
+coverage.html
*.seed
*.log
*.csv
View
6 .npmignore
@@ -0,0 +1,6 @@
+test/
+coverage.html
+lib-cov/
+Makefile
+.travis.yml
+logo.png
View
5 .travis.yml
@@ -0,0 +1,5 @@
+language: node_js
+node_js:
+ - 0.9
+ - 0.8
+ - 0.6
View
21 LICENSE.txt
@@ -0,0 +1,21 @@
+This software is licensed under the MIT License.
+
+Copyright (C) 2012 by fengmk2 <fengmk2@gmail.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
View
48 README.md
@@ -1,4 +1,48 @@
-jscover
+jscover [![Build Status](https://secure.travis-ci.org/fengmk2/jscover.png)](http://travis-ci.org/fengmk2/jscover)
=======
-node wrap for JSCover.
+![logo](https://raw.github.com/fengmk2/jscover/master/logo.png)
+
+node wrap for [JSCover](http://tntim96.github.com/JSCover/).
+
+jscoverage: [100%](http://fengmk2.github.com/coverage/jscover.html)
+
+## Install
+
+```bash
+$ npm install jscover
+```
+
+## Usage
+
+Just like `jscoverage`
+
+```bash
+# jscoverage lib lib-cov
+$ jscover lib lib-cov
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2012 fengmk2 &lt;fengmk2@gmail.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
BIN  bin/JSCover-all.jar
Binary file not shown
View
43 bin/jscover.js
@@ -0,0 +1,43 @@
+/*!
+ * jscover - bin/jscover.js
+ * Copyright(c) 2012 fengmk2 <fengmk2@gmail.com>
+ * MIT Licensed
+ */
+
+"use strict";
+
+/**
+ * Module dependencies.
+ */
+
+var program = require('commander');
+var version = require('../package.json').version;
+var jscover = require('../');
+
+program
+ .version(version)
+ .option('--js-version', 'use the specified JavaScript version')
+ .option('--no-instrument', 'copy but do not instrument PATH')
+ .option('--exclude', 'don\'t copy from source/PATH')
+ .parse(process.argv);
+
+// if (program.peppers) console.log(' - peppers');
+// if (program.pineapple) console.log(' - pineappe');
+// if (program.bbq) console.log(' - bbq');
+// console.log(' - %s cheese', program.cheese);
+
+var source = program.args[0];
+var target = program.args[1];
+var options = {};
+
+jscover(source, target, options, function (err, stdout) {
+ if (err) {
+ if (stdout) {
+ console.error(stdout);
+ }
+ throw err;
+ }
+ if (stdout) {
+ console.log(stdout);
+ }
+});
View
1  index.js
@@ -0,0 +1 @@
+module.exports = process.env.JSCOVER_COV ? require('./lib-cov/jscover') : require('./lib/jscover');
View
46 lib/jscover.js
@@ -0,0 +1,46 @@
+/*!
+ * jscover - lib/jscover.js
+ * Copyright(c) 2012 fengmk2 <fengmk2@gmail.com>
+ * MIT Licensed
+ */
+
+"use strict";
+
+/**
+ * Module dependencies.
+ */
+
+var exec = require('child_process').exec;
+var path = require('path');
+
+var root = path.dirname(__dirname);
+var JSCoverPath = path.join(root, 'bin', 'JSCover-all.jar');
+var JSCoverCommand = 'java -jar ' + JSCoverPath + ' -fs';
+
+module.exports = function jscover(source, target, options, callback) {
+ var cmd = JSCoverCommand + ' ' + source + ' ' + target;
+ console.log(cmd)
+ var child = exec(cmd, function (err, stdout, stderr) {
+ var output = '';
+ if (stdout) {
+ output += stdout;
+ }
+ if (stderr) {
+ output += stderr;
+ if (!err) {
+ err = new Error(stderr);
+ err.name = 'JSCoverError';
+ }
+ }
+ if (err) {
+ return callback(err, output);
+ }
+
+ var success = !stdout && !stderr;
+ if (!success) {
+ return callback(null, output);
+ }
+
+
+ });
+};
View
33 package.json
@@ -0,0 +1,33 @@
+{
+ "name": "jscover",
+ "version": "0.0.1",
+ "description": "node wrap for JSCover.",
+ "main": "index.js",
+ "directories": {
+ "test": "test"
+ },
+ "bin": {
+ "jscover": "./lib/jscover.js"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "dependencies": {
+ "commander": "1.0.5"
+ },
+ "devDependencies": {
+ "should": "*",
+ "mocha": "*"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/fengmk2/jscover.git"
+ },
+ "keywords": [
+ "jscover",
+ "JSCover",
+ "jscoverage"
+ ],
+ "author": "fengmk2 <fengmk2@gmail.com>",
+ "license": "MIT"
+}
Please sign in to comment.
Something went wrong with that request. Please try again.