28
Advanced tools
Comparing version 3.2.1 to 3.4.0
@@ -19,2 +19,3 @@ 'use strict'; | ||
}, | ||
/* | ||
vows: { | ||
@@ -30,2 +31,3 @@ all: { | ||
}, | ||
*/ | ||
jsonlint: { | ||
@@ -37,3 +39,3 @@ all: { | ||
} | ||
}, | ||
}/*, | ||
shell: { | ||
@@ -49,6 +51,6 @@ bats: { | ||
} | ||
} | ||
}*/ | ||
}); | ||
grunt.registerTask('default', ['jsonlint', 'jshint', 'vows', 'shell']); | ||
grunt.registerTask('default', ['jsonlint', 'jshint', /*'vows', 'shell'*/]); | ||
}; |
'use strict'; | ||
var syncLib = require('./sync'); | ||
var Options = syncLib.Options; | ||
@@ -14,14 +15,14 @@ var Client = syncLib.Client; | ||
$28.prototype.sync = function(type, projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
$28.prototype.sync = function(type, projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) { | ||
var client = new Client(this.api, projectEndpoint, projectToken, localProjectPath); | ||
var method = type === 'download' ? client.download : client.upload; | ||
return method.apply(client, [overwrite, deleteOrphaned, simulate, ignore]); | ||
return method.apply(client, [overwrite, deleteOrphaned, simulate, ignore, concurrency]); | ||
}; | ||
$28.prototype.download = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return this.sync('download', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
$28.prototype.download = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) { | ||
return this.sync('download', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency); | ||
}; | ||
$28.prototype.upload = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore) { | ||
return this.sync('upload', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore); | ||
$28.prototype.upload = function(projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency) { | ||
return this.sync('upload', projectEndpoint, projectToken, localProjectPath, overwrite, deleteOrphaned, simulate, ignore, concurrency); | ||
}; | ||
@@ -180,2 +181,13 @@ | ||
$28.prototype.concurrencyCoercion = function(value, cmd){ | ||
var intValue = Math.floor(Number(value)); | ||
if (String(intValue) === value && intValue > 0) { | ||
return intValue; } | ||
else { | ||
console.error('Invalid option value for the concurrency option.'.red); | ||
cmd.help(); | ||
} | ||
}; | ||
return $28; | ||
@@ -182,0 +194,0 @@ })(); |
@@ -52,3 +52,3 @@ 'use strict'; | ||
} | ||
u.pathname += "/metadata/trace"; | ||
u.pathname += '/metadata/trace'; | ||
if(u.search === null) { | ||
@@ -55,0 +55,0 @@ u.search = ''; |
@@ -18,3 +18,8 @@ 'use strict'; | ||
.option('-s, --simulate', 'Simulate for extra safety.') | ||
.option('-d, --delete-orphaned', 'Delete orphaned files.'); | ||
.option('-d, --delete-orphaned', 'Delete orphaned files.') | ||
.option('-c, --concurrency <int>', 'Concurrency level.', | ||
function(value){ | ||
return $28.concurrencyCoercion(value, cmd); | ||
} | ||
); | ||
}; | ||
@@ -34,2 +39,3 @@ | ||
var localProjectPath = process.cwd(); | ||
method.apply($28, [ | ||
@@ -42,3 +48,4 @@ Config.getProjectEndpoint(projectName), projectToken, localProjectPath, | ||
return Config.filterQueries(queries); | ||
}] | ||
}, | ||
cmd.concurrency === undefined ? 8 : cmd.concurrency] | ||
).then(function(){ | ||
@@ -59,2 +66,2 @@ console.log('All done.'.grey); | ||
upCmd.description('Upload 28.io project.'); | ||
action(upCmd, $28.upload); | ||
action(upCmd, $28.upload); |
@@ -7,5 +7,6 @@ 'use strict'; | ||
var read = require('read'); | ||
var http = require('http'); | ||
var https = require('https'); | ||
var VFS = require('./vfs').VFS; | ||
var Client = (function(){ | ||
@@ -201,3 +202,13 @@ | ||
Client.prototype.sync = function(overwrite, deleteOrphaned, simulate, ignore, isOriginRemote){ | ||
Client.prototype.sync = function(overwrite, deleteOrphaned, simulate, ignore, isOriginRemote, concurrency){ | ||
if (concurrency === undefined) { | ||
http.globalAgent.maxSockets = 8; | ||
https.globalAgent.maxSockets = 8; | ||
console.log('Concurrency limit: 8.'.grey); | ||
} | ||
else { | ||
http.globalAgent.maxSockets = concurrency; | ||
https.globalAgent.maxSockets = concurrency; | ||
console.log('Concurrency limit: ' + concurrency + '.'.grey); | ||
} | ||
var that = this; | ||
@@ -215,8 +226,8 @@ return Q.all([ | ||
Client.prototype.download = function(overwrite, deleteOrphaned, simulate, ignore){ | ||
return this.sync(overwrite, deleteOrphaned, simulate, ignore, true); | ||
Client.prototype.download = function(overwrite, deleteOrphaned, simulate, ignore, concurrency){ | ||
return this.sync(overwrite, deleteOrphaned, simulate, ignore, true, concurrency); | ||
}; | ||
Client.prototype.upload = function(overwrite, deleteOrphaned, simulate, ignore){ | ||
return this.sync(overwrite, deleteOrphaned, simulate, ignore, false); | ||
Client.prototype.upload = function(overwrite, deleteOrphaned, simulate, ignore, concurrency){ | ||
return this.sync(overwrite, deleteOrphaned, simulate, ignore, false, concurrency); | ||
}; | ||
@@ -235,2 +246,2 @@ | ||
exports.Client = Client; | ||
exports.Client = Client; |
@@ -9,3 +9,3 @@ { | ||
"description": "Command line utility to download and upload 28.io queries.", | ||
"version": "3.2.1", | ||
"version": "3.4.0", | ||
"keywords": [ | ||
@@ -12,0 +12,0 @@ "jsoniq", |
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
187359
1329
8
2