Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add in-code documentation & refactor
set up version
- Loading branch information
Herman Junge
committed
Mar 4, 2013
1 parent
b0f36d0
commit c620638
Showing
3 changed files
with
118 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,42 @@ | ||
var common = module.exports; | ||
/** | ||
* Common | ||
* | ||
* The Main object of the prey client. | ||
* Contains Values and Objects usable both in | ||
* Configuration as Operation | ||
* | ||
*/ | ||
|
||
var join = require('path').join, | ||
root_path = process.env.ROOT_PATH || join(__dirname, '..'), | ||
version = require(join(root_path, 'package')).version, | ||
program = require('commander'), | ||
system = require(join(root_path, 'lib', 'system')); | ||
// Module Requirements | ||
var join = require('path').join | ||
, root_path = process.env.ROOT_PATH || join(__dirname, '..') | ||
, version = require(join(root_path, 'package')).version | ||
, program = require('commander'); | ||
|
||
var config_file = 'prey.conf', | ||
default_config_file = join(root_path, config_file + '.default'), | ||
config_path = program.path || system.paths.config, | ||
config = require('getset').load(join(config_path, config_file)), | ||
user_agent = "Prey/" + version + " (Node.js, " + system.os_name + ")"; | ||
// System object varies upon the machine is running (i.e. OSX, Linux, Windowsº) | ||
var system = require(join(root_path, 'lib', 'system')); | ||
|
||
common.root_path = root_path; | ||
common.version = version; | ||
common.program = program; | ||
common.os_name = system.os_name; | ||
common.system = system; | ||
common.config = config; | ||
common.config_path = config_path; | ||
common.default_config_file = default_config_file; | ||
common.user_agent = user_agent; | ||
// Other Variables | ||
var config_file = 'prey.conf' | ||
, default_config_file = join(root_path, config_file + '.default') | ||
, config_path = program.path || system.paths.config | ||
, user_agent = "Prey/" + version + " (Node.js, " + system.os_name + ")"; | ||
|
||
// An instance of `getset`, this object has the ability of | ||
// synchronize itself on `sync` function | ||
var config = require('getset').load(join(config_path, config_file)) | ||
|
||
// Common object creation | ||
var common = { | ||
config : config | ||
, config_path : config_path | ||
, default_config_file : default_config_file | ||
, os_name : system.os_name | ||
, program : program | ||
, root_path : root_path | ||
, system : system | ||
, user_agent : user_agent | ||
, version : version | ||
} | ||
|
||
module.exports = common; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.