Commit 8b34cc43 authored by mercury233's avatar mercury233

compile without inotify

parent bfd54f21
config.json config.json
#################
## node
#################
/node_modules/
################# #################
## JetBrains ## JetBrains
################# #################
......
{ {
"ip": "", "ip": "127.0.0.1",
"port": 7911, "port": 7911,
"version": 4897, "version": 4917,
"modules": { "modules": {
"welcome": "Mycard Server", "welcome": "Mycard Server",
"tips": "https://my-card.in/tips.json", "tips": "http://mercury233.me/ygosrv233/tips.json",
"dialogues": "https://my-card.in/dialogues.json", "dialogues": "http://mercury233.me/ygosrv233/dialogues.json",
"database": false, "database": false,
"post_start_watching": true, "post_start_watching": true,
"skip_empty_side": true, "skip_empty_side": true,
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
"underscore": "*", "underscore": "*",
"underscore.string": "*", "underscore.string": "*",
"freeport": "*", "freeport": "*",
"inotify": "*",
"request": "*", "request": "*",
"mongoose": "*", "mongoose": "*",
"bunyan": "*", "bunyan": "*",
......
...@@ -12,7 +12,7 @@ _ = require 'underscore' ...@@ -12,7 +12,7 @@ _ = require 'underscore'
_.str = require 'underscore.string' _.str = require 'underscore.string'
_.mixin(_.str.exports()); _.mixin(_.str.exports());
Inotify = require('inotify').Inotify #Inotify = require('inotify').Inotify
WebSocketServer = require('websocket').server WebSocketServer = require('websocket').server
request = require 'request' request = require 'request'
......
// Generated by CoffeeScript 1.9.3 // Generated by CoffeeScript 1.9.3
(function() { (function() {
var Deck, Inotify, Room, User, WebSocketServer, _, bunyan, debug, dialogues, execFile, fs, http, http_server, i, inotify, level_points, log, mycard, net, originIsAllowed, os, path, request, settings, tips, url, victories, waiting, wsServer, ygopro, var Deck, Room, User, WebSocketServer, _, bunyan, debug, dialogues, execFile, fs, http, http_server, i, level_points, log, mycard, net, originIsAllowed, os, path, request, settings, tips, url, victories, waiting, wsServer, ygopro,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
net = require('net'); net = require('net');
...@@ -23,8 +23,6 @@ ...@@ -23,8 +23,6 @@
_.mixin(_.str.exports()); _.mixin(_.str.exports());
Inotify = require('inotify').Inotify;
WebSocketServer = require('websocket').server; WebSocketServer = require('websocket').server;
request = require('request'); request = require('request');
...@@ -928,31 +926,26 @@ ...@@ -928,31 +926,26 @@
}); });
} }
inotify = new Inotify();
inotify.addWatch({ /*
inotify = new Inotify()
inotify.addWatch
path: 'ygocore/replay', path: 'ygocore/replay',
watch_for: Inotify.IN_CLOSE_WRITE | Inotify.IN_CREATE | Inotify.IN_MODIFY, watch_for: Inotify.IN_CLOSE_WRITE | Inotify.IN_CREATE | Inotify.IN_MODIFY,
callback: function(event) { callback: (event)->
var mask, port, room; mask = event.mask
mask = event.mask; if event.name
if (event.name) { port = parseInt path.basename(event.name, '.yrp')
port = parseInt(path.basename(event.name, '.yrp')); room = Room.find_by_port port
room = Room.find_by_port(port); if room
if (room) { if mask & Inotify.IN_CREATE
if (mask & Inotify.IN_CREATE) { else if mask & Inotify.IN_CLOSE_WRITE
fs.unlink path.join('ygocore/replay'), (err)->
} else if (mask & Inotify.IN_CLOSE_WRITE) { else if mask & Inotify.IN_MODIFY
return fs.unlink(path.join('ygocore/replay'), function(err) {}); room.alive = true
} else if (mask & Inotify.IN_MODIFY) { else
return room.alive = true; log.error "event without filename"
} */
}
} else {
return log.error("event without filename");
}
}
});
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment