Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 5f6a4d61733d68e54164ad8aa5f9fa028d3845cb @suisho committed Jul 22, 2012
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs diff=csharp
+*.sln merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc diff=astextplain
+*.DOC diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot diff=astextplain
+*.DOT diff=astextplain
+*.pdf diff=astextplain
+*.PDF diff=astextplain
+*.rtf diff=astextplain
+*.RTF diff=astextplain
@@ -0,0 +1,169 @@
+#################
+## Eclipse
+#################
+
+*.pydevproject
+.project
+.metadata
+bin/
+tmp/
+*.tmp
+*.bak
+*.swp
+*~.nib
+local.properties
+.classpath
+.settings/
+.loadpath
+
+# External tool builders
+.externalToolBuilders/
+
+# Locally stored "Eclipse launch configurations"
+*.launch
+
+# CDT-specific
+.cproject
+
+# PDT-specific
+.buildpath
+
+
+#################
+## Visual Studio
+#################
+
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.sln.docstates
+
+# Build results
+[Dd]ebug/
+[Rr]elease/
+*_i.c
+*_p.c
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.vspscc
+.builds
+*.dotCover
+
+## TODO: If you have NuGet Package Restore enabled, uncomment this
+#packages/
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opensdf
+*.sdf
+
+# Visual Studio profiler
+*.psess
+*.vsp
+
+# ReSharper is a .NET coding add-in
+_ReSharper*
+
+# Installshield output folder
+[Ee]xpress
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish
+
+# Others
+[Bb]in
+[Oo]bj
+sql
+TestResults
+*.Cache
+ClientBin
+stylecop.*
+~$*
+*.dbmdl
+Generated_Code #added for RIA/Silverlight projects
+
+# Backup & report files from converting an old project file to a newer
+# Visual Studio version. Backup files are not needed, because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+
+
+
+############
+## Windows
+############
+
+# Windows image file caches
+Thumbs.db
+
+# Folder config file
+Desktop.ini
+
+
+#############
+## Python
+#############
+
+*.py[co]
+
+# Packages
+*.egg
+*.egg-info
+dist
+build
+eggs
+parts
+bin
+var
+sdist
+develop-eggs
+.installed.cfg
+
+# Installer logs
+pip-log.txt
+
+# Unit test / coverage reports
+.coverage
+.tox
+
+#Translations
+*.mo
+
+#Mr Developer
+.mr.developer.cfg
+
+# Mac crap
+.DS_Store
+
+node_modules
+occhan
+*.sublime*
+*.komodo*
+config.json
@@ -0,0 +1,57 @@
+var fs = require('fs');
+var express = require('express');
+
+
+var app = module.exports = express.createServer();
+
+var config = require('./config.js');
+config.init();
+config.loadConfig();
+
+// Configuration
+app.configure(function(){
+ app.use(express.static(__dirname + '/public'));
+ app.use(express.logger());
+ app.use(express.bodyParser());
+ app.use(express.methodOverride());
+ app.use(app.router);
+ app.set('view options',{layout: false});
+ app.set('views', __dirname + '/views');
+ app.set('view engine', 'html');
+ app.register('html', require("jqtpl").express);
+ app.register('js', require("jqtpl").express);
+});
+
+app.configure('development', function(){
+ console.log("development mode");
+ app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));
+});
+app.configure('production', function(){
+ app.use(express.errorHandler());
+});
+
+//routing
+var routes = require('./routes');
+var setting = require('./routes/setting');
+app.get('/', routes.index);
+app.get('/browse(.:format)?', routes.browse);
+app.get('/setting/show', setting.show);
+app.post('/setting/save', setting.save);
+
+//listen socket
+var socket = require("./socket.js");
+socket.listen(app);
+
+exports.tailf = require('./tail');
+// tailで変更があったとき
+exports.tailf.callback = function(error, data){
+ socket.tail(data);
+}
+
+exports.tailf.start();
+
+//config再読み込みがあったら行う
+config.eventEmitter.on('load',function(){
+ console.log("reload config");
+ exports.tailf.start();
+});
@@ -0,0 +1,69 @@
+var extend = require('node.extend')
+var fs = require('fs');
+var events = require("events");
+var path = require('path');
+var util = require('util');
+
+module.exports = {
+ config : {},
+ targets : [],
+ revTargetMap : {},
+ filePath : "./config.json",
+ eventEmitter : new events.EventEmitter(),
+ init : function(){
+ },
+
+ defaultConfig : function(){
+ return {
+ port : 5607,
+ target : {}
+ }
+ },
+
+ loadConfig : function(){
+ var json = fs.readFileSync(this.filePath,"utf8");
+ var config = JSON.parse(json);
+
+ var merged = extend(this.defaultConfgi, config);
+ this.config = merged;
+ this.targets = this.config.targets;
+ this.createTargetMap();
+ this.eventEmitter.emit('load');
+ },
+
+ get : function(key){
+ return this.config[key];
+ },
+
+ set : function(key, value){
+ this.config[key] = value
+ },
+
+ save : function(){
+ var json = JSON.stringify(this.config,true,2);
+ fs.writeFileSync(this.filePath,json);
+ },
+
+ createTargetMap : function(){
+ var allTargets = this.allTargets();
+ for(key in allTargets){
+ var fileName = allTargets[key];
+ this.revTargetMap[fileName] = key;
+
+ var resolvedFilePath = path.resolve(fileName);
+ this.revTargetMap[resolvedFilePath] = key;
+ }
+ },
+
+ allTargets : function(){
+ return this.targets;
+ },
+
+ getFilePathByTarget : function(target){
+ return this.targets[target];
+ },
+
+ getTargetByFilePath : function(filePath){
+ return this.revTargetMap[filePath];
+ }
+}
Oops, something went wrong.

0 comments on commit 5f6a4d6

Please sign in to comment.