shopify.destroy = function (filepath, file, host, base, themeid, callback) {

  var api = shopifyAPI;
  var themeid = themeid;
  var key = shopify._makeAssetKey(filepath, base);

  var prettyPath = shopify._getPrettyPath(file, base);
  log(chalk.red.dim('Removing file: ' + prettyPath));

  function onDestroy(err, resp) {
    if (!err) {
      log(chalk.green('File removed: ' + prettyPath));
    } else {
      var errorMessage = (err.type === 'ShopifyInvalidRequestError') ? err.detail.asset.join(', ') + ' in ' + file.relative : 'Shopify API response error: ' + err.type;
      log(chalk.red('Error: ' + errorMessage));
    }
    callback();
  }

  if (themeid) {
    api.asset.destroy(themeid, key, onDestroy);
  } else {
    api.assetLegacy.destroy(key, onDestroy);
  }
};
示例#2
0
文件: ssh.js 项目: freialib/valkyrja
									ssh.on('error', function (err) {
										console.log(c.red.dim('an error has occured'));
										console.log('');
										if (err.stack) {
											console.log(err.stack);
											console.log('');
										}
										else { // non-stack error
											console.log(err);
											console.log('');
										}
										ssh.end();
										reject(null);
									});
示例#3
0
文件: ssh.js 项目: freialib/valkyrja
										exit: function (code) {
											if (code != 0 || code != '0') {
												console.log(c.red.dim('command failed') + ', code ' + code);
												console.log('');
												if (conf['stop-on-errors']) {
													reject(null);
												}
												else { // we don't stop on errors
													resolve();
												}
											}
											else {
												resolve();
											}

											return false;
										}
示例#4
0
 onFailed: function (result) {
   console.log(chalk.red.dim("Failed:"), chalk.red(JSON.stringify(result)));
   process.exit(1);
 },