Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jitsu

Package Overview
Dependencies
Maintainers
4
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jitsu - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

29

lib/jitsu.js

@@ -320,2 +320,4 @@ /*

jitsu.showError = function (command, err, shallow, skip) {
var stack;
if (err.statusCode !== '403' && !skip) {

@@ -339,4 +341,12 @@ winston.error('Error running command ' + command.magenta);

if (err.result.result.error.stderr) {
winston.warn('Error returned from drone');
winston.error('');
winston.error('There was an error while attempting to start your application.');
winston.error(err.result.result.error.message);
if (err.result.result.error.blame) {
winston.error(err.result.result.error.blame.message);
winston.error('');
winston.error('This type of error is usually a ' + err.result.result.error.blame.type + ' error.');
}
winston.error('Error output from your application:');
winston.error('');
err.result.result.error.stderr.split('\n').forEach(function (line) {

@@ -346,8 +356,15 @@ winston.error(line);

}
if (err.result.result.error.stack && jitsu.config.get('debug')) {
winston.warn('Error returned from Haibu');
winston.error('Message: ' + err.result.result.error.message);
else if (err.result.result.error.stack && jitsu.config.get('debug')) {
winston.error('There was an error while attempting to deploy your application.');
winston.error('');
err.result.result.error.stack.split('\n').forEach(function (line) {
winston.error(err.result.result.error.message);
if (err.result.result.error.blame) {
winston.error(err.result.result.error.blame.message);
winston.error('');
winston.error('This type of error is usually a ' + err.result.result.error.blame.type + ' error.');
}
winston.error('Error output from Haibu:');
winston.error('');
stack = err.result.result.error.result || err.result.result.error.stack;
stack.split('\n').forEach(function (line) {
winston.error(line);

@@ -354,0 +371,0 @@ });

@@ -109,3 +109,13 @@

function runCommand() {
command.apply(resource, parts);
if(command.destructive) {
jitsu.prompt.get(['destroy'], function (err, result) {
if (result.destroy !== 'yes' && result.destroy !== 'y') {
return callback(new Error(action + ' operation cancelled'));
} else {
command.apply(resource, parts);
}
});
} else {
command.apply(resource, parts);
}
}

@@ -112,0 +122,0 @@

@@ -431,2 +431,3 @@ /*

];
apps.destroy.destructive = true

@@ -433,0 +434,0 @@ //

@@ -40,3 +40,3 @@ /*

jitsu.config.set(key, value)
jitsu.config.setFromString(key, value)
jitsu.config.save(callback);

@@ -174,2 +174,2 @@ };

'jitsu config list'
];
];

@@ -179,2 +179,3 @@ /*

]
databases.destroy.destructive = true

@@ -181,0 +182,0 @@ var printDatabase = function (database) {

@@ -42,2 +42,3 @@ /*

function executeList() {
winston.info('Listing snapshots for ' + name.magenta);
jitsu.snapshots.list(name, function (err, snapshots) {

@@ -200,2 +201,3 @@ if (err) {

'jitsu snapshots destroy <app-name>'
];
];
snapshots.destroy.destructive = true

@@ -42,2 +42,28 @@ /*

//
// ### function setFromString (key, value)
// #### @key {string} Key to set in this instance
// #### @value {string} Value for the specified key. The string will be parsed if the default value for they key is not an string. Custom keys will be assumed to be strings literals.
// Sets the `value` for the specified configuration `key`.
//
config.setFromString = function(key, value) {
// Check if the expected value needs to be parsed based on the default type for the given key.
var keyType = typeof(defaults[key]);
if(keyType !== 'undefined' && keyType !== 'string') {
// It's not an string, we need to parse the value.
var newArgs = Array.prototype.slice.call(arguments);
try {
value = JSON.parse(value); // Set the 'value' argument with the parsed version.
} catch(e) {
// Something went wrong
throw ['Config key ', key, ' is expecting value to be of type ', keyType].join('');
}
this.set.call(this, key, value);
} else {
// It's a custom key, let's just set the value.
this.set.call(this, key, value);
}
}
//
// Make sure the file exists if it was set explicitly

@@ -44,0 +70,0 @@ //

@@ -363,5 +363,16 @@ /*

winston.silly('Filename: ' + filename);
jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
winston.info('Done creating snapshot ' + version.magenta);
return err ? callback(err) : callback(null, version, pkg);
fs.stat(filename, function(err, stat) {
if (err) return callback(err);
// XXX Is 50mb enough? Please warning message
if (stat.size > 50 * 1024 * 1024) {
winston.warn('You\'re trying to upload snapshot larger than ' + '50M'.magenta + '.');
winston.warn('This is not recommended practice.');
}
jitsu.snapshots.create(pkg.name, version, filename, function (err, snapshots) {
winston.info('Done creating snapshot ' + version.magenta);
return err ? callback(err) : callback(null, version, pkg);
});
});

@@ -368,0 +379,0 @@ });

@@ -75,2 +75,7 @@ /*

},
destroy: {
name: 'destroy',
message: 'This operation cannot be undone, Would you like to proceed?',
default: 'yes'
},
yesno: {

@@ -77,0 +82,0 @@ name: 'are you sure?',

@@ -11,3 +11,3 @@ {

],
"version": "0.7.3",
"version": "0.7.4",
"author": "Nodejitsu Inc. <support@nodejitsu.com>",

@@ -14,0 +14,0 @@ "repository": {

@@ -83,2 +83,3 @@ /*

'databases destroy test3': runJitsuCommand(
mockPrompt2({answer: 'yes'}),
mockRequest.mock(helper.mockOptions, helper.mockDefaults)

@@ -85,0 +86,0 @@ .del('/databases/mickey/test3')

@@ -15,2 +15,3 @@ /*

var mockPrompt = helper.mockPrompt,
mockPrompt2 = helper.mockPrompt2,
runJitsuCommand = helper.runJitsuCommand;

@@ -69,5 +70,6 @@

}).addBatch({
'snapshots destroy application3': runJitsuCommand(
mockPrompt({'snapshot': '0.0.0-1'}),
mockRequest.mock(helper.mockOptions, helper.mockDefaults)
'snapshots destroy application3': runJitsuCommand([
mockPrompt2({answer: 'yes'}),
mockPrompt({'snapshot': '0.0.0-1'})
], mockRequest.mock(helper.mockOptions, helper.mockDefaults)
.get('/apps/mickey/application3/snapshots')

@@ -85,2 +87,2 @@ .respond({

)
}).export(module);
}).export(module);

@@ -111,3 +111,3 @@

mockRequest,
userPrompt;
userPrompts;

@@ -127,7 +127,12 @@ args.forEach(function (a) {

}
else if(a instanceof Array) {
userPrompts = a;
}
else {
userPrompt = a;
userPrompts = [a];
}
});
if(!userPrompts) {
userPrompts = [mockPrompt([])];
}
if (!mockRequest) {

@@ -158,4 +163,24 @@ console.log('Mock request is required for `runJitsuCommand`');

//
jitsu.prompt = userPrompt || mockPrompt([]);
var currentPrompt = null;
function nextPrompt() {
currentPrompt = userPrompts.shift();
if(!currentPrompt) {
jitsu.prompt = null;
} else {
var promptGet = currentPrompt.get;
// Replace the prompt.get method with our own implementation
// this way we know when the prompt was used so we set jitsu.prompt with the next prompt.
currentPrompt.get = function(opts, cb) {
// Call the original prompt.get implementation with our callback.
promptGet.call(this, opts, function(err, result) {
// now that this prompt was invoked, move to the next one(if any).
nextPrompt();
// then we finally let the command/test continue with the original flow.
cb(err, result);
});
};
jitsu.prompt = currentPrompt;
}
}
nextPrompt(); // Initialize jitsu.prompt
function mockClients () {

@@ -162,0 +187,0 @@ ['users', 'apps', 'snapshots', 'databases'].forEach(function (client) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc