forked from hindsightsoftware/behave-pro-node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
674f50c
commit 1b313a2
Showing
6 changed files
with
717 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
features | ||
node_modules | ||
*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,39 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
var BehavePro = require('../lib/behavepro'); | ||
var args = require('minimist')(process.argv.slice(2)); | ||
var packageJson = require('../package.json'); | ||
var chalk = require('chalk'); | ||
"use strict"; | ||
var BehavePro = require("../lib/behavepro"); | ||
var args = require("minimist")(process.argv.slice(2)); | ||
var packageJson = require("../package.json"); | ||
var chalk = require("chalk"); | ||
|
||
if (args.help) { | ||
console.log( | ||
chalk.cyan('Behave Pro NodeJS client v' + packageJson.version) + '\n\n' + | ||
'$ behavepro [--id PROJECT ID] [--userId USER] [--apiKey KEY]\n\n' + | ||
' [--host HOST] Behave Pro host - default: \'http://behave.pro\'\n' + | ||
' [--id PROJECT ID] JIRA project id\n' + | ||
' [--userId USER] Behave Pro user id\n' + | ||
' [--apiKey KEY] Behave Pro api key\n' + | ||
' [--output DIRECTORY] Output directory - default: \'features\'\n' + | ||
' [--manual] Include scenarios marked as manual\n' + | ||
' [--config CONFIG] JSON config file - relative to current directory\n\n' + | ||
'Further docs at http://docs.behave.pro' | ||
); | ||
return; | ||
console.log( | ||
chalk.cyan("Behave Pro NodeJS client v" + packageJson.version) + | ||
"\n\n" + | ||
"$ behavepro [--id PROJECT ID] [--userId USER] [--apiKey KEY]\n\n" + | ||
" [--host HOST] Behave Pro host - default: 'http://behave.pro'\n" + | ||
" [--id PROJECT ID] JIRA project id\n" + | ||
" [--userId USER] Behave Pro user id\n" + | ||
" [--apiKey KEY] Behave Pro api key\n" + | ||
" [--output DIRECTORY] Output directory - default: 'features'\n" + | ||
" [--manual] Include scenarios marked as manual\n" + | ||
" [--config CONFIG] JSON config file - relative to current directory\n\n" + | ||
"Further docs at http://docs.behave.pro" | ||
); | ||
return; | ||
} | ||
|
||
var settings = { | ||
host: args.host || 'https://behave.pro', | ||
id: args.key || args.project || args.id, | ||
userId: args.user || args.userId, | ||
apiKey: args.api || args.apiKey || args.password, | ||
output: args.output || args.dir || args.directory || 'features', | ||
manual: args.manual || args.m || false, | ||
config: args.config || 'config.json' | ||
host: args.host || "https://behave.pro", | ||
id: args.key || args.project || args.id, | ||
userId: args.user || args.userId, | ||
apiKey: args.api || args.apiKey || args.password, | ||
output: args.output || args.dir || args.directory || "features", | ||
manual: args.manual || args.m || false, | ||
config: args.config || "config.json" | ||
}; | ||
|
||
if (settings.id && settings.userId && settings.apiKey) { | ||
BehavePro.fetchFeatures(settings); | ||
BehavePro.fetchFeatures(settings); | ||
} else { | ||
BehavePro.fetchFeaturesFromConfig(settings); | ||
} | ||
BehavePro.fetchFeaturesFromConfig(settings); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
#!/usr/bin/env node | ||
'use strict' | ||
var BehavePro = require('./lib/behavepro'); | ||
var _ = require('underscore'); | ||
"use strict"; | ||
var BehavePro = require("./lib/behavepro"); | ||
var _ = require("lodash"); | ||
|
||
var defaultSettings = { | ||
host: 'https://behave.pro', | ||
output: 'features', | ||
manual: false, | ||
config: 'config.json' | ||
host: "https://behave.pro", | ||
output: "features", | ||
manual: false, | ||
config: "config.json" | ||
}; | ||
|
||
module.exports = function(settings, callback) { | ||
_.defaults(settings, defaultSettings); | ||
BehavePro.fetchFeatures(settings, function() { | ||
if (callback) callback(); | ||
}); | ||
} | ||
_.defaults(settings, defaultSettings); | ||
BehavePro.fetchFeatures(settings, function() { | ||
if (callback) callback(); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.