Skip to content
This repository has been archived by the owner on Mar 3, 2020. It is now read-only.

Commit

Permalink
refactor(debug): add debug statements
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jun 13, 2017
1 parent 36ab026 commit 2924c58
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 10 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
}
},
"dependencies": {
"debug": "^2.6.8",
"pify": "^3.0.0"
}
}
8 changes: 7 additions & 1 deletion src/Ignitor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* file that was distributed with this source code.
*/

const debug = require('debug')('adonis:ignitor')
const path = require('path')
const Helpers = require('../Helpers')
const hooks = require('../Hooks')
Expand Down Expand Up @@ -123,6 +124,7 @@ class Ignitor {
*/
_setPackageFile () {
this._packageFile = require(path.join(this._appRoot, 'package.json'))
debug('loading package.json from %s directory', this._appRoot)
}

/**
Expand All @@ -138,6 +140,7 @@ class Ignitor {
const autoload = this._packageFile.autoload || {}
let [ namespace ] = Object.keys(autoload)
this.appNamespace = namespace || 'App'
const autoloadDirectory = autoload[this.appNamespace] || './app'

/**
* Set app namespace with resolver. So that resolver
Expand All @@ -148,14 +151,15 @@ class Ignitor {
/**
* Setting up the autoloaded directory
*/
this._fold.ioc.autoload(autoload[this.appNamespace] || './app', this.appNamespace)
this._fold.ioc.autoload(autoloadDirectory, this.appNamespace)

/**
* Bind directories to resolver, so that we can
* resolve ioc container paths by passing
* incremental namespaces.
*/
this._fold.resolver.directories(DIRECTORIES)
debug('autoloading %s under %s namespace', autoloadDirectory, this.appNamespace)
}

/**
Expand Down Expand Up @@ -308,6 +312,8 @@ class Ignitor {
*/
_loadPreLoadFiles () {
this._callHooks('before', 'preloading')
debug('preloading files %j', this._preLoadFiles)
debug('optional set %j', this._optionals)

this._preLoadFiles.forEach((file) => {
try {
Expand Down

0 comments on commit 2924c58

Please sign in to comment.