Comparing version 0.3.6 to 0.3.7
@@ -6,7 +6,81 @@ // Bluecat client command line tool | ||
var Path = require('path'); | ||
var Inquirer = require('inquirer'); | ||
var Exec = require('child_process').exec; | ||
var argv = require('yargs') | ||
.usage('Usage: $0 <config|api>') | ||
.demand(1) | ||
.argv; | ||
var dir = Path.join(__dirname, '../../../config'); | ||
var questions = [ | ||
{ | ||
type: 'input', | ||
name: 'project_name', | ||
message: 'What\'s the name of your project', | ||
//default: 'Service test' | ||
} | ||
]; | ||
if (!Fs.existsSync(dir)){ | ||
Fs.mkdirSync(dir); | ||
if(argv._[0] === 'config') { | ||
console.log('\n==========================================='); | ||
console.log('Bluecat Test Framework Configuration Helper'); | ||
console.log('===========================================\n'); | ||
Inquirer.prompt( questions, function( answers ) { | ||
// console.log( JSON.stringify(answers, null, ' ') ); | ||
// setting up config dir | ||
var dir = Path.join(process.cwd(), 'config'); | ||
if (!Fs.existsSync(dir)){ | ||
Fs.mkdirSync(dir); | ||
} | ||
var content = {}; | ||
content[answers.project_name] = { | ||
get:{ | ||
schema: "http", | ||
method: ["GET"], | ||
}, | ||
post:{ | ||
schema: "http", | ||
method: ["POST"], | ||
} | ||
}; | ||
Fs.appendFileSync(Path.join(dir, 'api.json'), JSON.stringify(content, null, 2) + ',\n'); | ||
content = { | ||
env: "production", | ||
proxy: null, | ||
server: { | ||
host: "http://httpbin.org/", | ||
} | ||
}; | ||
Fs.appendFileSync(Path.join(dir, 'default.json'), JSON.stringify(content, null, 2) + ',\n'); | ||
// setting up test dir | ||
dir = Path.join(process.cwd(), 'test'); | ||
if (!Fs.existsSync(dir)){ | ||
Fs.mkdirSync(dir); | ||
} | ||
var testContent = ` | ||
var Config = require('config'); | ||
var Bluecat = require('bluecat'); | ||
var api = Bluecat.Api('pangaea'); | ||
service = new Bluecat.ServiceSync(api, Config.server.host); | ||
service.setProxy(Config.proxy); | ||
exports.${answers.project_name} = service; | ||
`; | ||
Fs.appendFileSync(Path.join(dir, 'test.js'), JSON.stringify(content, null, 2) + ',\n'); | ||
// setting up root dir | ||
var content = { | ||
name: answers.project_name, | ||
version: '0.0.1', | ||
dependencies: { | ||
} | ||
}; | ||
Fs.appendFileSync(Path.join(process.cwd(), 'package.json'), JSON.stringify(conntent, null, 2) + ',\n'); | ||
var output = Exec('npm install bluecat chai config mocha mocha-espresso mocha-multi --save'); | ||
}); | ||
} | ||
exports.ServiceSync = require('./service.gen.sync'); | ||
exports.ServiceAsync = require('./service.gen.async'); | ||
exports.Api = require('./service.api'); | ||
exports.version = '0.3.6'; | ||
exports.version = '0.3.7'; |
{ | ||
"name": "bluecat", | ||
"version": "0.3.6", | ||
"version": "0.3.7", | ||
"author": "ccy <ccy.chenchaoyi@gmail.com>", | ||
@@ -27,5 +27,7 @@ "description": "Generic REST API Test Framework", | ||
"hoek": "^2.16.3", | ||
"inquirer": "^0.11.0", | ||
"path": "^0.12.7", | ||
"promise": "^7.0.4", | ||
"request": "2.67.0" | ||
"request": "2.67.0", | ||
"yargs": "^3.31.0" | ||
}, | ||
@@ -32,0 +34,0 @@ "scripts": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28219
632
7
1
+ Addedinquirer@^0.11.0
+ Addedyargs@^3.31.0
+ Addedansi-escapes@1.4.0(transitive)
+ Addedcamelcase@2.1.1(transitive)
+ Addedcli-cursor@1.0.2(transitive)
+ Addedcli-width@1.1.1(transitive)
+ Addedcliui@3.2.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addedexit-hook@1.1.1(transitive)
+ Addedfigures@1.7.0(transitive)
+ Addedinquirer@0.11.4(transitive)
+ Addedinvert-kv@1.0.0(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedlcid@1.0.0(transitive)
+ Addedlodash@3.10.1(transitive)
+ Addedmute-stream@0.0.5(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@1.1.0(transitive)
+ Addedos-locale@1.4.0(transitive)
+ Addedreadline2@1.0.1(transitive)
+ Addedrestore-cursor@1.0.1(transitive)
+ Addedrun-async@0.1.0(transitive)
+ Addedrx-lite@3.1.2(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedwindow-size@0.1.4(transitive)
+ Addedwrap-ansi@2.1.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedy18n@3.2.2(transitive)
+ Addedyargs@3.32.0(transitive)