Skip to content

Hi! I fixed some calls to "sys" for you! #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions lightnode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@


var http = require('http')
var sys = require('sys')
sys.fs = require('fs')
sys.path = require('path')
sys.url = require('url')
sys.events = require('events')
var util = require('util')
util.fs = require('fs')
util.path = require('path')
util.url = require('url')
util.events = require('events')



Expand All @@ -18,10 +18,10 @@ sys.events = require('events')
// in future it may emit events that indicate event reception / delegation,
// so that the delegation logic can be applied through listeners as opposed requiring passage through hardcoded event reception functions,
// until then the delegation system is only relevant to http servers (they have the request event).
var EventEmitter = type(sys.events.EventEmitter, function() {
var EventEmitter = type(util.events.EventEmitter, function() {

this.constructor = function() {
sys.events.EventEmitter.call(this)
util.events.EventEmitter.call(this)
}

// receive an event to emit, potentially delegating as opposed to emitting from this object
Expand All @@ -36,7 +36,7 @@ var EventEmitter = type(sys.events.EventEmitter, function() {

// emit an event to all of the event's listeners on this emitter
// this.emit = function(event /* , ... */) {
// return sys.events.EventEmitter.prototype.emit.apply(this, arguments)
// return util.events.EventEmitter.prototype.emit.apply(this, arguments)
// }

})
Expand Down Expand Up @@ -231,7 +231,7 @@ exports.FileServer = type(exports.HttpServer, function() {
// hierarchy

this.constructChild = function(name) {
return new exports.FileServer(sys.path.join(this.fullName, name), name, this)
return new exports.FileServer(util.path.join(this.fullName, name), name, this)
}

// delegation
Expand Down Expand Up @@ -302,7 +302,7 @@ exports.FileServer = type(exports.HttpServer, function() {
var a = 0, indexFilename
(function statNextFile() {
if (a < self.directoryIndices.length) {
indexFilename = sys.path.join(filename, self.directoryIndices[a++])
indexFilename = util.path.join(filename, self.directoryIndices[a++])
indexFile = getFile(indexFilename)
indexFile.stat(function(error, stat) {
if (error)
Expand Down Expand Up @@ -330,7 +330,7 @@ exports.FileServer = type(exports.HttpServer, function() {

// translate the url to the corresponding file
this.translateUrl = function(req, resp) {
return sys.path.join(this.fullName, sys.url.parse(req.url).pathname)
return util.path.join(this.fullName, util.url.parse(req.url).pathname)
}


Expand All @@ -349,7 +349,7 @@ exports.FileServer = type(exports.HttpServer, function() {
// send headers
var headers = {}
var mimeTypes = self.mimeTypes
var ext = sys.path.extname(file.path);
var ext = util.path.extname(file.path);
if (ext && ext.indexOf('.') === 0) {
ext = ext.slice(1);
}
Expand Down Expand Up @@ -442,7 +442,7 @@ exports.File = function(filename) {
statWaitors.push(F)
statLastCalled = Date.now()
statResult = null
sys.fs.stat(self.path, function() {
util.fs.stat(self.path, function() {
statResult = [arguments[0], arguments[1]]
if (arguments[1] && self.header && (arguments[1].mtime > self.header.mtime)) {
// invalidate the file contents that have been read. TODO what if readfile has been called before this, but has not returned till after this, is it the new contents that stat reflects or old?
Expand All @@ -469,7 +469,7 @@ exports.File = function(filename) {
else {
readFileWaitors.push(F)
hasCalledReadFile = true
sys.fs.readFile(this.path, function() {
util.fs.readFile(this.path, function() {
hasCalledReadFile = true
readFileResult = [arguments[0], arguments[1]]
self.contents = arguments[1]
Expand Down