-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
68 lines (39 loc) · 1.4 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
var minimist = require( 'minimist' );
var core = require( './modules/core/core.js' )();
function startDefault ( conf ){
core.setConfig( require( './modules/config/config.js' ), conf );
console.log( core.config );
core.setDb( require( './modules/db/db.js' ) ).then( function() {
console.log( 'db connected' );
console.log( core.db );
// core.db.update( 'pages', {'title != ':'admin','url = ':'asdf'},{title:'tex',data:'Look at me!',options:JSON.stringify({hi:(new Date()).getTime()})}).then(() => console.log(arguments), console.log)
return core.setTheme( require( './modules/theme/theme.js' ) );
}, function( e ) {
console.log( 'Error connecting to database' );
console.log( e );
} ).then( function() {
console.log( 'Theme set' );
return core.setPlugins();
}, function( err ) {
console.log( 'Theme set failed', err );
} ).then( function() {
console.log( 'Plugin set' );
return core.setRouter( require( './modules/router/router.js' ) );
}, function( err ) {
console.log( 'Plugin set failed', err );
} ).then( function() {
console.log( 'Router Initialized!' );
}, function( err ) {
console.log( 'Router failed', err );
} );
}
function parseArguments() {
var argv = minimist(process.argv.slice(2));
console.log( argv );
return argv;
}
if (require.main === module) {
startDefault( parseArguments() );
} else {
module.exports = startDefault;
}