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

Commit

Permalink
Remove options; we'll control recursiveness through explicitly supp…
Browse files Browse the repository at this point in the history
…lying glob patterns.

Also made `microboot()` and `microboot.up()` synonymous.
  • Loading branch information
Jack Williams committed Jun 17, 2016
1 parent d178ad2 commit a2c85d0
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 39 deletions.
14 changes: 3 additions & 11 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
function Microboot () {
this.opts = {
no_recursive: false
}
var up = require('./lib/up')
up.up = up

return this
}

Microboot.prototype.up = require('./lib/up')
Microboot.prototype.options = require('./lib/options')

module.exports = new Microboot()
module.exports = up
12 changes: 4 additions & 8 deletions lib/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ module.exports = {
lookup: lookup
}

function load (paths, recursive) {
function load (paths) {
var callbacks = []

if (!(paths instanceof Array)) {
throw new Error('Error loading files; invalid "paths" argument', paths)
}

paths.forEach(function (path) {
lookup(path, recursive).forEach(function (item) {
lookup(path).forEach(function (item) {
var func = require(resolve(item))

if (typeof func !== 'function') {
Expand All @@ -38,7 +38,7 @@ function load (paths, recursive) {
return callbacks
}

function lookup (path, recursive) {
function lookup (path) {
debug('- loading "' + path + '"')

var files = []
Expand Down Expand Up @@ -83,11 +83,7 @@ function lookup (path, recursive) {
var stat = statSync(file)

if (stat.isDirectory()) {
if (recursive) {
files = files.concat(lookup(file, recursive))
}

return
files = files.concat(lookup(file, recursive))
}
} catch (e) {
return
Expand Down
5 changes: 0 additions & 5 deletions lib/options.js

This file was deleted.

2 changes: 1 addition & 1 deletion lib/up.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function up (phases, callback) {

debug('Loading phases...')

var funcs = load(phases, !this.opts.no_recursive)
var funcs = load(phases)

debug('Running phases...')

Expand Down
6 changes: 0 additions & 6 deletions test/lib/options.test.js

This file was deleted.

12 changes: 4 additions & 8 deletions test/package.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
var microboot = require('..')

describe('microboot', function () {
it('should export up function', function () {
expect(microboot.up).to.be.a('function')
it('should export a function', function () {
expect(microboot).to.be.a('function')
})

it('should export options function', function () {
expect(microboot.options).to.be.a('function')
})

it('should export opts object', function () {
expect(microboot.opts).to.be.an('object')
it('should export "up" as a circular reference', function () {
expect(microboot.up).to.equal(microboot)
})
})

0 comments on commit a2c85d0

Please sign in to comment.