Skip to content

Commit f59dd25

Browse files
committed
Merge pull request #56 from VisualTesting/feature/start
API should be started via the bin file from a package that has a visualt...
2 parents 65d0910 + c46b988 commit f59dd25

File tree

4 files changed

+30
-13
lines changed

4 files changed

+30
-13
lines changed

Gruntfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ module.exports = function(grunt) {
1515
express: {
1616
files: [
1717
'server.js',
18-
'server/**/*.{js,json}',
19-
'visualtesting.conf.js'
18+
'server/**/*.{js,json}'
2019
],
2120
tasks: ['express:dev'],
2221
options: {

bin/start.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env node
2+
'use strict';
3+
4+
var Bluebird = require('bluebird');
5+
var path = require('path');
6+
var findup = Bluebird.promisify(require('findup'));
7+
var App = require('../server/app');
8+
var Configuration = require('../server/configuration');
9+
10+
var configFile = 'visualtesting.conf.js';
11+
var configFilePath;
12+
13+
findup(process.cwd(), configFile)
14+
.then(function(dir) {
15+
configFilePath = path.join(dir, configFile);
16+
})
17+
.then(function() {
18+
var app = new App();
19+
20+
var config = new Configuration();
21+
require(configFilePath)(config);
22+
23+
app.useConfiguration(config);
24+
app.start();
25+
});

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"compression": "~1.4.1",
1010
"errorhandler": "~1.3.4",
1111
"express": "~4.12.2",
12+
"findup": "^0.1.5",
1213
"fs-extra": "^0.16.5",
1314
"github": "^0.2.3",
1415
"grunt-cli": "^0.1.13",
@@ -49,5 +50,8 @@
4950
"start": "grunt serve",
5051
"test": "grunt style && mocha --color",
5152
"travis": "grunt style && istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage"
53+
},
54+
"bin" : {
55+
"visualtesting-api" : "./bin/start.js"
5256
}
5357
}

server.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)