atom-package-manager
Advanced tools
Comparing version 0.81.0 to 0.82.0
@@ -46,3 +46,3 @@ (function() { | ||
options = optimist(argv); | ||
options.usage("\nUsage: apm install [<package_name>...]\n\nInstall the given Atom package to ~/.atom/packages/<package_name>.\n\nIf no package name is given then all the dependencies in the package.json\nfile are installed to the node_modules folder in the current working\ndirectory."); | ||
options.usage("\nUsage: apm install [<package_name>...]\n apm install <package_name>@<package_version>\n\nInstall the given Atom package to ~/.atom/packages/<package_name>.\n\nIf no package name is given then all the dependencies in the package.json\nfile are installed to the node_modules folder in the current working\ndirectory."); | ||
options.alias('c', 'compatible').string('compatible').describe('compatible', 'Only list packages/themes compatible with this Atom version'); | ||
@@ -49,0 +49,0 @@ options.alias('h', 'help').describe('help', 'Print this usage message'); |
(function() { | ||
var Command, Unpublish, auth, fs, optimist, path, readline, request, | ||
var Command, Unpublish, auth, config, fs, optimist, path, readline, request, | ||
__hasProp = {}.hasOwnProperty, | ||
@@ -16,2 +16,4 @@ __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; | ||
config = require('./config'); | ||
fs = require('./fs'); | ||
@@ -33,3 +35,3 @@ | ||
options = optimist(argv); | ||
options.usage("Usage: apm unpublish [<package_name>]\n\nRemove a published package from the atom.io registry. The package in the\ncurrent working directory will be unpublished if no package name is\nspecified."); | ||
options.usage("Usage: apm unpublish [<package_name>]\n apm unpublish <package_name>@<package_version>\n\nRemove a published package or package version from the atom.io registry.\n\nThe package in the current working directory will be used if no package\nname is specified."); | ||
options.alias('h', 'help').describe('help', 'Print this usage message'); | ||
@@ -39,4 +41,9 @@ return options.alias('f', 'force').boolean('force').describe('force', 'Do not prompt for confirmation'); | ||
Unpublish.prototype.unpublishPackage = function(packageName, callback) { | ||
process.stdout.write("Unpublishing " + packageName + " "); | ||
Unpublish.prototype.unpublishPackage = function(packageName, packageVersion, callback) { | ||
var packageLabel; | ||
packageLabel = packageName; | ||
if (packageVersion) { | ||
packageLabel += "@" + packageVersion; | ||
} | ||
process.stdout.write("Unpublishing " + packageLabel + " "); | ||
return auth.getToken((function(_this) { | ||
@@ -51,3 +58,3 @@ return function(error, token) { | ||
options = { | ||
uri: "https://atom.io/api/packages/" + packageName, | ||
uri: "" + (config.getAtomPackagesUrl()) + "/" + packageName, | ||
headers: { | ||
@@ -58,2 +65,5 @@ authorization: token | ||
}; | ||
if (packageVersion) { | ||
options.uri += "/versions/" + packageVersion; | ||
} | ||
return request.del(options, function(error, response, body) { | ||
@@ -80,6 +90,10 @@ var message, _ref, _ref1; | ||
Unpublish.prototype.promptForConfirmation = function(packageName, callback) { | ||
var prompt; | ||
Unpublish.prototype.promptForConfirmation = function(packageName, packageVersion, callback) { | ||
var packageLabel, prompt; | ||
prompt = readline.createInterface(process.stdin, process.stdout); | ||
return prompt.question("Are you sure you want to unpublish " + packageName + "? (yes) ", (function(_this) { | ||
packageLabel = packageName; | ||
if (packageVersion) { | ||
packageLabel += "@" + packageVersion; | ||
} | ||
return prompt.question("Are you sure you want to unpublish " + packageLabel + "? (yes) ", (function(_this) { | ||
return function(answer) { | ||
@@ -89,3 +103,3 @@ prompt.close(); | ||
if (answer === 'y' || answer === 'yes') { | ||
return _this.unpublishPackage(packageName, callback); | ||
return _this.unpublishPackage(packageName, packageVersion, callback); | ||
} | ||
@@ -97,18 +111,23 @@ }; | ||
Unpublish.prototype.run = function(options) { | ||
var callback, name, _ref; | ||
var atIndex, callback, name, version, _ref; | ||
callback = options.callback; | ||
options = this.parseOptions(options.commandArgs); | ||
name = options.argv._[0]; | ||
if (name == null) { | ||
atIndex = name != null ? name.indexOf('@') : void 0; | ||
if (atIndex !== -1) { | ||
version = name.substring(atIndex + 1); | ||
name = name.substring(0, atIndex); | ||
} | ||
if (!name) { | ||
try { | ||
name = ((_ref = JSON.parse(fs.readFileSync('package.json'))) != null ? _ref : {}).name; | ||
name = (_ref = JSON.parse(fs.readFileSync('package.json'))) != null ? _ref.name : void 0; | ||
} catch (_error) {} | ||
if (name == null) { | ||
name = path.basename(process.cwd()); | ||
} | ||
} | ||
if (!name) { | ||
name = path.basename(process.cwd()); | ||
} | ||
if (options.argv.force) { | ||
return this.unpublishPackage(name, callback); | ||
return this.unpublishPackage(name, version, callback); | ||
} else { | ||
return this.promptForConfirmation(name, callback); | ||
return this.promptForConfirmation(name, version, callback); | ||
} | ||
@@ -115,0 +134,0 @@ }; |
{ | ||
"name": "atom-package-manager", | ||
"description": "Atom package manager", | ||
"version": "0.81.0", | ||
"version": "0.82.0", | ||
"licenses": [ | ||
@@ -6,0 +6,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199983
4518