Initial commit

This commit is contained in:
Spyros Ligouras 2013-06-01 21:34:38 +03:00
commit e1622813aa
4 changed files with 49 additions and 0 deletions

9
app.coffee Normal file
View File

@ -0,0 +1,9 @@
chokidar = require("chokidar")
watcher = chokidar.watch('/media/', {ignored: /^\./, persistent: true})
watcher.on('add', (path, stats) ->
console.log('File', path, 'has been added')
)
# Only needed if watching is persistent.
#watcher.close()

2
bootstrap.js vendored Normal file
View File

@ -0,0 +1,2 @@
var coffee = require("coffee-script");
var app = require("./app");

11
package.json Normal file
View File

@ -0,0 +1,11 @@
{
"name": "bootstrap",
"version": "0.0.1",
"dependencies": {
"coffee-script": "1.6.x",
"chokidar": "0.6.x"
},
"engines": [
"node >= 0.10.x"
]
}

27
util.coffee Normal file
View File

@ -0,0 +1,27 @@
fs = require("fs")
chokidar = require("chokidar")
#request = require("request")
_eol = require('os').EOL
getProcInfo = (callback) ->
lines = fs.readFileSync("/proc/cpuinfo", "utf8").split(_eol)
cpuinfo = []
cpuinfo.push({})
for line in lines
if line == ""
cpuinfo.push({})
else
[key, value] = line.split(/\s+:\s/, 2)
key = key.trim()
value = value?.trim() ? ""
if value.match(/^\d+\.\d+$/)
value = parseFloat(value)
cpuinfo[cpuinfo.length-1][key] = value
callback(cpuinfo)