Spelling & other various fixes.

This commit is contained in:
Julien Fontanet 2013-12-28 12:22:23 +01:00
parent 3dc0066e06
commit 8ae8e99b25
11 changed files with 39 additions and 39 deletions

View File

@ -2,11 +2,11 @@
#===================================================================== #=====================================================================
# It may be necessary to run XO-Server as a priviledged user (e.g. # It may be necessary to run XO-Server as a privileged user (e.g.
# `root`) for instance to allow the HTTP server to listen on a # `root`) for instance to allow the HTTP server to listen on a
# [priviledged ports](http://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html). # [privileged ports](http://www.w3.org/Daemon/User/Installation/PrivilegedPorts.html).
# #
# To avoid security issues, XO-Server can drop its priviledges by # To avoid security issues, XO-Server can drop its privileges by
# changing the user and the group is running with. # changing the user and the group is running with.
# #
# Note: XO-Server will change them just after reading the # Note: XO-Server will change them just after reading the

View File

@ -107,7 +107,7 @@ class $MappedCollection
# The default function uses the index if the generator collection # The default function uses the index if the generator collection
# is an array or the property name if it is an object. # is an array or the property name if it is an object.
# #
# /!\: This entry MUST be overriden in rules for new items. # /!\: This entry MUST be overridden in rules for new items.
if spec.key? if spec.key?
@_key = spec.key @_key = spec.key
throw new Error 'key must be a function' unless $_.isFunction @_key throw new Error 'key must be a function' unless $_.isFunction @_key
@ -124,13 +124,13 @@ class $MappedCollection
# enters, exists or is updated. # enters, exists or is updated.
@_hooks = {} @_hooks = {}
# Initialy the collection is empty. # Initially the collection is empty.
@_byKey = {} @_byKey = {}
# For performance concerns, items are also categorized by rules. # For performance concerns, items are also categorized by rules.
@_byRule = {} @_byRule = {}
# Rules are checked for conformity and created in the sytem. # Rules are checked for conformity and created in the system.
for name, def of spec.rules for name, def of spec.rules
# If it's a function, runs it. # If it's a function, runs it.
def = def() if $_.isFunction def def = def() if $_.isFunction def
@ -187,8 +187,8 @@ class $MappedCollection
# Browse the value searching for dynamic properties/entries. # Browse the value searching for dynamic properties/entries.
# #
# An immediatly invoked function is used to easily handle # An immediately invoked function is used to easily handle
# recursivity. # recursion.
browse = (value, path) => browse = (value, path) =>
# Unless the value is an object, there is nothing to browse. # Unless the value is an object, there is nothing to browse.

View File

@ -226,7 +226,7 @@ Api.fn.session = {
return null; return null;
} }
var user = $waitPromise(this.xo.users.first(user_id)) var user = $waitPromise(this.xo.users.first(user_id));
return _.pick(user.properties, 'id', 'email', 'permission'); return _.pick(user.properties, 'id', 'email', 'permission');
}), }),

View File

@ -35,7 +35,7 @@ Collection.prototype.add = function (models, options) {
var error = model.validate(); var error = model.validate();
if (undefined !== error) if (undefined !== error)
{ {
// @todo Better system inspired by Backbone.js. // TODO: Better system inspired by Backbone.js.
throw error; throw error;
} }
@ -121,7 +121,7 @@ Collection.prototype.remove = function (ids) {
* - Removes missing models. * - Removes missing models.
*/ */
// Collection.prototype.set = function (/*models*/) { // Collection.prototype.set = function (/*models*/) {
// // @todo // // TODO:
// }; // };
/** /**
@ -141,7 +141,7 @@ Collection.prototype.update = function (models) {
if ( !(model instanceof this.model) ) if ( !(model instanceof this.model) )
{ {
// @todo Problems, we may be mixing in some default // TODO: Problems, we may be mixing in some default
// properties which will overwrite existing ones. // properties which will overwrite existing ones.
model = new this.model(model); model = new this.model(model);
} }
@ -157,7 +157,7 @@ Collection.prototype.update = function (models) {
var error = model.validate(); var error = model.validate();
if (undefined !== error) if (undefined !== error)
{ {
// @todo Better system inspired by Backbone.js. // TODO: Better system inspired by Backbone.js.
throw error; throw error;
} }
@ -179,7 +179,7 @@ Collection.prototype.update = function (models) {
//Collection.extend = require('extendable'); //Collection.extend = require('extendable');
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Methods to override in implentations. // Methods to override in implementations.
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/** /**
@ -211,7 +211,7 @@ Collection.prototype._update = function (models) {
}; };
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// Methods which may be overriden in implentations. // Methods which may be overriden in implementations.
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
/** /**

View File

@ -18,7 +18,7 @@ function Memory(models)
require('util').inherits(Memory, require('../collection')); require('util').inherits(Memory, require('../collection'));
Memory.prototype._add = function (models, options) { Memory.prototype._add = function (models, options) {
// @todo Temporary mesure, implement “set()” instead. // TODO: Temporary mesure, implement “set()” instead.
var replace = !!(options && options.replace); var replace = !!(options && options.replace);
for (var i = 0, n = models.length; i < n; ++i) for (var i = 0, n = models.length; i < n; ++i)

View File

@ -21,13 +21,13 @@ function create_redis_client(uri)
// - prefix +':'+ id: hash containing the properties of a model; // - prefix +':'+ id: hash containing the properties of a model;
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// @todo then-redis sends commands in order, we should use this // TODO: then-redis sends commands in order, we should use this
// semantic to simplify the code. // semantic to simplify the code.
// @todo Merge the options in the object to obtain extend-time // TODO: Merge the options in the object to obtain extend-time
// configuration like Backbone. // configuration like Backbone.
// @todo Remote events. // TODO: Remote events.
function Redis(options, models) function Redis(options, models)
{ {
@ -83,7 +83,7 @@ Redis.prototype._extract = function (ids) {
}; };
Redis.prototype._add = function (models, options) { Redis.prototype._add = function (models, options) {
// @todo Temporary mesure, implement “set()” instead. // TODO: Temporary mesure, implement “set()” instead.
var replace = !!(options && options.replace); var replace = !!(options && options.replace);
var redis = this.redis; var redis = this.redis;
@ -113,7 +113,7 @@ Redis.prototype._add = function (models, options) {
throw 'cannot add existing model: '+ model.id; throw 'cannot add existing model: '+ model.id;
} }
// @todo Remove existing fields. // TODO: Remove existing fields.
var params = [prefix +':'+ model.id]; var params = [prefix +':'+ model.id];
_.each(model, function (value, prop) { _.each(model, function (value, prop) {
@ -211,7 +211,7 @@ Redis.prototype._remove = function (ids) {
keys.push(prefix +':'+ ids[i]); keys.push(prefix +':'+ ids[i]);
} }
// @todo Handle indexes. // TODO: Handle indexes.
promises.push( promises.push(
redis.send('srem', [prefix +'_ids'].concat(ids)), redis.send('srem', [prefix +'_ids'].concat(ids)),
redis.send('del', keys) redis.send('del', keys)
@ -221,7 +221,7 @@ Redis.prototype._remove = function (ids) {
}; };
Redis.prototype._update = function (models) { Redis.prototype._update = function (models) {
// @todo // TODO:
return this._add(models, { 'replace': true }); return this._add(models, { 'replace': true });
}; };

View File

@ -31,14 +31,13 @@ $promisify = (fn) ->
deferred.promise deferred.promise
# Makes the fiber waits for a number of miliseconds. # Makes the fiber waits for a number of milliseconds.
$sleep = (ms) -> $sleep = (ms) ->
fiber = $fiber.current fiber = $fiber.current
setTimeout (-> fiber.run()), ms setTimeout (-> fiber.run()), ms
$fiber.yield() $fiber.yield()
# Makes an Node like asynchrouneous function synchrouneous (in a # Makes an Node like asynchronous function synchronous (in a fiber).
# fiber).
$synchronize = (fn, ctx) -> $synchronize = (fn, ctx) ->
fn = ctx[fn] if $_.isString fn fn = ctx[fn] if $_.isString fn

View File

@ -115,7 +115,7 @@ do $fiberize ->
webServer = new $WebServer() webServer = new $WebServer()
webServer.listen options for options in $nconf.get 'http:listen' webServer.listen options for options in $nconf.get 'http:listen'
# Waits for the web server to start listening to drop priviledges. # Waits for the web server to start listening to drop privileges.
$waitEvent webServer, 'listening' $waitEvent webServer, 'listening'
try try
if (group = $nconf.get 'group')? if (group = $nconf.get 'group')?
@ -161,6 +161,6 @@ do $fiberize ->
socket.on 'message', $fiberize (request) -> socket.on 'message', $fiberize (request) ->
response = $handleJsonRpcCall api, session, request response = $handleJsonRpcCall api, session, request
# The socket may have closed beetween the request and the # The socket may have closed between the request and the
# response. # response.
socket.send response if socket.readyState is socket.OPEN socket.send response if socket.readyState is socket.OPEN

View File

@ -93,7 +93,7 @@ Model.prototype.set = function (properties, value) {
* Unsets properties. * Unsets properties.
*/ */
Model.prototype.unset = function (properties) { Model.prototype.unset = function (properties) {
// @todo Events. // TODO: Events.
this.properties = _.omit(this.properties, properties); this.properties = _.omit(this.properties, properties);
}; };

View File

@ -12,7 +12,7 @@ $xmlrpc = require 'xmlrpc'
#===================================================================== #=====================================================================
# Note: All methods are synchroneous (using fibers). # Note: All methods are synchronous (using fibers).
class $XAPI class $XAPI
constructor: ({@host, @username, @password}) -> constructor: ({@host, @username, @password}) ->
@ -34,7 +34,7 @@ class $XAPI
rejectUnauthorized: false rejectUnauthorized: false
} }
# Make `methodCall()` synchroneous. # Make `methodCall()` synchronous.
@xmlrpc.methodCall = $synchronize 'methodCall', @xmlrpc @xmlrpc.methodCall = $synchronize 'methodCall', @xmlrpc
# Logs in. # Logs in.
@ -57,14 +57,14 @@ class $XAPI
# Something went wrong. # Something went wrong.
error = result.ErrorDescription or value error = result.ErrorDescription or value
catch error # Catpture the error if it was thrown. catch error # Captures the error if it was thrown.
# Gets the error code for transport errors and XAPI errors. # Gets the error code for transport errors and XAPI errors.
code = error.code or error[0] code = error.code or error[0]
switch code switch code
# XAPI sommetimes close the connection when the server is no # XAPI sometimes close the connection when the server is no
# longer pool master (`event.next`), so we have to retry at # longer pool master (`event.next`), so we have to retry at
# least once to know who is the new pool master. # least once to know who is the new pool master.
when 'ECONNRESET', \ when 'ECONNRESET', \

View File

@ -9,7 +9,7 @@ $crypto = require 'crypto'
# Low level tools. # Low level tools.
$_ = require 'underscore' $_ = require 'underscore'
# Password hasing. # Password hashing.
$hashy = require 'hashy' $hashy = require 'hashy'
# Redis. # Redis.
@ -161,7 +161,7 @@ class $XO extends $EventEmitter
# XAPI connections. # XAPI connections.
@xapis = {} @xapis = {}
# This function asynchroneously connects to a server, retrieves # This function asynchronously connects to a server, retrieves
# all its objects and monitors events. # all its objects and monitors events.
connect = $fiberize (server) => connect = $fiberize (server) =>
# Identifier of the connection. # Identifier of the connection.
@ -234,7 +234,7 @@ class $XO extends $EventEmitter
remove: false remove: false
} }
# Finaly, monitors events. # Finally, monitors events.
loop loop
xapi.call 'event.register', ['*'] xapi.call 'event.register', ['*']
@ -267,8 +267,9 @@ class $XO extends $EventEmitter
remove: false remove: false
} }
catch error catch error
# The error rethrown unless it is `SESSION_NOT_REGISTERED` # The error is re-thrown unless it is
# in which case the session will be registered again. # `SESSION_NOT_REGISTERED` in which case the session will be
# registered again.
throw error unless error[0] is 'SESSION_NOT_REGISTERED' throw error unless error[0] is 'SESSION_NOT_REGISTERED'
# Connects to existing servers. # Connects to existing servers.
@ -278,7 +279,7 @@ class $XO extends $EventEmitter
@servers.on 'add', (servers) -> @servers.on 'add', (servers) ->
connect server for server in @servers connect server for server in @servers
# TODO: Automaticall disconnects from removed servers. # TODO: Automatically disconnects from removed servers.
#===================================================================== #=====================================================================