Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restructure venus temp #350

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
17cd27d
allowed for test directory to be deleted only on initial run
Mar 4, 2015
b8b2bd2
removed console.logs from executor
Mar 4, 2015
ec625ad
allows for both executor and testcase to read from a temp directory o…
Mar 4, 2015
715629d
removed unused startingPort variable
Mar 4, 2015
163b2d5
removed commented out code from getHttpRoot
Mar 4, 2015
887a176
cleaned up static content setup and created venus temp helper
Mar 5, 2015
b045fc4
put back me original pirate locale, ok that wasnt funny, whatever
Mar 5, 2015
3d90883
created port and tempDir constants
Mar 6, 2015
5de33ba
refined logic and put in error handling for new bits of code
Mar 6, 2015
fa63e45
created getTempDir and resolveTempDir utilities in fsHelper
Mar 6, 2015
a1994c8
added new error string to locale file
Mar 6, 2015
5346249
added tests to support changes to executor namely: sendGenericError, …
Mar 6, 2015
53efbe7
created fsHelper for newly created fsHelper utilities
Mar 6, 2015
6f646ff
added fsHelper spec to test_suite
Mar 6, 2015
fba961a
swiched up getHttpRoot to use resolveTempDir and wrote unit test to s…
Mar 6, 2015
6e3a038
moved directory operations over to test helpers to clean up test files
Mar 6, 2015
3aea16e
removed console.log from test helper
Mar 6, 2015
1691a81
adding debug statements and translations
Mar 6, 2015
2045eed
fixed merge conflicts and made sure tests will pass
Mar 7, 2015
2a75328
updated temp dir
Mar 12, 2015
81638da
allowed for test directory to be deleted right before the test shuts …
Mar 12, 2015
ac9305f
Fixing testcase tests
Mar 12, 2015
a8f5660
updated tests based off of recent code changes
Mar 12, 2015
e617655
added clean command so all temporary directories can be removed
Mar 12, 2015
7f040f4
yes, I am THAT guy who broke the build
Mar 12, 2015
ba2f597
added node-uuid to package.json
Mar 13, 2015
b6de195
because I dont know how to program, lets actually pass _.isNull some …
Mar 13, 2015
fa58d88
updated tempDir to point to proper tempDir based off of our discussio…
Mar 13, 2015
6583619
updated executor to use a guid instead of the port so we can guarante…
Mar 13, 2015
60940b9
updated testcase to use guid instead of port to make things unique
Mar 13, 2015
fea2563
updated docs and variable reference to resolveTempDir in fsHelper.js
Mar 13, 2015
771552a
updated executor test to reflect guid being used in place of port
Mar 13, 2015
c239a26
updated testcase test to reflect guid being used in place of port
Mar 13, 2015
072fa0e
added test for using guid within executor
Mar 13, 2015
ea7b25e
make clean a promise and added tests to support the clean command and…
Mar 13, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion Venus.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,11 @@ var _ = require('underscore'),
prompt = require('cli-prompt'),
wrench = require('wrench'),
fs = require('fs'),
fstools = require('fs-tools'),
path = require('path'),
deferred = require('deferred'),
ps = require('./lib/util/ps');
ps = require('./lib/util/ps'),
constants = require('./lib/constants');

/**
* The Venus application object
Expand Down Expand Up @@ -106,6 +108,11 @@ Venus.prototype.init = function (args) {
.option('--singleton', i18n('Ensures all other Venus processes are killed before starting'))
.action(_.bind(this.command(this.run), this));

program
.command('clean')
.description(i18n('Removes all tempoary directories'))
.action(_.bind(this.command(this.clean), this));

program.parse(args);

// No command (e.g., "init", "demo", "run") was provided in command line arguments, so run venus with defaults
Expand Down Expand Up @@ -289,5 +296,26 @@ Venus.prototype.initProjectDirectory = function (program) {

};

/**
* Removes all temporary directories from the proper location and send a
* message to the logger.
*/
Venus.prototype.clean = function () {
var dir = constants.baseTempDir || constants.tempDir,
def = deferred();

fstools.remove(dir, function(err) {
if (_.isNull(err)) {
logger.warn(i18n('Temp directory at %s does not exist so it could not be removed', dir));
def.reject(new Error('No temp directory was found'));
} else {
logger.info(i18n('Temp directory at %s was removed', dir));
def.resolve(dir);
}
});

return def.promise;
};

module.exports = Venus;
Object.seal(module.exports);
7 changes: 7 additions & 0 deletions lib/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@
**/

var os = require('os'),
baseTempDir = '/tmp/venus',
constants;

/**
* Define constants for Venus application
*/
constants = {
baseTempDir: baseTempDir,

tempDir: baseTempDir + '/run-',

port: 2013,

userHome : (process.platform === 'win32') ? process.env['USERPROFILE'] : process.env['HOME'],

/**
Expand Down
Loading