@adonisjs/ignitor
Advanced tools
Comparing version 2.0.3 to 2.0.4
@@ -0,1 +1,11 @@ | ||
<a name="2.0.4"></a> | ||
## [2.0.4](https://github.com/adonisjs/adonis-ignitor/compare/v2.0.3...v2.0.4) (2018-02-08) | ||
### Features | ||
* **helpers:** helpers now exposes directories ready only property ([b6e2e3c](https://github.com/adonisjs/adonis-ignitor/commit/b6e2e3c)) | ||
<a name="2.0.3"></a> | ||
@@ -2,0 +12,0 @@ ## [2.0.3](https://github.com/adonisjs/adonis-ignitor/compare/v2.0.2...v2.0.3) (2018-02-07) |
{ | ||
"name": "@adonisjs/ignitor", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"description": "Fire the adonis-app (in good sense)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -30,5 +30,19 @@ 'use strict' | ||
this._appRoot = appRoot | ||
this.directories = {} | ||
} | ||
/** | ||
* Set app directories | ||
* | ||
* @method appDirectories | ||
* | ||
* @param {Object} directories | ||
* | ||
* @return {void} | ||
*/ | ||
appDirectories (directories) { | ||
this.directories = Object.freeze(Object.assign({}, directories)) | ||
} | ||
/** | ||
* Returns path to the application root | ||
@@ -35,0 +49,0 @@ * |
@@ -209,28 +209,2 @@ 'use strict' | ||
/** | ||
* If exception handler inside `app/Exceptions/Handler` exists, then we will | ||
* bind it to the server to handle exceptions, otherwise we rely on base | ||
* exception handler. | ||
* | ||
* @method _setupExceptionsHandler | ||
* | ||
* @param {Server} Server | ||
* | ||
* @return {void} | ||
* | ||
* @private | ||
*/ | ||
_setupExceptionsHandler (Server) { | ||
const handleRelativePath = `${DIRECTORIES['exceptions']}/Handler` | ||
const filePath = path.join(this._appRoot, 'app', handleRelativePath) | ||
if (this._fileExists(filePath)) { | ||
debug('using %s for handling exceptions', `${this.appNamespace}/${handleRelativePath}`) | ||
Server.setExceptionHandler(this._fold.ioc.use(`${this.appNamespace}/${handleRelativePath}`)) | ||
} else { | ||
debug('using %s for handling exceptions', 'Adonis/Exceptions/BaseExceptionHandler') | ||
Server.setExceptionHandler(this._fold.ioc.use('Adonis/Exceptions/BaseExceptionHandler')) | ||
} | ||
} | ||
/** | ||
* Registers the helpers module to the IoC container. | ||
@@ -246,3 +220,8 @@ * Required by a lot of providers before hand. | ||
_registerHelpers () { | ||
this._fold.ioc.singleton('Adonis/Src/Helpers', () => new Helpers(this._appRoot)) | ||
this._fold.ioc.singleton('Adonis/Src/Helpers', () => { | ||
const helpers = new Helpers(this._appRoot) | ||
helpers.appDirectories(DIRECTORIES) | ||
return helpers | ||
}) | ||
this._fold.ioc.alias('Adonis/Src/Helpers', 'Helpers') | ||
@@ -472,7 +451,2 @@ debug('registered helpers') | ||
/** | ||
* Define the exception handler to be used by the HTTP server | ||
*/ | ||
this._setupExceptionsHandler(Server) | ||
/** | ||
* If a custom http instance is defined, set it | ||
@@ -479,0 +453,0 @@ * on the server provider. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38509
1057