cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmue...@apache.org
Subject [13/14] pre-compile CoffeeScript files in server
Date Sat, 30 Aug 2014 18:42:46 GMT
http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/HttpChannelHandler.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/HttpChannelHandler.coffee b/weinre.server/lib/HttpChannelHandler.coffee
deleted file mode 100644
index dd7f2f4..0000000
--- a/weinre.server/lib/HttpChannelHandler.coffee
+++ /dev/null
@@ -1,154 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-_ = require 'underscore'
-
-utils          = require './utils'
-Channel        = require './Channel'
-channelManager = require './channelManager'
-
-#-------------------------------------------------------------------------------
-module.exports = utils.registerClass class HttpChannelHandler
-
-    #---------------------------------------------------------------------------
-    constructor: (@pathPrefix) ->
-    
-        if @pathPrefix == '/ws/client'
-            @isClient = true
-            
-        else if @pathPrefix == '/ws/target'
-            @isClient = false
-            
-        else
-            utils.pitch "invalid pathPrefix: #{@pathPrefix}"
-            
-        @isTarget = !@isClient
-        
-    #---------------------------------------------------------------------------
-    handle: (request, response, uri) ->
-    
-        setCORSHeaders  request, response
-        setCacheHeaders request, response
-
-        #-----------------
-        
-        # * #{pathPrefix}a
-        if uri[0] != '/'
-            return handleError(request, response, 404)
-            
-        #-----------------
-        
-        if uri == '/'
-        
-            # OPTIONS #{pathPrefix}/
-            if request.method == 'OPTIONS'
-                return handleOptions(request, response)
-
-            # POST #{pathPrefix}/
-            if request.method == 'POST'
-                return handleCreate(@pathPrefix, @isClient, request, response)
-                
-            # * #{pathPrefix}/
-            return handleError(request, response, 405)
-            
-        #-----------------
-            
-        parts = uri.split('/')
-        
-        # * #{pathPrefix}/x/y
-        if parts.length > 2
-            return handleError(request, response, 404)
-
-        #-----------------
-        
-        channelName = parts[1]
-        
-        # OPTIONS #{pathPrefix}/x
-        if request.method == 'OPTIONS'
-            return handleOptions(request, response)
-
-        # GET #{pathPrefix}/x
-        if request.method == 'GET'
-            return handleGet(request, response, channelName)
-        
-        # POST #{pathPrefix}/x
-        if request.method == 'POST'
-            return handlePost(request, response, channelName)
-        
-        # anything else
-        return handleError(request, response, 405)
-
-#-------------------------------------------------------------------------------
-handleCreate = (pathPrefix, isClient, request, response) ->
-    id = request.body?.id
-    
-    remoteAddress = request.connection?.remoteAddress || ""
-    
-    channel = new Channel(pathPrefix, id, remoteAddress, isClient)
-    
-    response.contentType 'application/json'
-    response.send JSON.stringify
-        channel: channel.name
-        id:      channel.id
-
-#-------------------------------------------------------------------------------
-handleGet = (request, response, channelName) ->
-    remoteAddress = request.connection?.remoteAddress || ""
-    channel       = channelManager.getChannel(channelName, remoteAddress)
-    return handleError(request, response, 404) if !channel
-    
-    channel.getMessages (messages) => 
-        return handleError(request, response, 404) if channel.isClosed
-        return handleError(request, response, 404) if !messages
-        
-        response.contentType 'application/json'
-        response.send JSON.stringify(messages)
-
-#-------------------------------------------------------------------------------
-handlePost = (request, response, channelName) ->
-    remoteAddress = request.connection?.remoteAddress || ""
-    channel       = channelManager.getChannel(channelName, remoteAddress)
-    return handleError(request, response, 404) if !channel
-    
-    channel.handleMessages(request.body)
-    response.send('')
-
-#-------------------------------------------------------------------------------
-handleOptions = (request, response) ->
-    response.send('')
-
-#-------------------------------------------------------------------------------
-handleError = (request, response, status) ->
-    response.send(status)
-
-#-------------------------------------------------------------------------------
-setCORSHeaders = (request, response) ->
-    origin = request.header 'Origin'
-    return if !origin
-    
-    response.header 'Access-Control-Allow-Origin',  origin
-    response.header 'Access-Control-Max-Age',       '600'
-    response.header 'Access-Control-Allow-Methods', 'GET, POST'
-
-#-------------------------------------------------------------------------------
-setCacheHeaders = (request, response) ->
-    response.header 'Pragma',        'no-cache'
-    response.header 'Expires',       '0'
-    response.header 'Cache-Control', 'no-cache'
-    response.header 'Cache-Control', 'no-store'

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/HttpChannelHandler.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/HttpChannelHandler.js b/weinre.server/lib/HttpChannelHandler.js
new file mode 100644
index 0000000..223872d
--- /dev/null
+++ b/weinre.server/lib/HttpChannelHandler.js
@@ -0,0 +1,130 @@
+// Generated by CoffeeScript 1.8.0
+var Channel, HttpChannelHandler, channelManager, handleCreate, handleError, handleGet, handleOptions, handlePost, setCORSHeaders, setCacheHeaders, utils, _;
+
+_ = require('underscore');
+
+utils = require('./utils');
+
+Channel = require('./Channel');
+
+channelManager = require('./channelManager');
+
+module.exports = utils.registerClass(HttpChannelHandler = (function() {
+  function HttpChannelHandler(pathPrefix) {
+    this.pathPrefix = pathPrefix;
+    if (this.pathPrefix === '/ws/client') {
+      this.isClient = true;
+    } else if (this.pathPrefix === '/ws/target') {
+      this.isClient = false;
+    } else {
+      utils.pitch("invalid pathPrefix: " + this.pathPrefix);
+    }
+    this.isTarget = !this.isClient;
+  }
+
+  HttpChannelHandler.prototype.handle = function(request, response, uri) {
+    var channelName, parts;
+    setCORSHeaders(request, response);
+    setCacheHeaders(request, response);
+    if (uri[0] !== '/') {
+      return handleError(request, response, 404);
+    }
+    if (uri === '/') {
+      if (request.method === 'OPTIONS') {
+        return handleOptions(request, response);
+      }
+      if (request.method === 'POST') {
+        return handleCreate(this.pathPrefix, this.isClient, request, response);
+      }
+      return handleError(request, response, 405);
+    }
+    parts = uri.split('/');
+    if (parts.length > 2) {
+      return handleError(request, response, 404);
+    }
+    channelName = parts[1];
+    if (request.method === 'OPTIONS') {
+      return handleOptions(request, response);
+    }
+    if (request.method === 'GET') {
+      return handleGet(request, response, channelName);
+    }
+    if (request.method === 'POST') {
+      return handlePost(request, response, channelName);
+    }
+    return handleError(request, response, 405);
+  };
+
+  return HttpChannelHandler;
+
+})());
+
+handleCreate = function(pathPrefix, isClient, request, response) {
+  var channel, id, remoteAddress, _ref, _ref1;
+  id = (_ref = request.body) != null ? _ref.id : void 0;
+  remoteAddress = ((_ref1 = request.connection) != null ? _ref1.remoteAddress : void 0) || "";
+  channel = new Channel(pathPrefix, id, remoteAddress, isClient);
+  response.contentType('application/json');
+  return response.send(JSON.stringify({
+    channel: channel.name,
+    id: channel.id
+  }));
+};
+
+handleGet = function(request, response, channelName) {
+  var channel, remoteAddress, _ref;
+  remoteAddress = ((_ref = request.connection) != null ? _ref.remoteAddress : void 0) || "";
+  channel = channelManager.getChannel(channelName, remoteAddress);
+  if (!channel) {
+    return handleError(request, response, 404);
+  }
+  return channel.getMessages((function(_this) {
+    return function(messages) {
+      if (channel.isClosed) {
+        return handleError(request, response, 404);
+      }
+      if (!messages) {
+        return handleError(request, response, 404);
+      }
+      response.contentType('application/json');
+      return response.send(JSON.stringify(messages));
+    };
+  })(this));
+};
+
+handlePost = function(request, response, channelName) {
+  var channel, remoteAddress, _ref;
+  remoteAddress = ((_ref = request.connection) != null ? _ref.remoteAddress : void 0) || "";
+  channel = channelManager.getChannel(channelName, remoteAddress);
+  if (!channel) {
+    return handleError(request, response, 404);
+  }
+  channel.handleMessages(request.body);
+  return response.send('');
+};
+
+handleOptions = function(request, response) {
+  return response.send('');
+};
+
+handleError = function(request, response, status) {
+  return response.send(status);
+};
+
+setCORSHeaders = function(request, response) {
+  var origin;
+  origin = request.header('Origin');
+  if (!origin) {
+    return;
+  }
+  response.header('Access-Control-Allow-Origin', origin);
+  response.header('Access-Control-Max-Age', '600');
+  return response.header('Access-Control-Allow-Methods', 'GET, POST');
+};
+
+setCacheHeaders = function(request, response) {
+  response.header('Pragma', 'no-cache');
+  response.header('Expires', '0');
+  response.header('Cache-Control', 'no-cache');
+  return response.header('Cache-Control', 'no-store');
+};

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/MessageQueue.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/MessageQueue.coffee b/weinre.server/lib/MessageQueue.coffee
deleted file mode 100644
index 52af9ea..0000000
--- a/weinre.server/lib/MessageQueue.coffee
+++ /dev/null
@@ -1,87 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-_ = require 'underscore'
-
-utils = require './utils'
-
-#-------------------------------------------------------------------------------
-module.exports = utils.registerClass class MessageQueue
-
-    #---------------------------------------------------------------------------
-    constructor: () ->
-        @messages     = []
-        @closed       = false
-        @callback     = null
-        @timer        = null
-        
-        _.bindAll @, '_timerExpired', '_updated'
-        
-    #---------------------------------------------------------------------------
-    shutdown: () ->
-        return if @closed
-
-        @closed = true
-
-        clearTimeout @timer if @timer
-        @callback.call(null, @messages) if @callback
-        
-        @callback = null
-        @messages = null 
-        @timer    = null
-    
-    #---------------------------------------------------------------------------
-    push: (message) ->
-        return if @closed
-        
-        @messages.push message
-        process.nextTick @_updated
-
-    #---------------------------------------------------------------------------
-    pullAll: (timeout, callback) ->
-        return callback.call(null, null) if @closed
-        return callback.call(null, [])   if @callback
-        
-        if @messages.length
-            callback.call(null, @messages)
-            @messages = []
-            return
-        
-        @callback = callback
-        @timer    = setTimeout @_timerExpired, timeout
-
-    #---------------------------------------------------------------------------
-    _timerExpired: () ->
-        @_updated()
-        
-    #---------------------------------------------------------------------------
-    _updated: () ->
-        return if @closed
-        return if !@callback
-        
-        callback = @callback
-        messages = @messages
-        clearTimeout @timer if @timer
-        
-        @callback = null
-        @messages = []
-        @timer    = null
-
-        callback.call(null, messages)      
-

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/MessageQueue.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/MessageQueue.js b/weinre.server/lib/MessageQueue.js
new file mode 100644
index 0000000..1afea40
--- /dev/null
+++ b/weinre.server/lib/MessageQueue.js
@@ -0,0 +1,82 @@
+// Generated by CoffeeScript 1.8.0
+var MessageQueue, utils, _;
+
+_ = require('underscore');
+
+utils = require('./utils');
+
+module.exports = utils.registerClass(MessageQueue = (function() {
+  function MessageQueue() {
+    this.messages = [];
+    this.closed = false;
+    this.callback = null;
+    this.timer = null;
+    _.bindAll(this, '_timerExpired', '_updated');
+  }
+
+  MessageQueue.prototype.shutdown = function() {
+    if (this.closed) {
+      return;
+    }
+    this.closed = true;
+    if (this.timer) {
+      clearTimeout(this.timer);
+    }
+    if (this.callback) {
+      this.callback.call(null, this.messages);
+    }
+    this.callback = null;
+    this.messages = null;
+    return this.timer = null;
+  };
+
+  MessageQueue.prototype.push = function(message) {
+    if (this.closed) {
+      return;
+    }
+    this.messages.push(message);
+    return process.nextTick(this._updated);
+  };
+
+  MessageQueue.prototype.pullAll = function(timeout, callback) {
+    if (this.closed) {
+      return callback.call(null, null);
+    }
+    if (this.callback) {
+      return callback.call(null, []);
+    }
+    if (this.messages.length) {
+      callback.call(null, this.messages);
+      this.messages = [];
+      return;
+    }
+    this.callback = callback;
+    return this.timer = setTimeout(this._timerExpired, timeout);
+  };
+
+  MessageQueue.prototype._timerExpired = function() {
+    return this._updated();
+  };
+
+  MessageQueue.prototype._updated = function() {
+    var callback, messages;
+    if (this.closed) {
+      return;
+    }
+    if (!this.callback) {
+      return;
+    }
+    callback = this.callback;
+    messages = this.messages;
+    if (this.timer) {
+      clearTimeout(this.timer);
+    }
+    this.callback = null;
+    this.messages = [];
+    this.timer = null;
+    return callback.call(null, messages);
+  };
+
+  return MessageQueue;
+
+})());

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/channelManager.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/channelManager.coffee b/weinre.server/lib/channelManager.coffee
deleted file mode 100644
index d55bb01..0000000
--- a/weinre.server/lib/channelManager.coffee
+++ /dev/null
@@ -1,126 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-_  = require 'underscore'
-
-utils          = require './utils'
-serviceManager = require './serviceManager'
-
-WeinreClientEvents = null
-WeinreTargetEvents = null
-
-channelManager = null
-
-#-------------------------------------------------------------------------------
-utils.registerClass class ChannelManager
-
-    #---------------------------------------------------------------------------
-    constructor: () ->
-        @channels  = {}
-
-    #---------------------------------------------------------------------------
-    initialize: ->
-
-        WeinreClientEvents = serviceManager.get 'WeinreClientEvents'
-        WeinreTargetEvents = serviceManager.get 'WeinreTargetEvents'
-
-        if !WeinreClientEvents
-            utils.exit 'WeinreClientEvents service not registered'
-
-        if !WeinreTargetEvents
-            utils.exit 'WeinreTargetEvents service not registered'
-
-    #---------------------------------------------------------------------------
-    created: (channel) ->
-        @channels[channel.name] = channel
-
-    #---------------------------------------------------------------------------
-    destroyed: (channel) ->
-        if channel.isClient
-            for connection in channel.connections
-                @disconnectChannels(channel, connection)
-        else
-            for connection in channel.connections
-                @disconnectChannels(connection, channel)
-
-        clients = @getClientChannels(channel.id)
-
-        if channel.isClient
-            WeinreClientEvents.clientUnregistered(clients, channel.name)
-        else
-            WeinreClientEvents.targetUnregistered(clients, channel.name)
-
-        delete @channels[channel.name]
-
-    #---------------------------------------------------------------------------
-    getChannel: (name, remoteAddress) ->
-        return null if !_.has(@channels, name)
-
-        channel = @channels[name]
-
-        return null if !channel
-
-#        if remoteAddress
-#            return null if channel.remoteAddress != remoteAddress
-
-        channel
-
-    #---------------------------------------------------------------------------
-    connectChannels: (client, target) ->
-        return if client.isClosed or target.isClosed
-
-        if client.connections.length
-            @disconnectChannels(client, client.connections[0])
-
-        client.connections.push target
-        target.connections.push client
-
-        clients = @getClientChannels(client.id)
-
-        WeinreClientEvents.connectionCreated(clients, client.name, target.name)
-        WeinreTargetEvents.connectionCreated(target,  client.name, target.name)
-
-    #---------------------------------------------------------------------------
-    disconnectChannels: (client, target) ->
-
-        clients = @getClientChannels(client.id)
-
-        WeinreClientEvents.connectionDestroyed(clients, client.name, target.name)
-        WeinreTargetEvents.connectionDestroyed(target,  client.name, target.name)
-
-        client.connections = _.without(client.connections, target)
-        target.connections = _.without(target.connections, client)
-
-    #---------------------------------------------------------------------------
-    getChannels: (id) ->
-        if id?
-            _.filter(@channels, (item) -> item.id == id)
-        else
-            _.values(@channels)
-
-    #---------------------------------------------------------------------------
-    getClientChannels: (id) ->
-        _.filter(@channels, (item) -> item.isClient && item.id == id)
-
-    #---------------------------------------------------------------------------
-    getTargetChannels: (id) ->
-        _.filter(@channels, (item) -> item.isTarget && item.id == id)
-
-#-------------------------------------------------------------------------------
-module.exports = new ChannelManager

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/channelManager.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/channelManager.js b/weinre.server/lib/channelManager.js
new file mode 100644
index 0000000..fa0700d
--- /dev/null
+++ b/weinre.server/lib/channelManager.js
@@ -0,0 +1,122 @@
+// Generated by CoffeeScript 1.8.0
+var ChannelManager, WeinreClientEvents, WeinreTargetEvents, channelManager, serviceManager, utils, _;
+
+_ = require('underscore');
+
+utils = require('./utils');
+
+serviceManager = require('./serviceManager');
+
+WeinreClientEvents = null;
+
+WeinreTargetEvents = null;
+
+channelManager = null;
+
+utils.registerClass(ChannelManager = (function() {
+  function ChannelManager() {
+    this.channels = {};
+  }
+
+  ChannelManager.prototype.initialize = function() {
+    WeinreClientEvents = serviceManager.get('WeinreClientEvents');
+    WeinreTargetEvents = serviceManager.get('WeinreTargetEvents');
+    if (!WeinreClientEvents) {
+      utils.exit('WeinreClientEvents service not registered');
+    }
+    if (!WeinreTargetEvents) {
+      return utils.exit('WeinreTargetEvents service not registered');
+    }
+  };
+
+  ChannelManager.prototype.created = function(channel) {
+    return this.channels[channel.name] = channel;
+  };
+
+  ChannelManager.prototype.destroyed = function(channel) {
+    var clients, connection, _i, _j, _len, _len1, _ref, _ref1;
+    if (channel.isClient) {
+      _ref = channel.connections;
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        connection = _ref[_i];
+        this.disconnectChannels(channel, connection);
+      }
+    } else {
+      _ref1 = channel.connections;
+      for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
+        connection = _ref1[_j];
+        this.disconnectChannels(connection, channel);
+      }
+    }
+    clients = this.getClientChannels(channel.id);
+    if (channel.isClient) {
+      WeinreClientEvents.clientUnregistered(clients, channel.name);
+    } else {
+      WeinreClientEvents.targetUnregistered(clients, channel.name);
+    }
+    return delete this.channels[channel.name];
+  };
+
+  ChannelManager.prototype.getChannel = function(name, remoteAddress) {
+    var channel;
+    if (!_.has(this.channels, name)) {
+      return null;
+    }
+    channel = this.channels[name];
+    if (!channel) {
+      return null;
+    }
+    return channel;
+  };
+
+  ChannelManager.prototype.connectChannels = function(client, target) {
+    var clients;
+    if (client.isClosed || target.isClosed) {
+      return;
+    }
+    if (client.connections.length) {
+      this.disconnectChannels(client, client.connections[0]);
+    }
+    client.connections.push(target);
+    target.connections.push(client);
+    clients = this.getClientChannels(client.id);
+    WeinreClientEvents.connectionCreated(clients, client.name, target.name);
+    return WeinreTargetEvents.connectionCreated(target, client.name, target.name);
+  };
+
+  ChannelManager.prototype.disconnectChannels = function(client, target) {
+    var clients;
+    clients = this.getClientChannels(client.id);
+    WeinreClientEvents.connectionDestroyed(clients, client.name, target.name);
+    WeinreTargetEvents.connectionDestroyed(target, client.name, target.name);
+    client.connections = _.without(client.connections, target);
+    return target.connections = _.without(target.connections, client);
+  };
+
+  ChannelManager.prototype.getChannels = function(id) {
+    if (id != null) {
+      return _.filter(this.channels, function(item) {
+        return item.id === id;
+      });
+    } else {
+      return _.values(this.channels);
+    }
+  };
+
+  ChannelManager.prototype.getClientChannels = function(id) {
+    return _.filter(this.channels, function(item) {
+      return item.isClient && item.id === id;
+    });
+  };
+
+  ChannelManager.prototype.getTargetChannels = function(id) {
+    return _.filter(this.channels, function(item) {
+      return item.isTarget && item.id === id;
+    });
+  };
+
+  return ChannelManager;
+
+})());
+
+module.exports = new ChannelManager;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/cli.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/cli.coffee b/weinre.server/lib/cli.coffee
deleted file mode 100644
index 197e39c..0000000
--- a/weinre.server/lib/cli.coffee
+++ /dev/null
@@ -1,130 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-fs   = require 'fs'
-path = require 'path'
-
-_     = require 'underscore'
-nopt  = require 'nopt'
-
-utils  = require './utils'
-weinre = require './weinre'
-
-optionDefaults =
-    httpPort:     8080
-    boundHost:    'localhost'
-    verbose:      false
-    debug:        false
-    readTimeout:  5
-
-#-------------------------------------------------------------------------------
-exports.run = ->
-
-    knownOpts =
-        httpPort:     Number
-        boundHost:    String
-        verbose:      Boolean
-        debug:        Boolean
-        readTimeout:  Number
-        deathTimeout: Number
-        help:         Boolean
-
-    shortHands =
-        '?':  ['--help']
-        'h':  ['--help']
-
-    nopt.invalidHandler = printNoptError
-    parsedOpts = nopt(knownOpts, shortHands, process.argv, 2)
-
-    #----
-
-    printHelp() if parsedOpts.help
-
-    args = parsedOpts.argv.remain
-
-    printHelp() if args.length != 0
-
-    #----
-
-    delete parsedOpts.argv
-    opts = _.extend {}, optionDefaults, getDotWeinreServerProperties(), parsedOpts
-
-    if !opts.deathTimeout?
-        opts.deathTimeout = 3 * opts.readTimeout
-
-    utils.setOptions opts
-
-    weinre.run opts
-
-#-------------------------------------------------------------------------------
-printNoptError = (key, val, types) ->
-    utils.exit "error with option '#{key}', value '#{val}'"
-
-#-------------------------------------------------------------------------------
-printHelp = () ->
-    version = weinre.getVersion()
-
-    console.error """
-usage:   #{utils.Program} [options]
-version: #{version}
-
-options:
-    --httpPort     port to run the http server on        default: #{optionDefaults.httpPort}
-    --boundHost    ip address to bind the server to      default: #{optionDefaults.boundHost}
-    --verbose      print more diagnostics                default: #{optionDefaults.verbose}
-    --debug        print even more diagnostics           default: #{optionDefaults.debug}
-    --readTimeout  seconds to wait for a client message  default: #{optionDefaults.readTimeout}
-    --deathTimeout seconds to wait to kill client        default: 3*readTimeout
-
---boundHost can be an ip address, hostname, or -all-, where -all-
-means binding to all ip address on the current machine'
-
-for more info see: http://people.apache.org/~pmuellr/weinre/
-"""
-    process.exit()
-
-#-------------------------------------------------------------------------------
-getDotWeinreServerProperties = () ->
-    properties = {}
-
-    fileName = replaceTilde '~/.weinre/server.properties'
-    return properties if !utils.fileExistsSync(fileName)
-
-    contents = fs.readFileSync(fileName, 'utf8')
-    lines    = contents.split('\n')
-
-    for line in lines
-        line = line.replace(/#.*/,'')
-        match = line.match /\s*(\w+)\s*:\s*(.+)\s*/
-        continue if !match
-
-        key = utils.trim match[1]
-        val = utils.trim match[2]
-
-        properties[key] = val
-
-    properties
-
-#-------------------------------------------------------------------------------
-replaceTilde = (fileName) ->
-    fileName.replace('~', getTildeReplacement())
-
-#-------------------------------------------------------------------------------
-getTildeReplacement = () ->
-    process.env["HOME"] || process.env["USERPROFILE"] || '.'

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/cli.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/cli.js b/weinre.server/lib/cli.js
new file mode 100644
index 0000000..3c4b507
--- /dev/null
+++ b/weinre.server/lib/cli.js
@@ -0,0 +1,97 @@
+// Generated by CoffeeScript 1.8.0
+var fs, getDotWeinreServerProperties, getTildeReplacement, nopt, optionDefaults, path, printHelp, printNoptError, replaceTilde, utils, weinre, _;
+
+fs = require('fs');
+
+path = require('path');
+
+_ = require('underscore');
+
+nopt = require('nopt');
+
+utils = require('./utils');
+
+weinre = require('./weinre');
+
+optionDefaults = {
+  httpPort: 8080,
+  boundHost: 'localhost',
+  verbose: false,
+  debug: false,
+  readTimeout: 5
+};
+
+exports.run = function() {
+  var args, knownOpts, opts, parsedOpts, shortHands;
+  knownOpts = {
+    httpPort: Number,
+    boundHost: String,
+    verbose: Boolean,
+    debug: Boolean,
+    readTimeout: Number,
+    deathTimeout: Number,
+    help: Boolean
+  };
+  shortHands = {
+    '?': ['--help'],
+    'h': ['--help']
+  };
+  nopt.invalidHandler = printNoptError;
+  parsedOpts = nopt(knownOpts, shortHands, process.argv, 2);
+  if (parsedOpts.help) {
+    printHelp();
+  }
+  args = parsedOpts.argv.remain;
+  if (args.length !== 0) {
+    printHelp();
+  }
+  delete parsedOpts.argv;
+  opts = _.extend({}, optionDefaults, getDotWeinreServerProperties(), parsedOpts);
+  if (opts.deathTimeout == null) {
+    opts.deathTimeout = 3 * opts.readTimeout;
+  }
+  utils.setOptions(opts);
+  return weinre.run(opts);
+};
+
+printNoptError = function(key, val, types) {
+  return utils.exit("error with option '" + key + "', value '" + val + "'");
+};
+
+printHelp = function() {
+  var version;
+  version = weinre.getVersion();
+  console.error("usage:   " + utils.Program + " [options]\nversion: " + version + "\n\noptions:\n    --httpPort     port to run the http server on        default: " + optionDefaults.httpPort + "\n    --boundHost    ip address to bind the server to      default: " + optionDefaults.boundHost + "\n    --verbose      print more diagnostics                default: " + optionDefaults.verbose + "\n    --debug        print even more diagnostics           default: " + optionDefaults.debug + "\n    --readTimeout  seconds to wait for a client message  default: " + optionDefaults.readTimeout + "\n    --deathTimeout seconds to wait to kill client        default: 3*readTimeout\n\n--boundHost can be an ip address, hostname, or -all-, where -all-\nmeans binding to all ip address on the current machine'\n\nfor more info see: http://people.apache.org/~pmuellr/weinre/");
+  return process.exit();
+};
+
+getDotWeinreServerProperties = function() {
+  var contents, fileName, key, line, lines, match, properties, val, _i, _len;
+  properties = {};
+  fileName = replaceTilde('~/.weinre/server.properties');
+  if (!utils.fileExistsSync(fileName)) {
+    return properties;
+  }
+  contents = fs.readFileSync(fileName, 'utf8');
+  lines = contents.split('\n');
+  for (_i = 0, _len = lines.length; _i < _len; _i++) {
+    line = lines[_i];
+    line = line.replace(/#.*/, '');
+    match = line.match(/\s*(\w+)\s*:\s*(.+)\s*/);
+    if (!match) {
+      continue;
+    }
+    key = utils.trim(match[1]);
+    val = utils.trim(match[2]);
+    properties[key] = val;
+  }
+  return properties;
+};
+
+replaceTilde = function(fileName) {
+  return fileName.replace('~', getTildeReplacement());
+};
+
+getTildeReplacement = function() {
+  return process.env["HOME"] || process.env["USERPROFILE"] || '.';
+};

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/dumpingHandler.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/dumpingHandler.coffee b/weinre.server/lib/dumpingHandler.coffee
deleted file mode 100644
index 310852d..0000000
--- a/weinre.server/lib/dumpingHandler.coffee
+++ /dev/null
@@ -1,77 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-_ = require 'underscore'
-
-utils = require './utils'
-
-#-------------------------------------------------------------------------------
-dumpingHandler = (request, response, uri) ->
-    originalSend = response.send
-    response.send = (body) ->
-        dumpResponse(originalSend, body, request, response, uri)
-    
-    return if request.method != 'POST'
-    
-    utils.logVerbose '--------------------------------------------------'
-    utils.logVerbose "#{request.method} #{uri} [request]"
-    
-    if _.isArray(request.body)
-        for element in request.body
-            utils.logVerbose "   #{enhance(JSON.parse(element))}"
-    else
-        utils.logVerbose "   #{enhance(request.body)}"
-
-#-------------------------------------------------------------------------------
-dumpResponse = (originalSend, body, request, response, uri) ->
-    originalSend.call(response, body)
-
-    return if request.method not in ['GET', 'POST']
-
-    try 
-        body = JSON.parse(body)
-    catch e
-        return
-
-    return if _.isArray(body) && (body.length == 0)
-        
-    utils.logVerbose '--------------------------------------------------'
-    utils.logVerbose "#{request.method} #{uri} #{response.statusCode} [response]"
-    
-    if _.isArray(body)
-        for element in body
-            utils.logVerbose "   #{enhance(JSON.parse(element))}"
-    else
-        utils.logVerbose "   #{enhance(body)}"
-
-#-------------------------------------------------------------------------------
-enhance = (object) ->
-    if !object.interface || !object.method || !object.args 
-        return JSON.stringify(object)
-        
-    signature = "#{object.interface}.#{object.method}"
-
-    args = JSON.stringify(object.args)
-    if args.length > 500
-        args = "#{args.substr(0,50)}..."
-    
-    return "#{signature}(#{args})"
-
-#-------------------------------------------------------------------------------
-module.exports = dumpingHandler

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/dumpingHandler.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/dumpingHandler.js b/weinre.server/lib/dumpingHandler.js
new file mode 100644
index 0000000..1b8c4ce
--- /dev/null
+++ b/weinre.server/lib/dumpingHandler.js
@@ -0,0 +1,74 @@
+// Generated by CoffeeScript 1.8.0
+var dumpResponse, dumpingHandler, enhance, utils, _;
+
+_ = require('underscore');
+
+utils = require('./utils');
+
+dumpingHandler = function(request, response, uri) {
+  var element, originalSend, _i, _len, _ref, _results;
+  originalSend = response.send;
+  response.send = function(body) {
+    return dumpResponse(originalSend, body, request, response, uri);
+  };
+  if (request.method !== 'POST') {
+    return;
+  }
+  utils.logVerbose('--------------------------------------------------');
+  utils.logVerbose("" + request.method + " " + uri + " [request]");
+  if (_.isArray(request.body)) {
+    _ref = request.body;
+    _results = [];
+    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+      element = _ref[_i];
+      _results.push(utils.logVerbose("   " + (enhance(JSON.parse(element)))));
+    }
+    return _results;
+  } else {
+    return utils.logVerbose("   " + (enhance(request.body)));
+  }
+};
+
+dumpResponse = function(originalSend, body, request, response, uri) {
+  var e, element, _i, _len, _ref, _results;
+  originalSend.call(response, body);
+  if ((_ref = request.method) !== 'GET' && _ref !== 'POST') {
+    return;
+  }
+  try {
+    body = JSON.parse(body);
+  } catch (_error) {
+    e = _error;
+    return;
+  }
+  if (_.isArray(body) && (body.length === 0)) {
+    return;
+  }
+  utils.logVerbose('--------------------------------------------------');
+  utils.logVerbose("" + request.method + " " + uri + " " + response.statusCode + " [response]");
+  if (_.isArray(body)) {
+    _results = [];
+    for (_i = 0, _len = body.length; _i < _len; _i++) {
+      element = body[_i];
+      _results.push(utils.logVerbose("   " + (enhance(JSON.parse(element)))));
+    }
+    return _results;
+  } else {
+    return utils.logVerbose("   " + (enhance(body)));
+  }
+};
+
+enhance = function(object) {
+  var args, signature;
+  if (!object["interface"] || !object.method || !object.args) {
+    return JSON.stringify(object);
+  }
+  signature = "" + object["interface"] + "." + object.method;
+  args = JSON.stringify(object.args);
+  if (args.length > 500) {
+    args = "" + (args.substr(0, 50)) + "...";
+  }
+  return "" + signature + "(" + args + ")";
+};
+
+module.exports = dumpingHandler;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/extensionManager.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/extensionManager.coffee b/weinre.server/lib/extensionManager.coffee
deleted file mode 100644
index c367425..0000000
--- a/weinre.server/lib/extensionManager.coffee
+++ /dev/null
@@ -1,30 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-utils = require './utils'
-
-#-------------------------------------------------------------------------------
-utils.registerClass class ExtensionManager
-
-    #---------------------------------------------------------------------------
-    constructor: () ->
-        @extensions = []
-    
-#-------------------------------------------------------------------------------
-module.exports = new ExtensionManager

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/extensionManager.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/extensionManager.js b/weinre.server/lib/extensionManager.js
new file mode 100644
index 0000000..a3093cd
--- /dev/null
+++ b/weinre.server/lib/extensionManager.js
@@ -0,0 +1,15 @@
+// Generated by CoffeeScript 1.8.0
+var ExtensionManager, utils;
+
+utils = require('./utils');
+
+utils.registerClass(ExtensionManager = (function() {
+  function ExtensionManager() {
+    this.extensions = [];
+  }
+
+  return ExtensionManager;
+
+})());
+
+module.exports = new ExtensionManager;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/jsonBodyParser.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/jsonBodyParser.coffee b/weinre.server/lib/jsonBodyParser.coffee
deleted file mode 100644
index 58f755b..0000000
--- a/weinre.server/lib/jsonBodyParser.coffee
+++ /dev/null
@@ -1,47 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-#-------------------------------------------------------------------------------
-jsonBodyParser = -> 
-    return (request, response, next) -> parseBodyAsJSON(request, response, next)
-        
-#-------------------------------------------------------------------------------
-parseBodyAsJSON = (request, response, next) ->
-
-    return next() if request.body
-    
-    request.body = {}
-    
-    return next() if request.method != 'POST'
-    
-    request.setEncoding 'utf8'
-    
-    buffer = ''
-    request.on 'data', (chunk) -> buffer += chunk
-    request.on 'end', ->
-        return next() if '' == buffer
-
-        try 
-            request.body = JSON.parse(buffer)
-            next()
-        catch e
-            next(e)
-
-#-------------------------------------------------------------------------------
-module.exports = jsonBodyParser

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/jsonBodyParser.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/jsonBodyParser.js b/weinre.server/lib/jsonBodyParser.js
new file mode 100644
index 0000000..419d865
--- /dev/null
+++ b/weinre.server/lib/jsonBodyParser.js
@@ -0,0 +1,39 @@
+// Generated by CoffeeScript 1.8.0
+var jsonBodyParser, parseBodyAsJSON;
+
+jsonBodyParser = function() {
+  return function(request, response, next) {
+    return parseBodyAsJSON(request, response, next);
+  };
+};
+
+parseBodyAsJSON = function(request, response, next) {
+  var buffer;
+  if (request.body) {
+    return next();
+  }
+  request.body = {};
+  if (request.method !== 'POST') {
+    return next();
+  }
+  request.setEncoding('utf8');
+  buffer = '';
+  request.on('data', function(chunk) {
+    return buffer += chunk;
+  });
+  return request.on('end', function() {
+    var e;
+    if ('' === buffer) {
+      return next();
+    }
+    try {
+      request.body = JSON.parse(buffer);
+      return next();
+    } catch (_error) {
+      e = _error;
+      return next(e);
+    }
+  });
+};
+
+module.exports = jsonBodyParser;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/messageHandler.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/messageHandler.coffee b/weinre.server/lib/messageHandler.coffee
deleted file mode 100644
index 0c79430..0000000
--- a/weinre.server/lib/messageHandler.coffee
+++ /dev/null
@@ -1,59 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-utils             = require './utils'
-channelManager    = require './channelManager'
-serviceManager    = require './serviceManager'
-
-#-------------------------------------------------------------------------------
-utils.registerClass class MessageHandler
-
-    #---------------------------------------------------------------------------
-    handleMessage: (channel, message) ->
-        @_serviceMethodInvoker(channel, message.interface, message.method, message.args)
-
-    #---------------------------------------------------------------------------
-    _serviceMethodInvoker: (channel, intfName, method, args) ->
-        methodSignature = "#{intfName}.#{method}()"
-        # utils.logVerbose "MessageHandler._serviceMethodInvoker(#{methodSignature})"
-
-        service = serviceManager.get(intfName)
-        
-        if !service
-            return @_redirectToConnections(channel, intfName, method, args)
-
-        args = args.slice()
-        args.unshift channel
-        
-        try 
-            service[method].apply(service, args)
-            
-        catch e
-            utils.log "error running service method #{methodSignature}: #{e}"
-            utils.log "stack:\n#{e.stack}"
-
-    #---------------------------------------------------------------------------
-    _redirectToConnections: (channel, intfName, method, args) ->
-        # utils.logVerbose "MessageHandler._redirectToConnections(#{channel.name}, #{intfName}, #{method})"
-
-        for connection in channel.connections
-            connection.sendMessage(intfName, method, args...)
-            
-#-------------------------------------------------------------------------------
-module.exports = new MessageHandler

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/messageHandler.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/messageHandler.js b/weinre.server/lib/messageHandler.js
new file mode 100644
index 0000000..7cba7b3
--- /dev/null
+++ b/weinre.server/lib/messageHandler.js
@@ -0,0 +1,51 @@
+// Generated by CoffeeScript 1.8.0
+var MessageHandler, channelManager, serviceManager, utils,
+  __slice = [].slice;
+
+utils = require('./utils');
+
+channelManager = require('./channelManager');
+
+serviceManager = require('./serviceManager');
+
+utils.registerClass(MessageHandler = (function() {
+  function MessageHandler() {}
+
+  MessageHandler.prototype.handleMessage = function(channel, message) {
+    return this._serviceMethodInvoker(channel, message["interface"], message.method, message.args);
+  };
+
+  MessageHandler.prototype._serviceMethodInvoker = function(channel, intfName, method, args) {
+    var e, methodSignature, service;
+    methodSignature = "" + intfName + "." + method + "()";
+    service = serviceManager.get(intfName);
+    if (!service) {
+      return this._redirectToConnections(channel, intfName, method, args);
+    }
+    args = args.slice();
+    args.unshift(channel);
+    try {
+      return service[method].apply(service, args);
+    } catch (_error) {
+      e = _error;
+      utils.log("error running service method " + methodSignature + ": " + e);
+      return utils.log("stack:\n" + e.stack);
+    }
+  };
+
+  MessageHandler.prototype._redirectToConnections = function(channel, intfName, method, args) {
+    var connection, _i, _len, _ref, _results;
+    _ref = channel.connections;
+    _results = [];
+    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+      connection = _ref[_i];
+      _results.push(connection.sendMessage.apply(connection, [intfName, method].concat(__slice.call(args))));
+    }
+    return _results;
+  };
+
+  return MessageHandler;
+
+})());
+
+module.exports = new MessageHandler;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/service/WeinreClientCommands.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/service/WeinreClientCommands.coffee b/weinre.server/lib/service/WeinreClientCommands.coffee
deleted file mode 100644
index 713a48b..0000000
--- a/weinre.server/lib/service/WeinreClientCommands.coffee
+++ /dev/null
@@ -1,126 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-_ = require('underscore')
-
-weinre             = require '../weinre'
-utils              = require '../utils'
-channelManager     = require '../channelManager'
-serviceManager     = require '../serviceManager'
-extensionManager   = require '../extensionManager'
-
-WeinreClientEvents = serviceManager.get 'WeinreClientEvents'
-
-#-------------------------------------------------------------------------------
-module.exports = utils.registerClass class WeinreClientCommands
-
-    #---------------------------------------------------------------------------
-    registerClient: (channel, callbackId) ->
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId, channel.description)        
-
-        options = _.extend {}, utils.options
-        for own key, val of options
-            if typeof val in ['number', 'boolean']
-                options[key] = "#{val}"
-        
-        options.version = weinre.getVersion()
-        
-        WeinreClientEvents.serverProperties(channel, options)
-
-        clients = channelManager.getClientChannels(channel.id)
-        WeinreClientEvents.clientRegistered(clients, channel.description)
-
-    #---------------------------------------------------------------------------
-    getTargets: (channel, callbackId) ->
-        channels = channelManager.getTargetChannels(channel.id)
-        result = _.pluck(channels, 'description')
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId, [result])
-
-    #---------------------------------------------------------------------------
-    getClients: (channel, callbackId) ->
-        channels = channelManager.getClientChannels(channel.id)
-        result = _.pluck(channels, 'description')
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId, [result])
-
-    #---------------------------------------------------------------------------
-    getExtensions: (channel, callbackId) ->
-        result = for extension in extensionManager.extensions
-            { startPage: "extensions/#{extension}/extension.html" }
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId, [result])
-
-    #---------------------------------------------------------------------------
-    connectTarget: (channel, clientName, targetName, callbackId) ->
-        client = channelManager.getChannel(clientName)
-        return if !client
-
-        target = channelManager.getChannel(targetName)
-        return if !target
-
-        channelManager.connectChannels(client, target)
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)
-            
-    #---------------------------------------------------------------------------
-    disconnectTarget: (channel, clientName, callbackId) ->
-        client = connectionManager.getClient(clientName)
-        return if !client
-
-        target = client.getConnectedTarget()
-        return if !target
-
-        connectionManager.disconnect(client, target)
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)
-            
-    #---------------------------------------------------------------------------
-    logDebug: (channel, message, callbackId) ->
-        utils.logVerbose "client #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)
-            
-    #---------------------------------------------------------------------------
-    logInfo: (channel, message, callbackId) ->
-        utils.log "client #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)
-            
-    #---------------------------------------------------------------------------
-    logWarning: (channel, message, callbackId) ->
-        utils.log "client #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)
-            
-    #---------------------------------------------------------------------------
-    logError: (channel, message, callbackId) ->
-        utils.log "client #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreClientEvents.sendCallback(channel, callbackId)

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/service/WeinreClientCommands.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/service/WeinreClientCommands.js b/weinre.server/lib/service/WeinreClientCommands.js
new file mode 100644
index 0000000..675f2a4
--- /dev/null
+++ b/weinre.server/lib/service/WeinreClientCommands.js
@@ -0,0 +1,140 @@
+// Generated by CoffeeScript 1.8.0
+var WeinreClientCommands, WeinreClientEvents, channelManager, extensionManager, serviceManager, utils, weinre, _,
+  __hasProp = {}.hasOwnProperty;
+
+_ = require('underscore');
+
+weinre = require('../weinre');
+
+utils = require('../utils');
+
+channelManager = require('../channelManager');
+
+serviceManager = require('../serviceManager');
+
+extensionManager = require('../extensionManager');
+
+WeinreClientEvents = serviceManager.get('WeinreClientEvents');
+
+module.exports = utils.registerClass(WeinreClientCommands = (function() {
+  function WeinreClientCommands() {}
+
+  WeinreClientCommands.prototype.registerClient = function(channel, callbackId) {
+    var clients, key, options, val, _ref;
+    if (callbackId) {
+      WeinreClientEvents.sendCallback(channel, callbackId, channel.description);
+    }
+    options = _.extend({}, utils.options);
+    for (key in options) {
+      if (!__hasProp.call(options, key)) continue;
+      val = options[key];
+      if ((_ref = typeof val) === 'number' || _ref === 'boolean') {
+        options[key] = "" + val;
+      }
+    }
+    options.version = weinre.getVersion();
+    WeinreClientEvents.serverProperties(channel, options);
+    clients = channelManager.getClientChannels(channel.id);
+    return WeinreClientEvents.clientRegistered(clients, channel.description);
+  };
+
+  WeinreClientCommands.prototype.getTargets = function(channel, callbackId) {
+    var channels, result;
+    channels = channelManager.getTargetChannels(channel.id);
+    result = _.pluck(channels, 'description');
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId, [result]);
+    }
+  };
+
+  WeinreClientCommands.prototype.getClients = function(channel, callbackId) {
+    var channels, result;
+    channels = channelManager.getClientChannels(channel.id);
+    result = _.pluck(channels, 'description');
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId, [result]);
+    }
+  };
+
+  WeinreClientCommands.prototype.getExtensions = function(channel, callbackId) {
+    var extension, result;
+    result = (function() {
+      var _i, _len, _ref, _results;
+      _ref = extensionManager.extensions;
+      _results = [];
+      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+        extension = _ref[_i];
+        _results.push({
+          startPage: "extensions/" + extension + "/extension.html"
+        });
+      }
+      return _results;
+    })();
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId, [result]);
+    }
+  };
+
+  WeinreClientCommands.prototype.connectTarget = function(channel, clientName, targetName, callbackId) {
+    var client, target;
+    client = channelManager.getChannel(clientName);
+    if (!client) {
+      return;
+    }
+    target = channelManager.getChannel(targetName);
+    if (!target) {
+      return;
+    }
+    channelManager.connectChannels(client, target);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  WeinreClientCommands.prototype.disconnectTarget = function(channel, clientName, callbackId) {
+    var client, target;
+    client = connectionManager.getClient(clientName);
+    if (!client) {
+      return;
+    }
+    target = client.getConnectedTarget();
+    if (!target) {
+      return;
+    }
+    connectionManager.disconnect(client, target);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  WeinreClientCommands.prototype.logDebug = function(channel, message, callbackId) {
+    utils.logVerbose("client " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  WeinreClientCommands.prototype.logInfo = function(channel, message, callbackId) {
+    utils.log("client " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  WeinreClientCommands.prototype.logWarning = function(channel, message, callbackId) {
+    utils.log("client " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  WeinreClientCommands.prototype.logError = function(channel, message, callbackId) {
+    utils.log("client " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreClientEvents.sendCallback(channel, callbackId);
+    }
+  };
+
+  return WeinreClientCommands;
+
+})());

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/service/WeinreTargetCommands.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/service/WeinreTargetCommands.coffee b/weinre.server/lib/service/WeinreTargetCommands.coffee
deleted file mode 100644
index 4603e20..0000000
--- a/weinre.server/lib/service/WeinreTargetCommands.coffee
+++ /dev/null
@@ -1,90 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-utils              = require '../utils'
-channelManager     = require '../channelManager'
-serviceManager     = require '../serviceManager'
-
-WeinreClientEvents = serviceManager.get 'WeinreClientEvents'
-WeinreTargetEvents = serviceManager.get 'WeinreTargetEvents'
-
-#-------------------------------------------------------------------------------
-module.exports = utils.registerClass class WeinreTargetCommands
-
-    #---------------------------------------------------------------------------
-    registerTarget: (channel, url, callbackId) -> 
-        channel.description.url = url
-
-        clients = channelManager.getClientChannels(channel.id)
-        WeinreClientEvents.targetRegistered(clients, channel.description)
-    
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, channel.description)
-
-    #---------------------------------------------------------------------------
-    sendClientCallback: (channel, clientCallbackId, args, callbackId) ->
-
-        # the channel to send the callback to is embedded in the callbackId
-        callbackChannel = getCallbackChannel(clientCallbackId)
-        if !callbackChannel
-            return main.warn "#{@constructor.name}.sendClientCallback() sent with invalid callbackId: #{clientCallbackId}"
-
-        callbackChannel = channelManager.getChannel(callbackChannel)
-        if !callbackChannel
-            # indication that channel was closed; this message may generate a lot of noise
-            return main.warn "#{@constructor.name}.sendClientCallback() unable to find channel : #{clientCallbackId}"
-
-        WeinreClientEvents.sendCallback(callbackChannel, clientCallbackId, args)
-            
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, description)
-
-    #---------------------------------------------------------------------------
-    logDebug: (channel, message, callbackId) ->
-        utils.logVerbose "target #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, description)
-
-    #---------------------------------------------------------------------------
-    logInfo: (channel, message, callbackId) ->
-        utils.log "target #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, description)
-
-    #---------------------------------------------------------------------------
-    logWarning: (channel, message, callbackId) ->
-        utils.log "target #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, description)
-
-    #---------------------------------------------------------------------------
-    logError: (channel, message, callbackId) ->
-        utils.log "target #{channel.name}: #{message}"
-
-        if callbackId
-            WeinreTargetEvents.sendCallback(channel, callbackId, description)
-
-#---------------------------------------------------------------------------
-getCallbackChannel = (callbackId) ->
-    callbackId = callbackId.toString()
-    callbackId.split('::')[0]
-

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/service/WeinreTargetCommands.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/service/WeinreTargetCommands.js b/weinre.server/lib/service/WeinreTargetCommands.js
new file mode 100644
index 0000000..eb76651
--- /dev/null
+++ b/weinre.server/lib/service/WeinreTargetCommands.js
@@ -0,0 +1,78 @@
+// Generated by CoffeeScript 1.8.0
+var WeinreClientEvents, WeinreTargetCommands, WeinreTargetEvents, channelManager, getCallbackChannel, serviceManager, utils;
+
+utils = require('../utils');
+
+channelManager = require('../channelManager');
+
+serviceManager = require('../serviceManager');
+
+WeinreClientEvents = serviceManager.get('WeinreClientEvents');
+
+WeinreTargetEvents = serviceManager.get('WeinreTargetEvents');
+
+module.exports = utils.registerClass(WeinreTargetCommands = (function() {
+  function WeinreTargetCommands() {}
+
+  WeinreTargetCommands.prototype.registerTarget = function(channel, url, callbackId) {
+    var clients;
+    channel.description.url = url;
+    clients = channelManager.getClientChannels(channel.id);
+    WeinreClientEvents.targetRegistered(clients, channel.description);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, channel.description);
+    }
+  };
+
+  WeinreTargetCommands.prototype.sendClientCallback = function(channel, clientCallbackId, args, callbackId) {
+    var callbackChannel;
+    callbackChannel = getCallbackChannel(clientCallbackId);
+    if (!callbackChannel) {
+      return main.warn("" + this.constructor.name + ".sendClientCallback() sent with invalid callbackId: " + clientCallbackId);
+    }
+    callbackChannel = channelManager.getChannel(callbackChannel);
+    if (!callbackChannel) {
+      return main.warn("" + this.constructor.name + ".sendClientCallback() unable to find channel : " + clientCallbackId);
+    }
+    WeinreClientEvents.sendCallback(callbackChannel, clientCallbackId, args);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, description);
+    }
+  };
+
+  WeinreTargetCommands.prototype.logDebug = function(channel, message, callbackId) {
+    utils.logVerbose("target " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, description);
+    }
+  };
+
+  WeinreTargetCommands.prototype.logInfo = function(channel, message, callbackId) {
+    utils.log("target " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, description);
+    }
+  };
+
+  WeinreTargetCommands.prototype.logWarning = function(channel, message, callbackId) {
+    utils.log("target " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, description);
+    }
+  };
+
+  WeinreTargetCommands.prototype.logError = function(channel, message, callbackId) {
+    utils.log("target " + channel.name + ": " + message);
+    if (callbackId) {
+      return WeinreTargetEvents.sendCallback(channel, callbackId, description);
+    }
+  };
+
+  return WeinreTargetCommands;
+
+})());
+
+getCallbackChannel = function(callbackId) {
+  callbackId = callbackId.toString();
+  return callbackId.split('::')[0];
+};

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/serviceManager.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/serviceManager.coffee b/weinre.server/lib/serviceManager.coffee
deleted file mode 100644
index ade070f..0000000
--- a/weinre.server/lib/serviceManager.coffee
+++ /dev/null
@@ -1,95 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-path = require 'path'
-fs   = require 'fs'
-
-_ = require 'underscore'
-
-utils = require './utils'
-
-Services = {}
-
-#-------------------------------------------------------------------------------
-utils.registerClass class ServiceManager
-    
-    #---------------------------------------------------------------------------
-    constructor: ->
-        @services = {}
-
-    #---------------------------------------------------------------------------
-    get: (name) ->
-        return @services[name] if _.has(@services, name)
-        
-        null
-
-    #---------------------------------------------------------------------------
-    registerLocalClass: (name) ->
-
-        serviceClass = null
-        try
-            serviceClass = require "./service/#{name}"
-        catch e
-            utils.log "local service class not found: #{name}"
-            throw e
-
-        @services[name] = new serviceClass
-    
-    #---------------------------------------------------------------------------
-    registerProxyClass: (name) ->
-    
-        intf = getServiceInterface(name)
-        
-        if !intf
-            utils.exit "proxy service class not found: #{name}"
-            
-        if intf.name != name
-            utils.exit "proxy interface '#{intf.name}' loaded when '#{name}' requested"
-            
-        service = {}
-        
-        for method in intf.methods
-            service[method.name] = getMethodProxy(name, method.name)    
-            
-        @services[name] = service
-
-
-#-------------------------------------------------------------------------------
-getMethodProxy = (intfName, methodName) ->
-    (channels, args...) ->
-        channels = [channels] if !_.isArray(channels) 
-        
-        for channel in channels
-            channel.sendMessage(intfName, methodName, args...)
-    
-#-------------------------------------------------------------------------------
-getServiceInterface = (name) ->
-    jsonName = "#{name}.json"
-    fileName = path.join utils.options.staticWebDir, 'interfaces', jsonName
-    
-    return null if !utils.fileExistsSync(fileName) 
-    
-    contents = fs.readFileSync(fileName, 'utf8')
-    
-    serviceInterface = JSON.parse(contents)
-    
-    return serviceInterface.interfaces[0]
-
-#-------------------------------------------------------------------------------
-module.exports = new ServiceManager
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/serviceManager.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/serviceManager.js b/weinre.server/lib/serviceManager.js
new file mode 100644
index 0000000..1d93021
--- /dev/null
+++ b/weinre.server/lib/serviceManager.js
@@ -0,0 +1,90 @@
+// Generated by CoffeeScript 1.8.0
+var ServiceManager, Services, fs, getMethodProxy, getServiceInterface, path, utils, _,
+  __slice = [].slice;
+
+path = require('path');
+
+fs = require('fs');
+
+_ = require('underscore');
+
+utils = require('./utils');
+
+Services = {};
+
+utils.registerClass(ServiceManager = (function() {
+  function ServiceManager() {
+    this.services = {};
+  }
+
+  ServiceManager.prototype.get = function(name) {
+    if (_.has(this.services, name)) {
+      return this.services[name];
+    }
+    return null;
+  };
+
+  ServiceManager.prototype.registerLocalClass = function(name) {
+    var e, serviceClass;
+    serviceClass = null;
+    try {
+      serviceClass = require("./service/" + name);
+    } catch (_error) {
+      e = _error;
+      utils.log("local service class not found: " + name);
+      throw e;
+    }
+    return this.services[name] = new serviceClass;
+  };
+
+  ServiceManager.prototype.registerProxyClass = function(name) {
+    var intf, method, service, _i, _len, _ref;
+    intf = getServiceInterface(name);
+    if (!intf) {
+      utils.exit("proxy service class not found: " + name);
+    }
+    if (intf.name !== name) {
+      utils.exit("proxy interface '" + intf.name + "' loaded when '" + name + "' requested");
+    }
+    service = {};
+    _ref = intf.methods;
+    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+      method = _ref[_i];
+      service[method.name] = getMethodProxy(name, method.name);
+    }
+    return this.services[name] = service;
+  };
+
+  return ServiceManager;
+
+})());
+
+getMethodProxy = function(intfName, methodName) {
+  return function() {
+    var args, channel, channels, _i, _len, _results;
+    channels = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
+    if (!_.isArray(channels)) {
+      channels = [channels];
+    }
+    _results = [];
+    for (_i = 0, _len = channels.length; _i < _len; _i++) {
+      channel = channels[_i];
+      _results.push(channel.sendMessage.apply(channel, [intfName, methodName].concat(__slice.call(args))));
+    }
+    return _results;
+  };
+};
+
+getServiceInterface = function(name) {
+  var contents, fileName, jsonName, serviceInterface;
+  jsonName = "" + name + ".json";
+  fileName = path.join(utils.options.staticWebDir, 'interfaces', jsonName);
+  if (!utils.fileExistsSync(fileName)) {
+    return null;
+  }
+  contents = fs.readFileSync(fileName, 'utf8');
+  serviceInterface = JSON.parse(contents);
+  return serviceInterface.interfaces[0];
+};
+
+module.exports = new ServiceManager;

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/utils.coffee
----------------------------------------------------------------------
diff --git a/weinre.server/lib/utils.coffee b/weinre.server/lib/utils.coffee
deleted file mode 100644
index ee5a72b..0000000
--- a/weinre.server/lib/utils.coffee
+++ /dev/null
@@ -1,196 +0,0 @@
-#-------------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-#-------------------------------------------------------------------------------
-
-fs   = require 'fs'
-path = require 'path'
-
-utils = exports
-
-utils.Program = Program = path.basename process.argv[1]
-
-SequenceNumberMax = 100 * 1024 * 1024
-SequenceNumber    = 0
-
-#-------------------------------------------------------------------------------
-utils.getNextSequenceNumber = (g) -> 
-    SequenceNumber++
-    
-    if SequenceNumber > SequenceNumberMax
-        SequenceNumber = 0
-        
-    SequenceNumber
-
-#-------------------------------------------------------------------------------
-utils.trim = (string) -> 
-    string.replace(/(^\s+)|(\s+$)/g,'')
-
-#-------------------------------------------------------------------------------
-utils.log = log = (message) ->
-    date    = new Date()
-    time    = date.toISOString()
-    console.log "#{time} #{Program}: #{message}"
-
-#-------------------------------------------------------------------------------
-utils.logVerbose = (message) ->
-    return if !utils?.options?.verbose
-
-    log message
-
-#-------------------------------------------------------------------------------
-utils.logDebug = (message) ->
-    return if !utils?.options?.debug
-
-    log message
-
-#-------------------------------------------------------------------------------
-utils.exit = (message) ->
-    log message
-    process.exit 1
-
-#-------------------------------------------------------------------------------
-utils.pitch = (message) ->
-    log message
-    throw message
-
-#-------------------------------------------------------------------------------
-utils.setOptions = (options) ->
-    utils.options = options
-    
-#-------------------------------------------------------------------------------
-utils.ensureInteger = (value, message) ->
-    newValue = parseInt value
-    
-    if isNaN newValue
-        utils.exit "#{message}: '#{value}'"
-    
-    newValue    
-    
-#-------------------------------------------------------------------------------
-utils.ensureString = (value, message) ->
-    
-    if typeof value != 'string'
-        utils.exit "#{message}: '#{value}'"
-    
-    value    
-    
-#-------------------------------------------------------------------------------
-utils.ensureBoolean = (value, message) ->
-    uValue = value.toString().toUpperCase()
-
-    newValue = null    
-    switch uValue
-        when 'TRUE'  then newValue = true
-        when 'FALSE' then newValue = false
-    
-    if typeof(newValue) != 'boolean'
-        utils.exit "#{message}: '#{value}'"
-    
-    newValue
-
-#-------------------------------------------------------------------------------
-utils.setNamesForClass = (aClass) ->
-
-    for own key, val of aClass
-        if typeof(val) is "function"
-            val.signature   = "#{aClass.name}::#{key}"
-            val.displayName = val.signature
-            val.name        = val.signature
-
-    for own key, val of aClass.prototype
-        if typeof(val) is "function"
-            val.signature   = "#{aClass.name}.#{key}"
-            val.displayName = val.signature
-            val.name        = val.signature
-
-#-------------------------------------------------------------------------------
-utils.registerClass = (aClass) ->
-    utils.setNamesForClass(aClass)
-    aClass
-
-#-------------------------------------------------------------------------------
-utils.alignLeft = (string, length) ->
-    while string.length < length
-        string = "#{string} "
-        
-    string
-
-#-------------------------------------------------------------------------------
-utils.alignRight = (string, length) ->
-    while string.length < length
-        string = " #{string}"
-
-    string
-
-#-------------------------------------------------------------------------------
-utils.fileExistsSync = (name) ->
-    
-    if fs.existsSync
-        return fs.existsSync name
-        
-    return path.existsSync(name)
-
-#-------------------------------------------------------------------------------
-Error.prepareStackTrace = (error, structuredStackTrace) ->
-    result = []
-    result.push "---------------------------------------------------------"
-    result.push "error: #{error}"
-    result.push "---------------------------------------------------------"
-    result.push "stack: "
-
-    longestFile = 0
-    longestLine = 0
-    
-    for callSite in structuredStackTrace
-        file = callSite.getFileName()
-        line = callSite.getLineNumber()
-
-        file = path.basename(file)
-        line = "#{line}"
-        
-        if file.length > longestFile
-            longestFile = file.length
-    
-        if line.length > longestLine
-            longestLine = line.length
-    
-    for callSite in structuredStackTrace
-        func = callSite.getFunction()
-        file = callSite.getFileName()
-        line = callSite.getLineNumber()
-
-        file = path.basename(file)
-        line = "#{line}"
-        
-        file = utils.alignRight(file, longestFile)
-        line = utils.alignLeft( line, longestLine)
-        
-        funcName = func.displayName ||
-                   func.name || 
-                   callSite.getFunctionName()
-                   callSite.getMethodName()
-                   '???'
-        
-        if funcName == "Module._compile"
-            result.pop()
-            result.pop()
-            break
-            
-        result.push "   #{file}:#{line} - #{funcName}()"
-        
-    result.join "\n"

http://git-wip-us.apache.org/repos/asf/cordova-weinre/blob/9b06777d/weinre.server/lib/utils.js
----------------------------------------------------------------------
diff --git a/weinre.server/lib/utils.js b/weinre.server/lib/utils.js
new file mode 100644
index 0000000..ad5dc89
--- /dev/null
+++ b/weinre.server/lib/utils.js
@@ -0,0 +1,194 @@
+// Generated by CoffeeScript 1.8.0
+var Program, SequenceNumber, SequenceNumberMax, fs, log, path, utils,
+  __hasProp = {}.hasOwnProperty;
+
+fs = require('fs');
+
+path = require('path');
+
+utils = exports;
+
+utils.Program = Program = path.basename(process.argv[1]);
+
+SequenceNumberMax = 100 * 1024 * 1024;
+
+SequenceNumber = 0;
+
+utils.getNextSequenceNumber = function(g) {
+  SequenceNumber++;
+  if (SequenceNumber > SequenceNumberMax) {
+    SequenceNumber = 0;
+  }
+  return SequenceNumber;
+};
+
+utils.trim = function(string) {
+  return string.replace(/(^\s+)|(\s+$)/g, '');
+};
+
+utils.log = log = function(message) {
+  var date, time;
+  date = new Date();
+  time = date.toISOString();
+  return console.log("" + time + " " + Program + ": " + message);
+};
+
+utils.logVerbose = function(message) {
+  var _ref;
+  if (!(utils != null ? (_ref = utils.options) != null ? _ref.verbose : void 0 : void 0)) {
+    return;
+  }
+  return log(message);
+};
+
+utils.logDebug = function(message) {
+  var _ref;
+  if (!(utils != null ? (_ref = utils.options) != null ? _ref.debug : void 0 : void 0)) {
+    return;
+  }
+  return log(message);
+};
+
+utils.exit = function(message) {
+  log(message);
+  return process.exit(1);
+};
+
+utils.pitch = function(message) {
+  log(message);
+  throw message;
+};
+
+utils.setOptions = function(options) {
+  return utils.options = options;
+};
+
+utils.ensureInteger = function(value, message) {
+  var newValue;
+  newValue = parseInt(value);
+  if (isNaN(newValue)) {
+    utils.exit("" + message + ": '" + value + "'");
+  }
+  return newValue;
+};
+
+utils.ensureString = function(value, message) {
+  if (typeof value !== 'string') {
+    utils.exit("" + message + ": '" + value + "'");
+  }
+  return value;
+};
+
+utils.ensureBoolean = function(value, message) {
+  var newValue, uValue;
+  uValue = value.toString().toUpperCase();
+  newValue = null;
+  switch (uValue) {
+    case 'TRUE':
+      newValue = true;
+      break;
+    case 'FALSE':
+      newValue = false;
+  }
+  if (typeof newValue !== 'boolean') {
+    utils.exit("" + message + ": '" + value + "'");
+  }
+  return newValue;
+};
+
+utils.setNamesForClass = function(aClass) {
+  var key, val, _ref, _results;
+  for (key in aClass) {
+    if (!__hasProp.call(aClass, key)) continue;
+    val = aClass[key];
+    if (typeof val === "function") {
+      val.signature = "" + aClass.name + "::" + key;
+      val.displayName = val.signature;
+      val.name = val.signature;
+    }
+  }
+  _ref = aClass.prototype;
+  _results = [];
+  for (key in _ref) {
+    if (!__hasProp.call(_ref, key)) continue;
+    val = _ref[key];
+    if (typeof val === "function") {
+      val.signature = "" + aClass.name + "." + key;
+      val.displayName = val.signature;
+      _results.push(val.name = val.signature);
+    } else {
+      _results.push(void 0);
+    }
+  }
+  return _results;
+};
+
+utils.registerClass = function(aClass) {
+  utils.setNamesForClass(aClass);
+  return aClass;
+};
+
+utils.alignLeft = function(string, length) {
+  while (string.length < length) {
+    string = "" + string + " ";
+  }
+  return string;
+};
+
+utils.alignRight = function(string, length) {
+  while (string.length < length) {
+    string = " " + string;
+  }
+  return string;
+};
+
+utils.fileExistsSync = function(name) {
+  if (fs.existsSync) {
+    return fs.existsSync(name);
+  }
+  return path.existsSync(name);
+};
+
+Error.prepareStackTrace = function(error, structuredStackTrace) {
+  var callSite, file, func, funcName, line, longestFile, longestLine, result, _i, _j, _len, _len1;
+  result = [];
+  result.push("---------------------------------------------------------");
+  result.push("error: " + error);
+  result.push("---------------------------------------------------------");
+  result.push("stack: ");
+  longestFile = 0;
+  longestLine = 0;
+  for (_i = 0, _len = structuredStackTrace.length; _i < _len; _i++) {
+    callSite = structuredStackTrace[_i];
+    file = callSite.getFileName();
+    line = callSite.getLineNumber();
+    file = path.basename(file);
+    line = "" + line;
+    if (file.length > longestFile) {
+      longestFile = file.length;
+    }
+    if (line.length > longestLine) {
+      longestLine = line.length;
+    }
+  }
+  for (_j = 0, _len1 = structuredStackTrace.length; _j < _len1; _j++) {
+    callSite = structuredStackTrace[_j];
+    func = callSite.getFunction();
+    file = callSite.getFileName();
+    line = callSite.getLineNumber();
+    file = path.basename(file);
+    line = "" + line;
+    file = utils.alignRight(file, longestFile);
+    line = utils.alignLeft(line, longestLine);
+    funcName = func.displayName || func.name || callSite.getFunctionName();
+    callSite.getMethodName();
+    '???';
+    if (funcName === "Module._compile") {
+      result.pop();
+      result.pop();
+      break;
+    }
+    result.push("   " + file + ":" + line + " - " + funcName + "()");
+  }
+  return result.join("\n");
+};


Mime
View raw message