Permalink
Browse files

various adjustments for sm@0.3

  • Loading branch information...
1 parent 9c58229 commit 631babe21696d42e6e39f7689bef88e1ee334343 @cadorn cadorn committed Oct 31, 2012
Showing with 77 additions and 231 deletions.
  1. +5 −3 lib/cli.js
  2. +23 −4 lib/commands/clone.js
  3. +1 −0 lib/commands/edit.js
  4. +7 −0 lib/commands/install.js
  5. +29 −0 lib/commands/save.js
  6. +0 −23 lib/commands/status.js
  7. +12 −5 lib/commands/update.js
  8. +0 −196 npm-shrinkwrap.json
View
8 lib/cli.js
@@ -10,7 +10,7 @@ var ARGS_PARSER = require("sourcemint-util-js/lib/args").Parser;
//require("sourcemint-util-js/lib/console").enableFileLineInfo();
-const NODE_MIN_VERSION = "0.6.20";
+const NODE_MIN_VERSION = "0.6.19";
const NPM_MIN_VERSION = "1.1.63";
//TODO: Only enable this in debug mode.
@@ -72,7 +72,9 @@ exports.main = function() {
function ensureMinNodeVersion(callback) {
if (SEMVER.compare(process.version, NODE_MIN_VERSION) < 0) {
- TERM.stdout.writenl("\0red([sm] ERROR: Using NodeJS at version " + process.version + "` but we need at least version '" + NODE_MIN_VERSION + "'. Please upgrade `node`.\0)");
+ TERM.stdout.writenl("\0red([sm] ERROR: Using NodeJS at version " + process.version + " but we need \0bold(at least version " + NODE_MIN_VERSION + "\0). Please upgrade `node`.\0)");
+ TERM.stdout.writenl("\0red([sm] Here are the install instructions: \0bold(http://nodejs.org/download\0)\0)");
+ TERM.stdout.writenl("\0red([sm] You can download specific version from: \0bold(http://nodejs.org/dist\0)\0)");
return callback(true);
} else {
return callback(null);
@@ -95,7 +97,7 @@ function ensureMinNpmVersion(callback) {
// Check if installed version is newer than latest.
var version = stdout.replace(/[\n\s]*$/, "");
if (SEMVER.compare(version, NPM_MIN_VERSION) < 0) {
- TERM.stdout.writenl("\0red([sm] ERROR: Found `npm@" + version + "` but we need at least version '" + NPM_MIN_VERSION + "'. To install run: \0bold(sm install-npm\0)\0)");
+ TERM.stdout.writenl("\0red([sm] ERROR: Found npm@" + version + " but we need at least version " + NPM_MIN_VERSION + ". To install run: \0bold(sm install-npm\0)\0)");
return callback(true);
} else {
return callback(null);
View
27 lib/commands/clone.js
@@ -1,6 +1,7 @@
var PATH = require("path");
var ARGS_PARSER = require("sourcemint-util-js/lib/args").Parser;
+var TERM = require("sourcemint-util-js/lib/term");
var CLI = require("../cli");
var PM = require("sourcemint-pm-sm/lib/pm");
@@ -11,23 +12,41 @@ command.help("Clone a package/program from a URI.");
command.arg("URI");
command.arg("TARGET_PATH");
command.option("--dev").bool().help("Clone and setup for development.");
-command.option("--cached").bool().help("Clone from local cache if available (will not aggressively fetch latest remote info).");
+command.option("--cache").bool().help("Clone from local cache if available (will not aggressively fetch latest remote info).");
command.option("--delete").bool().help("Delete `TARGET_PATH` if it already exists.");
command.option("-v", "--verbose").bool().help("Show verbose progress.");
command.helpful();
command.action(function (options) {
+ if (options.args.length === 0) {
+ TERM.stdout.writenl("\0red([sm] ERROR: You must specify a URI and TARGET_PATH argument!\0)");
+ process.exit(1);
+ } else
+ if (options.args.length === 1) {
+ TERM.stdout.writenl("\0red([sm] ERROR: You must specify a TARGET_PATH as second argument!\0)");
+ process.exit(1);
+ } else
+ if (options.args.length > 2) {
+ TERM.stdout.writenl("\0red([sm] ERROR: You have specified more than two arguments! You only need a URI and TARGET_PATH!\0)");
+ process.exit(1);
+ }
+
if (options.dev === true) {
+
+ // TODO: Deprecated?
options.forceClone = true;
+
+ options.keepTopVcs = true;
+
options.create = true;
options.install = true;
}
- // Update newInVersions but don't fetch latest remote info.
- options.update = true;
+ options.all = true;
+ options.update = false;
options.now = true;
- if (options.cached) {
+ if (options.cache) {
options.now = false;
}
View
1 lib/commands/edit.js
@@ -12,6 +12,7 @@ command.help("Setup a dependency (see `sm status -ai`) package for editing.");
command.arg("DEPENDENCY");
command.arg("SOURCE_URI").optional();
command.option("-v", "--verbose").bool().help("Show verbose progress.");
+command.option("--debug").bool().help("Show debug output.");
command.helpful();
command.action(function (options) {
View
7 lib/commands/install.js
@@ -1,5 +1,6 @@
var ARGS_PARSER = require("sourcemint-util-js/lib/args").Parser;
+var TERM = require("sourcemint-util-js/lib/term");
var CLI = require("../cli");
var PM = require("sourcemint-pm-sm/lib/pm");
@@ -12,12 +13,18 @@ command.option("--dev").bool().help("Install dev dependencies as well.");
// NOTE: We don't default to 'now' on install as we want to be able to install 100% from cache in case network is down.
command.option("-n", "--now").bool().help("Aggressively fetch latest remote info (equivalent to `sm update`).");
command.option("-N", "--no-native-install").bool().help("Don't call native package installer (if applicable).");
+command.option("--dry-run").bool().help("Go through motions but don't actually install.");
command.option("-v", "--verbose").bool().help("Show verbose progress.");
command.option("--debug").bool().help("Show debug output.");
command.helpful();
command.action(function (options) {
+ if (options.args.length > 1) {
+ TERM.stdout.writenl("\0red([sm] ERROR: You have specified more than one argument! You only need a .../[package.json|program.json]!\0)");
+ process.exit(1);
+ }
+
var basePath = CLI.checkPackageProgramPathInArguments(options.args);
if (!basePath) {
return;
View
29 lib/commands/save.js
@@ -0,0 +1,29 @@
+
+var ARGS_PARSER = require("sourcemint-util-js/lib/args").Parser;
+var CLI = require("../cli");
+var PM = require("sourcemint-pm-sm/lib/pm");
+var Q = require("sourcemint-util-js/lib/q");
+var TERM = require("sourcemint-util-js/lib/term");
+
+
+var command = exports["save"] = new ARGS_PARSER();
+
+command.help("Freeze dependency tree and push.");
+command.option("-v", "--verbose").bool().help("Show verbose progress.");
+command.option("--debug").bool().help("Show debug output.");
+command.helpful();
+
+command.action(function (options) {
+
+ var basePath = CLI.checkPackageProgramPathInArguments(".");
+
+ PM.forProgramPath(basePath).then(function(pm) {
+ return PM.forPackagePath(basePath, pm).then(function(pm) {
+ return pm.save(options);
+ });
+ }).then(function() {
+ process.exit(0);
+ }).fail(function(err) {
+ CLI.failAndExit(err);
+ });
+});
View
23 lib/commands/status.js
@@ -390,29 +390,6 @@ command.action(function (options) {
summary = summary.slice(0, 2);
}
-/*
-if (!node.status.summary.installed) {
-console.log("NOT INSTALLED");
-}
-if (node.status.summary.isLinked) {
-console.log("LINKED", node.status.summary.isLinked);
-}
-if (node.status.summary.isWithinParents) {
-console.log("FOUND WITHIN PARENT", node.status.summary.isWithinParents);
-}
-var parentLinked = false;
-node.forEachParent(function(node, level) {
-//console.log("level", level);
-if (node.status.summary.isLinked) {
-//console.log("FOUND LINKED!");
- parentLinked = level;
-}
-}).then(function() {
-if (parentLinked) {
- console.log("PARENT LINKED", parentLinked);
-}
-});
-*/
if (foundInParent) {
// In parent package.
TERM.stdout.writenl(formatWritable() + summary.join(" ") + " \0white(<- " + formatPath() + "\0)" + formatAge() + formatLink());
View
17 lib/commands/update.js
@@ -1,28 +1,35 @@
var ARGS_PARSER = require("sourcemint-util-js/lib/args").Parser;
+var TERM = require("sourcemint-util-js/lib/term");
var CLI = require("../cli");
var PM = require("sourcemint-pm-sm/lib/pm");
var command = exports["update"] = new ARGS_PARSER();
command.help("Update package/program.");
-command.arg(".../[package.json|program.json]").optional();
-command.arg("DEPENDENCY");
-command.option("--cached").bool().help("Update from local cache if available (will not aggressively fetch latest remote info).");
+command.arg("DEPENDENCY").optional();
+command.arg("POINTER").optional();
+command.option("--cache").bool().help("Update from local cache if available (will not aggressively fetch latest remote info).");
+command.option("--dry-run").bool().help("Go through motions but don't actually update.");
command.option("-v", "--verbose").bool().help("Show verbose progress.");
command.option("--debug").bool().help("Show debug output.");
command.helpful();
command.action(function (options) {
- var basePath = CLI.checkPackageProgramPathInArguments(options.args);
+ if (options.args.length > 2) {
+ TERM.stdout.writenl("\0red([sm] ERROR: You have specified more than two arguments! You only need a DEPENDENCY and optional POINTER argument to update a specific dependency!\0)");
+ process.exit(1);
+ }
+
+ var basePath = CLI.checkPackageProgramPathInArguments(".");
if (!basePath) {
return;
}
options.now = true;
- if (options.cached) {
+ if (options.cache) {
options.now = false;
}
if (options.debug) {
View
196 npm-shrinkwrap.json
@@ -1,196 +0,0 @@
-{
- "name": "sm",
- "version": "0.2.11",
- "dependencies": {
- "sourcemint-pinf-js": {
- "version": "0.1.7"
- },
- "sourcemint-util-js": {
- "version": "0.1.53",
- "dependencies": {
- "n-util": {
- "version": "0.0.1"
- },
- "q": {
- "version": "0.8.5"
- },
- "glob": {
- "version": "3.1.12",
- "dependencies": {
- "minimatch": {
- "version": "0.2.6",
- "dependencies": {
- "lru-cache": {
- "version": "2.0.1"
- }
- }
- },
- "graceful-fs": {
- "version": "1.1.10"
- },
- "inherits": {
- "version": "1.0.0"
- }
- }
- },
- "wrench": {
- "version": "1.3.9"
- },
- "console-trace": {
- "version": "0.1.0",
- "from": "https://github.com/LearnBoost/console-trace/tarball/8a54bf706d001f1eef166b99391e952e4be10982",
- "dependencies": {
- "callsite": {
- "version": "0.0.2"
- }
- }
- }
- }
- },
- "sourcemint-pm-sm": {
- "version": "0.1.33",
- "dependencies": {
- "sourcemint-pm-git": {
- "version": "0.1.22"
- },
- "sourcemint-pm-url": {
- "version": "0.1.2"
- },
- "sourcemint-pm-npm": {
- "version": "0.1.19",
- "dependencies": {
- "semver": {
- "version": "1.0.14"
- }
- }
- },
- "sourcemint-pm-zip": {
- "version": "0.1.1"
- },
- "sourcemint-pm-tar": {
- "version": "0.1.6",
- "dependencies": {
- "tar": {
- "version": "0.1.13",
- "dependencies": {
- "inherits": {
- "version": "1.0.0"
- },
- "block-stream": {
- "version": "0.0.6"
- },
- "fstream": {
- "version": "0.1.18",
- "dependencies": {
- "rimraf": {
- "version": "2.0.2"
- },
- "mkdirp": {
- "version": "0.3.3"
- },
- "graceful-fs": {
- "version": "1.1.10"
- }
- }
- }
- }
- }
- }
- },
- "sourcemint-deployer": {
- "version": "0.1.5",
- "dependencies": {
- "sourcemint-sdk-aws": {
- "version": "0.1.6",
- "dependencies": {
- "aws-lib": {
- "version": "0.0.6",
- "dependencies": {
- "xml2js": {
- "version": "0.1.14"
- },
- "sax": {
- "version": "0.1.5"
- }
- }
- }
- }
- },
- "sourcemint-pm-rsync": {
- "version": "0.1.3"
- },
- "sourcemint-pm-ssh": {
- "version": "0.1.2"
- }
- }
- },
- "mappings": {
- "version": "0.1.5"
- },
- "semver": {
- "version": "1.0.14"
- },
- "prompt": {
- "version": "0.2.3",
- "dependencies": {
- "pkginfo": {
- "version": "0.2.3"
- },
- "read": {
- "version": "0.1.1"
- },
- "revalidator": {
- "version": "0.1.2"
- },
- "utile": {
- "version": "0.1.3",
- "dependencies": {
- "async": {
- "version": "0.1.22"
- },
- "deep-equal": {
- "version": "0.0.0"
- },
- "i": {
- "version": "0.3.0"
- },
- "mkdirp": {
- "version": "0.3.3"
- },
- "ncp": {
- "version": "0.2.6"
- },
- "rimraf": {
- "version": "1.0.9"
- }
- }
- },
- "winston": {
- "version": "0.6.2",
- "dependencies": {
- "async": {
- "version": "0.1.22"
- },
- "colors": {
- "version": "0.6.0-1"
- },
- "cycle": {
- "version": "1.0.0"
- },
- "eyes": {
- "version": "0.1.7"
- },
- "request": {
- "version": "2.9.203"
- },
- "stack-trace": {
- "version": "0.0.6"
- }
- }
- }
- }
- }
- }
- }
- }
-}

0 comments on commit 631babe

Please sign in to comment.