Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Improved plugin-loader, replaced bcrypt with bcryptjs,
Browse files Browse the repository at this point in the history
  • Loading branch information
Burnett01 committed Apr 16, 2016
1 parent c38bb95 commit 0b485d5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 20 deletions.
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ Vagrantfile
/src/node_modules
/node_modules
.settings
/examples/test.js
/examples/_dev
/examples/plus
/examples/passwd_sync_obsolete.js
/examples/lime
/test
/tests
t.js
/testus
.gitignore
2 changes: 1 addition & 1 deletion examples/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ api = new API({})
api.auth({
enabled: true,
method: 'basic',
bcrypt: false,
bcrypt: true,
users: {
test: {
password: 'testpw'
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sys-api",
"version": "0.2.0",
"version": "0.2.2",
"bugs": {
"url": "https://github.com/Burnett01/sys-api/issues"
},
Expand All @@ -27,7 +27,7 @@
"url": "https://github.com/Burnett01/sys-api"
},
"dependencies": {
"bcrypt": "*",
"restify": "3.0.2"
"bcryptjs": "*",
"restify": "*"
}
}
4 changes: 3 additions & 1 deletion src/API.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
##################################

restify = require 'restify'
bcrypt = require 'bcrypt';
bcrypt = require 'bcryptjs';

ClassHelper = require './ClassHelper'

Expand All @@ -21,6 +21,7 @@ class API extends ClassHelper
@extend(require(addon))
@include(require(addon))

@extend({ error: restify.errors})

# Plugin-Handler
plugins =
Expand All @@ -30,6 +31,7 @@ class API extends ClassHelper
API.fs.readDir(root, true, (err, files) ->
if err then return console.log(err)
for file, index in files
console.log "[LOADED] plugin-" + file
API.include(require(file))
)

Expand Down
17 changes: 8 additions & 9 deletions src/addons/Fs/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,15 @@ module.exports = {

readDir: (base, dirsonly, cb) ->
ret = []
fs.readdir(base, (err, files) ->
if err then return cb(err, null)
for file, index in files
cur_path = path.join(base, file);
stat = fs.statSync(cur_path)
if(dirsonly && stat.isDirectory())
ret.push(cur_path)
files = fs.readdirSync(base)
if !files then return cb("error retrving", null)
for file, index in files
cur_path = path.join(base, file);
stat = fs.statSync(cur_path)
if(dirsonly && stat.isDirectory())
ret.push(cur_path)

cb(null, ret)
)
cb(null, ret)

}

Expand Down

0 comments on commit 0b485d5

Please sign in to comment.