Created
November 15, 2010 14:37
-
-
Save dvv/700409 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/lib/nodules.js b/lib/nodules.js | |
index f95fadb..2853901 100644 | |
--- a/lib/nodules.js | |
+++ b/lib/nodules.js | |
@@ -679,6 +679,7 @@ exports.protocols = { | |
var exclamationIndex = uri.indexOf("!"); | |
var target = uri.substring(exclamationIndex + 2); | |
var targetContents; | |
+ var origUri = uri; | |
uri = uri.substring(0, exclamationIndex); | |
return when(fs.stat(cachePath(uri)), function(stat){ | |
if(!stat.mtime){ | |
@@ -688,6 +689,25 @@ exports.protocols = { | |
return null; | |
}, onError); | |
function onError(){ | |
+ if (uri.match(/\/zipball\/master$/)) { | |
+ // try Git | |
+ // TODO: a cmdline option? | |
+ var gitUri = uri.split('/').slice(1,5).join('/') + '.git'; | |
+ var path = cachePath(uri); | |
+ ensurePath(path); | |
+ //console.log('TRYGIT', origUri, gitUri, path); | |
+ var exec = require('child_process').exec; | |
+ var deferred = promiseModule.defer(); | |
+ var child = exec('git1 clone https:/' + gitUri + ' ' + path, function(err, stdout, stderr){ | |
+ console.log('GITRES', err); | |
+ if (err) { | |
+ // TODO: fallback to following return when(...) | |
+ } | |
+ var fileName = origUri.replace(/.*!/, path); | |
+ deferred.resolve(readModuleFile(fileName, 'jar:' + uri)); | |
+ }); | |
+ return deferred.promise; | |
+ } | |
return when(getUri(uri), function(source){ | |
if(source === null){ | |
throw new Error("Archive not found " + uri); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
L26 -- s/git1/git -- express failure used for test