Permalink
Browse files

Fix "tusk clone" and readSources()

  • Loading branch information...
Tom Robinson
Tom Robinson committed Mar 3, 2010
1 parent 106140a commit 3a96af9af3f28d4a0d6d22fe886108f76e16d243
Showing with 11 additions and 6 deletions.
  1. +1 −1 lib/narwhal/tusk.js
  2. +10 −5 lib/narwhal/tusk/commands/clone.js
View
@@ -128,7 +128,7 @@ exports.readSources = function () {
"sources file is out of date. version " +
exports.minCatalogVersion + " is required."
);
- sources.packages = sources.packages || {};
+ sources.sources = sources.sources || {};
return sources;
};
@@ -21,22 +21,27 @@ parser.option('-u', '--user', 'user')
.help('overrides the user name from which to clone the package')
.set();
+
parser.action(function (options) {
+ exports.clone.call(this, options, options.args);
+});
+
+exports.clone = function (options, names) {
var self = this;
- if (!util.len(options.args))
+ if (!util.len(names))
throw new Error("Package name required");
var packagesDirectory = tusk.getPackagesDirectory();
- var sources = tusk.readSources().packages;
+ var sources = tusk.readSources().sources;
var catalog = tusk.readCatalog().packages;
var owner = options.owner;
- options.args.forEach(function (name) {
+ names.forEach(function (name) {
if (!util.has(sources, name))
throw new Error("Package does not exist: " + name);
var source = util.get(sources, name);
if (source.type !== "github")
throw new Error("Package " + util.enquote(name) + " is not a Github package.");
});
- options.args.forEach(function (name) {
+ names.forEach(function (name) {
var source = util.get(sources, name);
var githubName = util.get(source, 'name', name);
var user = options.user || source.user;
@@ -62,7 +67,7 @@ parser.action(function (options) {
}).join(' ') + '\0)');
os.system(command);
});
-});
+};
parser.helpful();

0 comments on commit 3a96af9

Please sign in to comment.