Skip to content

Commit

Permalink
Get rid of default config
Browse files Browse the repository at this point in the history
  • Loading branch information
MojoJosh authored and samccone committed Aug 18, 2014
1 parent d4ef6d4 commit 188dde3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 28 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
test/
.pioneer.json
12 changes: 12 additions & 0 deletions .pioneer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"feature": "test/integration/features",
"require": [
"test/integration/steps",
"test/integration/widgets"
],
"format": "pioneerformat.js",
"driver": "phantomjs",
"error_formatter": "error_formatter.js",
"preventReload": true,
"coffee": false
}
3 changes: 1 addition & 2 deletions bin/pioneer
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
var path = require('path');
var fs = require('fs');
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
var config = path.join(lib, 'config.json');

var updateNotifier = require('update-notifier');
var notifier = updateNotifier({packagePath: '../package.json'});
Expand All @@ -12,4 +11,4 @@ if (notifier.update) {
notifier.notify();
}

require(lib + '/pioneer')(lib, config);
require(lib + '/pioneer')(lib);
17 changes: 1 addition & 16 deletions docs/config_file.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,7 @@ Configuration File
* [CoffeeScript Step Scaffold](#coffeescript-step-scaffold)

## Default Configuration
If no configuration path is passed in using [--configPath=](docs/command_line.md#configuration-file-path), then pioneer will check to see if the file .pioneer.json exists in the current working directory. If it does not, then the default pioneer configuration is as follows:

```json
{
"feature": "test/integration/features",
"require": [
"test/integration/steps",
"test/integration/widgets"
],
"format": "./node_modules/pioneer/lib/pioneerformat.js",
"preventReload": false,
"driver": "phantomjs",
"error_formatter": "error_formatter.js",
"coffee": false
}
```
If no configuration path is passed in using [--configPath=](docs/command_line.md#configuration-file-path), then pioneer will check to see if the file .pioneer.json exists in the current working directory.

## Driver Configuration

Expand Down
23 changes: 13 additions & 10 deletions src/pioneer.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ fs = require 'fs'
path = require 'path'
minimist = require 'minimist'
configBuilder = require './config_builder'
color = require('colors')
color = require 'colors'

module.exports = (libPath, config) ->
module.exports = (libPath) ->
args = minimist(process.argv.slice(2))
process.argv = []
if(args.configPath && fs.existsSync(args.configPath))
Expand All @@ -15,19 +15,22 @@ module.exports = (libPath, config) ->
if(fs.existsSync(p))
configPath = p
else
configPath = config
configPath = null
console.log ('Configuration loaded from ' + configPath + '\n').yellow.inverse
getSpecifications(configPath, libPath, args)

getSpecifications = (path, libPath, args) ->
obj = {}
fs.readFile(path,
'utf8',
(err, data)->
throw err if(err)
object = JSON.parse(data)
applySpecifications(object, libPath, args)
)
if(path)
fs.readFile(path,
'utf8',
(err, data)->
throw err if(err)
object = JSON.parse(data)
applySpecifications(object, libPath, args)
)
else
applySpecifications(obj, libPath, args)

applySpecifications = (obj, libPath, args) ->
start(configBuilder.generateOptions(args, obj, libPath))
Expand Down

0 comments on commit 188dde3

Please sign in to comment.