Skip to content
Browse files

Merge branch 'master' of git://github.com/280north/narwhal

  • Loading branch information...
2 parents f898151 + a93fdfe commit 573620bb2f51f03bf8b7b56b2812df6319beabbc @rickmark rickmark committed Mar 1, 2010
Showing with 176 additions and 100 deletions.
  1. +103 −68 catalog-2.json
  2. +7 −1 engines/rhino/lib/uuid.js
  3. +9 −6 lib/args.js
  4. +53 −21 lib/narwhal/tusk/commands/install.js
  5. +4 −4 sources.json
View
171 catalog-2.json
@@ -87,19 +87,26 @@
"lib": [
"lib"
],
- "lean": [
- "lib",
- "engines"
- ],
- "descriptorUrl": "http://github.com/tlrobinson/narwhal/raw/master/package.json",
- "packageUrl": "http://github.com/tlrobinson/narwhal/zipball/master",
+ "lean": {
+ "include": [
+ "engines/default/**/*",
+ "engines/rhino/bootstrap.js",
+ "engines/rhino/lib/**/*",
+ "engines/rhino/package.json",
+ "lib/**/*",
+ "narwhal.js",
+ "package.json"
+ ]
+ },
+ "descriptorUrl": "http://github.com/280north/narwhal/raw/master/package.json",
+ "packageUrl": "http://github.com/280north/narwhal/zipball/master",
"packageArchive": "zip",
"source": {
"type": "github",
- "user": "tlrobinson",
+ "user": "280north",
"packageName": "narwhal",
- "descriptorUrl": "http://github.com/tlrobinson/narwhal/raw/master/package.json",
- "url": "http://github.com/tlrobinson/narwhal/zipball/master",
+ "descriptorUrl": "http://github.com/280north/narwhal/raw/master/package.json",
+ "url": "http://github.com/280north/narwhal/zipball/master",
"archive": "zip"
},
"dependencies": []
@@ -127,15 +134,15 @@
"1",
"1"
],
- "descriptorUrl": "http://github.com/tlrobinson/narwhal-jsc/raw/master/package.json",
- "packageUrl": "http://github.com/tlrobinson/narwhal-jsc/zipball/master",
+ "descriptorUrl": "http://github.com/280north/narwhal-jsc/raw/master/package.json",
+ "packageUrl": "http://github.com/280north/narwhal-jsc/zipball/master",
"packageArchive": "zip",
"source": {
"type": "github",
- "user": "tlrobinson",
+ "user": "280north",
"packageName": "narwhal-jsc",
- "descriptorUrl": "http://github.com/tlrobinson/narwhal-jsc/raw/master/package.json",
- "url": "http://github.com/tlrobinson/narwhal-jsc/zipball/master",
+ "descriptorUrl": "http://github.com/280north/narwhal-jsc/raw/master/package.json",
+ "url": "http://github.com/280north/narwhal-jsc/zipball/master",
"archive": "zip"
},
"contributors": [
@@ -266,6 +273,12 @@
"type": "MPL"
},
{
+ "type": "GPL 2.0"
+ },
+ {
+ "type": "LGPL 2.1"
+ },
+ {
"type": "MIT"
}
],
@@ -426,15 +439,15 @@
"1",
"2"
],
- "descriptorUrl": "http://github.com/tlrobinson/jack/raw/master/package.json",
- "packageUrl": "http://github.com/tlrobinson/jack/zipball/master",
+ "descriptorUrl": "http://github.com/280north/jack/raw/master/package.json",
+ "packageUrl": "http://github.com/280north/jack/zipball/master",
"packageArchive": "zip",
"source": {
"type": "github",
- "user": "tlrobinson",
+ "user": "280north",
"packageName": "jack",
- "descriptorUrl": "http://github.com/tlrobinson/jack/raw/master/package.json",
- "url": "http://github.com/tlrobinson/jack/zipball/master",
+ "descriptorUrl": "http://github.com/280north/jack/raw/master/package.json",
+ "url": "http://github.com/280north/jack/zipball/master",
"archive": "zip"
}
},
@@ -451,8 +464,7 @@
},
"email": "george.moschovitis@gmail.com",
"dependencies": [
- "jack",
- "template"
+ "jack"
],
"contributors": [
{
@@ -619,15 +631,15 @@
"dom",
"xmlhttprequest"
],
- "descriptorUrl": "http://github.com/tlrobinson/browserjs/raw/master/package.json",
- "packageUrl": "http://github.com/tlrobinson/browserjs/zipball/master",
+ "descriptorUrl": "http://github.com/280north/browserjs/raw/master/package.json",
+ "packageUrl": "http://github.com/280north/browserjs/zipball/master",
"packageArchive": "zip",
"source": {
"type": "github",
- "user": "tlrobinson",
+ "user": "280north",
"packageName": "browserjs",
- "descriptorUrl": "http://github.com/tlrobinson/browserjs/raw/master/package.json",
- "url": "http://github.com/tlrobinson/browserjs/zipball/master",
+ "descriptorUrl": "http://github.com/280north/browserjs/raw/master/package.json",
+ "url": "http://github.com/280north/browserjs/zipball/master",
"archive": "zip"
},
"contributors": [
@@ -995,40 +1007,57 @@
},
"jsdocs": {
"name": "jsdocs",
- "description": "Tool for generating template-formatted, multi-page HTML (or XML, JSON, or any other text-based) documentation from commented JavaScript source code.",
+ "description": "JavaScript documentation generator. Tool for generating template-formatted, multi-page HTML (or XML, JSON, or any other text-based) documentation from commented JavaScript source code.",
+ "version": [
+ "0",
+ "1",
+ "0"
+ ],
"keywords": [
"jsdoc",
"documentation"
],
- "author": {
- "name": "Irakli Gozalishvili",
- "url": "http://rfobic.wordpress.com/"
- },
- "email": "rfobic@gmail.com",
- "lib": [
- "lib"
+ "maintainers": [
+ {
+ "name": "Irakli Gozalishvili",
+ "email": "rfobic@gmail.com",
+ "web": "http://rfobic.wordpress.com/"
+ }
],
- "lean": [
- "lib",
- "engines"
+ "contributors": [
+ {
+ "name": "Irakli Gozalishvili",
+ "email": "rfobic@gmail.com"
+ }
],
- "version": {
- "label": "0.1",
- "numeric": [
- 0,
- 1
- ],
- "status": "development"
+ "bugs": {
+ "web": "http://github.com/Gozala/jsdocs/issues/"
},
- "license": [
- "MPL 1.1",
- "GPL 2.0",
- "LGPL 2.1"
+ "licenses": [
+ {
+ "type": "MIT"
+ }
],
- "dependencies": [
- "syntax-stroop",
- "seethrough"
+ "repositories": [
+ {
+ "type": "git",
+ "url": "git://github.com/Gozala/jsdocs.git"
+ }
+ ],
+ "os": [
+ "linux",
+ "macos",
+ "win"
+ ],
+ "cpu": [
+ "x86",
+ "ppc",
+ "x86_64"
],
+ "directories": {
+ "lib": "lib",
+ "bin": "bin"
+ },
"descriptorUrl": "http://github.com/Gozala/jsdocs/raw/master/package.json",
"packageUrl": "http://github.com/Gozala/jsdocs/zipball/master",
"packageArchive": "zip",
@@ -1040,12 +1069,7 @@
"url": "http://github.com/Gozala/jsdocs/zipball/master",
"archive": "zip"
},
- "contributors": [
- {
- "name": "Irakli Gozalishvili",
- "url": "http://rfobic.wordpress.com/"
- }
- ]
+ "dependencies": []
},
"syntax-stroop": {
"name": "syntax-stroop",
@@ -1610,7 +1634,7 @@
"email": "sergi.mansilla@gmail.com"
},
"jars": [
- "jars/mongo-0.11.jar"
+ "mongo-1.2.jar"
],
"email": "sergi.mansilla@gmail.com",
"dependencies": [],
@@ -1845,9 +1869,7 @@
"ojunit": {
"name": "ojunit",
"dependencies": [
- "narwhal",
- "objective-j",
- "cappuccino"
+ "narwhal"
],
"author": {
"name": "Tom Robinson",
@@ -1863,6 +1885,15 @@
},
{
"name": "Martin Hacker"
+ },
+ {
+ "name": "Derek Hammer"
+ },
+ {
+ "name": "Francisco Tolmasky"
+ },
+ {
+ "name": "Andrew Burkhalter"
}
],
"description": "A simple Objective-J unit test framework.",
@@ -1875,6 +1906,11 @@
"objj-frameworks": [
"Framework"
],
+ "version": [
+ "0",
+ "1",
+ "0"
+ ],
"descriptorUrl": "http://github.com/280north/ojunit/raw/master/package.json",
"packageUrl": "http://github.com/280north/ojunit/zipball/master",
"packageArchive": "zip",
@@ -1885,8 +1921,7 @@
"descriptorUrl": "http://github.com/280north/ojunit/raw/master/package.json",
"url": "http://github.com/280north/ojunit/zipball/master",
"archive": "zip"
- },
- "version": []
+ }
},
"qxoo": {
"name": "qxoo",
@@ -2558,8 +2593,7 @@
],
"version": [
"0",
- "0",
- "1"
+ "2"
],
"descriptorUrl": "http://github.com/280north/commonjs-shrinksafe/raw/master/package.json",
"packageUrl": "http://github.com/280north/commonjs-shrinksafe/zipball/master",
@@ -2581,15 +2615,16 @@
"description": "Haml ported to server-side Javascript. This is a traditional server-side templating language.",
"keywords": [
"haml",
- "template"
+ "template",
+ "nodejs"
],
"author": {
"name": "Tim Caswell"
},
"version": [
"0",
- "0",
- "1"
+ "1",
+ "2"
],
"descriptorUrl": "http://github.com/creationix/haml-js/raw/master/package.json",
"packageUrl": "http://github.com/creationix/haml-js/zipball/master",
View
8 engines/rhino/lib/uuid.js
@@ -1,7 +1,13 @@
// Kris Zyp
+// Tom Robinson
exports.randomUUID = function(){
- return String(java.util.UUID.randomUUID())
+ require("narwhal").deprecated("randomUUID is deprecated in favor of uuid");
+ return String(java.util.UUID.randomUUID());
};
+// compatible with Narwhal's main UUID module
+exports.uuid = function(){
+ return String(java.util.UUID.randomUUID()).toUpperCase();
+};
View
15 lib/args.js
@@ -324,7 +324,7 @@ exports.Parser.prototype.check = function () {
// TODO break this into sub-functions
// TODO wrap with a try catch and print the progress through the arguments
-exports.Parser.prototype.parse = function (args, options, noCommand) {
+exports.Parser.prototype.parse = function (args, options, noCommand, allowInterleaved) {
var self = this;
this.check();
@@ -375,6 +375,8 @@ exports.Parser.prototype.parse = function (args, options, noCommand) {
options[option.getName()] = option._def;
});
+ var interleavedArgs = [];
+
// walk args
ARGS: while (args.length) {
var arg = args.shift();
@@ -464,15 +466,16 @@ exports.Parser.prototype.parse = function (args, options, noCommand) {
}
} else {
- // TODO permit options interleaved with arguments,
- // with associated actions, for any of positional
- // args, variadic args, and accumulated args
- args.unshift(arg);
- break;
+ interleavedArgs.push(arg);
+ if (!allowInterleaved)
+ break;
}
}
+ // add the interleaved arguments back in
+ args.unshift.apply(args, interleavedArgs)
+
if (util.len(this._commands)) {
if (args.length) {
if (util.has(this._commands, args[0])) {
View
74 lib/narwhal/tusk/commands/install.js
@@ -1,5 +1,6 @@
// Kris Kowal
+// Tom Robinson
var tusk = require("../../tusk");
var util = require("util");
@@ -9,6 +10,8 @@ var json = require("json");
var http = require("http");
var zip = require("zip");
var packages = require("packages");
+var URI = require("uri");
+var UUID = require("uuid");
var parser = exports.parser = new args.Parser();
@@ -40,7 +43,7 @@ parser.action(function (options) {
});
exports.install = function (options, names) {
-
+
var localSourcePath = fs.cwdPath();
if (!tusk.getCatalogPath().isFile()) {
@@ -62,25 +65,51 @@ exports.install = function (options, names) {
return;
}
+ // download remote zips
+ // TODO: detect tars?
+ var names = names.map(function (name) {
+ var uri = URI.parse(name);
+ if (uri.scheme === "http" || uri.scheme === "https") {
+ var zipFile = tusk.getZipsDirectory().join(UUID.uuid()+".zip");
+ var zipData = http.read(name, 'b');
+ zipFile.write(zipData, 'b');
+ cleanupPaths.push(zipFile);
+
+ return zipFile.toString();
+ }
+ return name;
+ });
+
// validate the requested names against those
// in the catalog of downloadable packages.
var names = names.map(function (name) {
var localPath = fs.path(fs.absolute(name).replace(/\/$/, "")); // FIXME: basename/dirname broken with trailing slash
var localPackagePath = localPath.join("package.json");
- if (localPackagePath.isFile()) {
- var packageData = json.decode(localPackagePath.read({charset: 'utf-8'}));
+ if (name.match(/\.zip$/) && localPath.isFile()) {
+ var packageName = null;
+ new zip.Unzip(localPath).forEach(function (entry) {
+ if (!packageName && entry.getName().match(/^[^\/]+\/package.json/)) {
+ var packageData = json.decode(entry.read('b').decodeToString("UTF-8"));
+ packageName = packageData.name || String(localPath.basename());
+
+ packageData.packageUrl = "file://" + localPath;
+ catalog.packages[packageName] = packageData;
+ }
+ });
+ return packageName;
+ }
+ else if (localPackagePath.isFile()) {
+ var packageData = json.decode(localPackagePath.read({charset: 'UTF-8'}));
var packageName = packageData.name || String(localPath.basename());
-
+
packageData.packageUrl = "file://" + localPath;
- packageData.type = "directory";
-
catalog.packages[packageName] = packageData;
return packageName;
} else if (util.has(catalog.packages, name)) {
// nothing to do.
return name;
}
-
+
parser.print("ERROR: Package not found: " + util.enquote(name));
return null;
}).filter(function(name) { return !!name; });
@@ -117,34 +146,34 @@ exports.install = function (options, names) {
// note missing packages
var missing = exports.missing(packages.catalog, dependencies);
-
+
// add forced packages back in
if (options.force) {
names.forEach(function(name) {
if (!util.has(missing, name))
missing.push(name);
});
}
-
+
if (!missing.length) {
print('No new packages to install.');
this.exit();
}
- print('The following packages will be downloaded and installed:');
+ print('The following packages will be installed:');
printUl(missing);
// download missing packages
var zipsDirectory = tusk.getZipsDirectory();
zipsDirectory.mkdirs();
-
+
missing.forEach(function (name) {
if (/^file:\/\//.test(catalog.packages[name].packageUrl)) {
print('Local package: ' + name);
return;
}
var info = catalog.packages[name];
print('Downloading: ' + info.packageUrl);
- if (options.simulate)
+ if (options.simulate)
return;
var zipFile = zipsDirectory.join(name + '.zip')
if (options.resume && zipFile.isFile())
@@ -172,27 +201,30 @@ exports.install = function (options, names) {
return;
}
}
-
+
var components = catalog.packages[name].packageUrl.match(/^file:\/\/(.*)$/);
- if (components) {
- var sourcePath = components[1];
+ var sourcePath = components ? components[1] : zipsDirectory.join(name + '.zip');
+
+ if (!sourcePath.match(/\.zip$/)) {
print('Copying: ' + sourcePath);
if (options.simulate)
return;
fs.copyTree(sourcePath, targetPath);
- var files = targetPath.listTree().filter(function(f) { return targetPath.join(f).isFile(); });
- print(" + " + files.join("\n + "));
- notes[name].files.push.apply(notes[name].files.push, files);
+ targetPath.listTree().forEach(function(f) {
+ if (targetPath.join(f).isFile()) {
+ print(" + " + f);
+ notes[name].files.push(f);
+ }
+ });
} else {
- var zipFile = zipsDirectory.join(name + '.zip');
- print('Unzipping: ' + zipFile);
+ print('Unzipping: ' + sourcePath);
if (options.simulate)
return;
// unzip
- new zip.Unzip(zipFile).forEach(function (entry) {
+ new zip.Unzip(sourcePath).forEach(function (entry) {
if (entry.isDirectory())
return;
var parts = fs.split(entry.getName());
View
8 sources.json
@@ -3,11 +3,11 @@
"sources": {
"narwhal": {
"type": "github",
- "user": "tlrobinson"
+ "user": "280north"
},
"narwhal-jsc": {
"type": "github",
- "user": "tlrobinson"
+ "user": "280north"
},
"narwhal-v8": {
"type": "github",
@@ -31,7 +31,7 @@
},
"jack": {
"type": "github",
- "user": "tlrobinson"
+ "user": "280north"
},
"nitro": {
"type": "github",
@@ -51,7 +51,7 @@
},
"browserjs": {
"type": "github",
- "user": "tlrobinson"
+ "user": "280north"
},
"inspec": {
"type": "github",

0 comments on commit 573620b

Please sign in to comment.
Something went wrong with that request. Please try again.