diff --git a/package.json b/package.json index b805d91..08c322d 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ }, "scripts": { "prepublish": "npm run compile", - "compile": "coffee -cb lib/*.coffee test/*.coffee tools/*.coffee", + "compile": "coffee -cb lib/*.coffee", "configure": "cp ./config/config-sample.json ./config/config.json", "install": "npm run configure", "test": "node test" diff --git a/tools/update-deviceid.coffee b/tools/update-deviceid.coffee deleted file mode 100644 index 32745ff..0000000 --- a/tools/update-deviceid.coffee +++ /dev/null @@ -1,37 +0,0 @@ -# This script will generate _deviceId struct for all devices in DB. -# To be used in migrating existing data to the recent update which introduced _deviceId object. -config = require '../config' -mongodb = require 'mongodb' - -dbserver = new mongodb.Server(config.MONGODB_SOCKET, 0, {auto_reconnect: true}) -db = new mongodb.Db(config.DATABASE_NAME, dbserver, {native_parser: true, safe: true}) - -query = {} - -projection = { - _id : true, - 'InternetGatewayDevice.DeviceInfo' : true -} - -db.open((err, db) -> - db.collection('devices', (err, collection) -> - cur = collection.find(query) - cur.each((err, doc) -> - if not doc? - db.close() - return - serialNumber = doc['InternetGatewayDevice']['DeviceInfo']['SerialNumber']['_value'] - oui = doc['InternetGatewayDevice']['DeviceInfo']['ManufacturerOUI']['_value'] - manufacturer = doc['InternetGatewayDevice']['DeviceInfo']['Manufacturer']['_value'] - productClass = doc['InternetGatewayDevice']['DeviceInfo']['ProductClass']['_value'] - id = doc['_id'] - collection.update({_id : id}, {$set : { - '_deviceId._Manufacturer' : manufacturer, - '_deviceId._OUI' : oui, - '_deviceId._ProductClass' : productClass, - '_deviceId._SerialNumber' : serialNumber - }}, () -> - ) - ) - ) -)