Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Kleeschulte committed Jun 22, 2017
1 parent 28e29ff commit e8efdaf
Show file tree
Hide file tree
Showing 6 changed files with 135 additions and 767 deletions.
1 change: 0 additions & 1 deletion index.js
Expand Up @@ -6,7 +6,6 @@ module.exports.Service = require('./lib/service');
module.exports.errors = require('./lib/errors');

module.exports.services = {};
module.exports.services.Bitcoin = require('./lib/services/bitcoind');
module.exports.services.Web = require('./lib/services/web');

module.exports.scaffold = {};
Expand Down
18 changes: 12 additions & 6 deletions lib/scaffold/start.js
Expand Up @@ -77,8 +77,9 @@ function checkService(service) {
!service.module.prototype.start ||
!service.module.prototype.stop) {
throw new Error(
'Could not load service "' + service.name + '" as it does not support necessary methods and properties.'
);
'Could not load service "' +
service.name +
'" as it does not support necessary methods and properties.');
}
}

Expand All @@ -94,15 +95,18 @@ function lookInRequirePathConfig(req, service) {
var serviceFile = service.config.requirePath.replace(/.js$/, '');
return req(serviceFile);
} catch(e) {
log.info('Checked the service\'s requirePath value, but could not find the service, checking elsewhere.');
log.info('Checked the service\'s requirePath value, ' +
'but could not find the service, checking elsewhere. ' +
'Error caught: ' + e.message);
}
}

function lookInCwd(req, service) {
try {
return req(process.cwd + '/' + service);
} catch(e) {
log.info('Checked the current working directory, but did not find the service.');
log.info('Checked the current working directory, but did not find the service. ' +
'Error caught: ' + e.message);
}
}

Expand All @@ -111,7 +115,8 @@ function lookInBuiltInPath(req, service) {
var serviceFile = path.resolve(__dirname, '../services/' + service.name);
return req(serviceFile);
} catch(e) {
log.info('Checked the built-in path: lib/services, but did not find the service.');
log.info('Checked the built-in path: lib/services, but did not find the service. ' +
'Error caught: ' + e.message);
}
}

Expand All @@ -124,7 +129,8 @@ function lookInModuleManifest(req, service) {
return req(serviceModule);
}
} catch(e) {
log.info('Checked the module\'s package.json for \'bitcoreNode\' field, but found no service.');
log.info('Checked the module\'s package.json for \'bitcoreNode\' field, but found no service. ' +
'Error caught: ' + e.message);
}
}

Expand Down

0 comments on commit e8efdaf

Please sign in to comment.