Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Avatar for KuCalc : devops.
Download
50665 views
1
/*
2
* flatiron.js: An elegant blend of convention and configuration for building apps in Node.js and the browser.
3
*
4
* Copyright(c) 2011 Nodejitsu Inc. <[email protected]>
5
* MIT LICENCE
6
*
7
*/
8
9
var fs = require('fs'),
10
path = require('path'),
11
broadway = require('broadway');
12
13
var flatiron = exports,
14
_app;
15
16
//
17
// Expose version through `pkginfo`
18
//
19
require('pkginfo')(module, 'version');
20
21
//
22
// ### Export core `flatiron` modules
23
//
24
flatiron.common = require('./flatiron/common');
25
flatiron.constants = require('./flatiron/constants');
26
flatiron.formats = broadway.formats;
27
flatiron.App = require('./flatiron/app').App;
28
29
//
30
// ### Expose core `flatiron` plugins
31
// Hoist those up from `broadway` and define each of
32
// the `flatiron` plugins as a lazy loaded `require` statement
33
//
34
flatiron.plugins = broadway.common.mixin(
35
{},
36
broadway.plugins,
37
broadway.common.requireDirLazy(path.join(__dirname, 'flatiron', 'plugins'))
38
);
39
40
//
41
// ### getter @app {flatiron.App}
42
// Gets the default top-level Application for `flatiron`
43
//
44
flatiron.__defineGetter__('app', function () {
45
if (!_app) {
46
_app = new flatiron.App();
47
}
48
49
return _app;
50
});
51
52
//
53
// ### setter @app {flatiron.App}
54
// Sets the default top-level Application for `flatiron`
55
//
56
flatiron.__defineSetter__('app', function (value) {
57
_app = value;
58
});
59
60
//
61
// ### function createApp (options)
62
// #### @options {Object} Options for the application to create
63
// Creates a new instance of `flatiron.App` with the
64
// specified `options`.
65
//
66
flatiron.createApp = function (options) {
67
return new flatiron.App(options);
68
};
69
70
71