Permalink
Browse files

Added license, gitignore. Ffixed paths

  • Loading branch information...
Matt Scandalis
Matt Scandalis committed Feb 1, 2013
1 parent 78c6670 commit 50cc3c32f0ae18e379a11163b86f101ba39748f5
Showing with 52 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +24 −0 kyoshi-client.js
  3. +27 −2 kyoshi-node.js
View
@@ -0,0 +1 @@
+package.json
View
@@ -1,3 +1,27 @@
+/*
+ * Copyright (c) 2013 Matthew Scandalis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+//Kyoshi-client.js
+
var kyoshi = function () {
var socket = io.connect(location.protocol+'//'+location.hostname);
var id = 0;
View
@@ -1,9 +1,33 @@
+/*
+ * Copyright (c) 2013 Matthew Scandalis
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ */
+
+//Kyoshi-node.js
+var path = require('path');
var listen = function (app, contentPath) {
var listeners = app.listeners('request').splice(0);
app.removeAllListeners('request');
app.on('request', function (req, res) {
if (req.url == '/kyoshi.js') {
- var stream = require('fs').createReadStream('kyoshi-client.js');
+ var stream = require('fs').createReadStream(path.join(path.dirname(module.filename),'kyoshi-client.js'));
stream.on('data', function (chunk) {
res.write(chunk);
});
@@ -22,7 +46,8 @@ var listen = function (app, contentPath) {
socket.join(filename);
if(filename.match(/^.+\.js$/)) {
try {
- var module = require('./'+require('path').join(contentPath,filename));
+ console.log(path.join(process.cwd(),contentPath,filename));
+ var module = require(path.join(process.cwd(),contentPath,filename));
var exports = Object.getOwnPropertyNames(module);
module.sockets = function () {
return io.sockets.in(filename);

0 comments on commit 50cc3c3

Please sign in to comment.