From 59fbc308b08c80ca430dada303442332cfc574d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andre=CC=81=20Cruz?= Date: Sun, 14 Apr 2013 03:40:25 +0100 Subject: [PATCH] Update codebase to the almost finalised architecture. The GitRemoteResolver is almost done. --- .jshintrc | 2 +- TODO.md | 1 - lib/{core => }/config.js | 0 lib/core/Package.js | 240 ------------------ lib/core/packages/GitRemotePackage.js | 75 ------ lib/core/packages/index.js | 5 - lib/index.js | 2 +- lib/resolve/Manager.js | 0 lib/{core => resolve}/UnitOfWork.js | 0 .../createResolver.js} | 8 +- lib/resolve/resolvers/FsResolver.js | 0 .../resolvers/GitFsResolver.js} | 0 lib/resolve/resolvers/GitRemoteResolver.js | 200 +++++++++++++++ lib/resolve/resolvers/Resolver.js | 138 ++++++++++ .../resolvers/UrlResolver.js} | 0 lib/util/cmd.js | 52 ++++ package.json | 3 +- test/test.js | 26 +- 18 files changed, 409 insertions(+), 343 deletions(-) rename lib/{core => }/config.js (100%) delete mode 100644 lib/core/Package.js delete mode 100644 lib/core/packages/GitRemotePackage.js delete mode 100644 lib/core/packages/index.js create mode 100644 lib/resolve/Manager.js rename lib/{core => resolve}/UnitOfWork.js (100%) rename lib/{core/createPackage.js => resolve/createResolver.js} (55%) create mode 100644 lib/resolve/resolvers/FsResolver.js rename lib/{core/packages/GitFsPackage.js => resolve/resolvers/GitFsResolver.js} (100%) create mode 100644 lib/resolve/resolvers/GitRemoteResolver.js create mode 100644 lib/resolve/resolvers/Resolver.js rename lib/{core/packages/UrlPackage.js => resolve/resolvers/UrlResolver.js} (100%) create mode 100644 lib/util/cmd.js diff --git a/.jshintrc b/.jshintrc index c0fceb36..52c60909 100644 --- a/.jshintrc +++ b/.jshintrc @@ -32,7 +32,7 @@ "trailing": true, "asi": false, - "boss": false, + "boss": true, "debug": false, "eqnull": true, "es5": false, diff --git a/TODO.md b/TODO.md index 337f63d2..1fa2f765 100644 --- a/TODO.md +++ b/TODO.md @@ -2,7 +2,6 @@ TODO list: - Offline usage - Config - - Fix nodejs 0.10.x issue due to a bug in the `rc` package. I've already submited a [PR](https://github.com/dominictarr/config-chain/pull/11) - Allow `config.cwd` to be changed by an argument when using the CLI. Two ways of doing this: - Read a --cwd or similar and change the `config.cwd` to it - Allow any arbitrary `config.*` to be changed with --config.* arguments diff --git a/lib/core/config.js b/lib/config.js similarity index 100% rename from lib/core/config.js rename to lib/config.js diff --git a/lib/core/Package.js b/lib/core/Package.js deleted file mode 100644 index e6263bda..00000000 --- a/lib/core/Package.js +++ /dev/null @@ -1,240 +0,0 @@ -var util = require('util'); -var fs = require('fs'); -var path = require('path'); -var events = require('events'); -var mout = require('mout'); -var Q = require('q'); -var tmp = require('tmp'); -var UnitOfWork = require('./UnitOfWork'); -var config = require('./config'); -var createPackage; -var createError = require('../util/createError'); - -var Package = function (endpoint, options) { - options = options || {}; - - this._endpoint = endpoint; - this._name = options.name; - this._guessedName = !this.name; - this._range = options.range || '*'; - this._unitOfWork = options.unitOfWork || new UnitOfWork(); - this._config = options.config || config; -}; - -util.inherits(Package, events.EventEmitter); - -// ----------------- - -Package.prototype.getName = function () { - return this._name; -}; - -Package.prototype.getEndpoint = function () { - return this._endpoint; -}; - -Package.prototype.getRange = function () { - return this._range; -}; - -Package.prototype.getTempDir = function () { - return this._tempDir; -}; - -Package.prototype.resolve = function () { - // Throw if already resolved - if (this._resolved) { - throw createError('Package is already resolved', 'EALREADYRES'); - } - - // 1st - Enqueue the package in the unit of work - return this._unitOfWork.enqueue(this) - .then(function (done) { - // 2nd - Create temporary dir - return this._createTempDir() - // 3nd - Resolve self - .then(this._resolveSelf.bind(this)) - // 4th - Read json - .then(this._readJson.bind(this)) - // 5th - Parse json - .then(this._parseJson.bind(this)) - // 6th - Mark as resolved & call done - // to inform the unit of work - .then(function (dependencies) { - this._resolved = true; - done(); - return dependencies; - }.bind(this), function (err) { - this._resolveError = err; - done(); - throw err; - }.bind(this)) - // 7th - Resolve dependencies - .then(this._resolveDependencies.bind(this)); - }.bind(this), function (err) { - // If error is of a duplicate package, - // copy everything from the resolved package (duplicate) to itself - if (err.code === 'EDUPL') { - mout.object.mixIn(this, err.pkg); - } else { - this._resolveError = err; - throw err; - } - }); -}; - -Package.prototype.getResolveError = function () { - return this._resolveError; -}; - -Package.prototype.getJson = function () { - this._assertResolved(); - return this._json; -}; - -Package.prototype.getDependencies = function () { - this._assertResolved(); - return this._dependencies; -}; - -Package.prototype.install = function () { - this._assertResolved(); - - // TODO -}; - -// ----------------- - -Package.prototype._resolveSelf = function () {}; - -// ----------------- - - -Package.prototype._createTempDir = function () { - console.log('_createTempDir'); - - // Resolved if cached - if (this._tempDir) { - return Q.fcall(this._tempDir); - } - - return Q.nfcall(tmp.dir, { - prefix: 'bower-' + this.name + '-', - mode: parseInt('0777', 8) & (~process.umask()) - }) - .then(function (dir) { - this._tempDir = dir; - return dir; - }.bind(this)); -}; - -Package.prototype._readJson = function () { - console.log('_readJson'); - - // Resolve if cached - if (this._json) { - return Q.fcall(this._json); - } - - var jsonFile; - - // Try bower.json - jsonFile = path.join(this.getTempDir(), 'bower.json'); - return Q.nfcall(fs.readFile, jsonFile) - // Try component.json - .then(null, function (err) { - if (err.code !== 'ENOENT') { - throw err; - } - - jsonFile = path.join(this.getTempDir(), 'component.json'); - return Q.nfcall(fs.readFile, jsonFile) - // Issue a deprecation message if it exists - .then(function (contents) { - this.emit('warn', 'Package "' + this.name + '" is using the deprecated component.json file'); - return contents; - }.bind(this)); - }.bind(this)) - // If we got the file contents, validate them - .then(function (contents) { - // TODO: change the validation to a separate module in the bower organization - try { - this._json = JSON.parse(contents); - return this._json; - } catch (e) { - throw createError('Unable to parse "' + jsonFile + '" file', e.code, { - details: e.message - }); - } - // Otherwise there was an error - }.bind(this), function (err) { - // If no json file was found, return one just with the name - if (err.code === 'ENOENT') { - this._json = { name: this.name }; - return this._json; - } - - // If we got here, the error code is something else so we re-throw it - throw err; - }.bind(this)); -}; - -Package.prototype._parseJson = function (json) { - console.log('_parseJson'); - - // Resolve if cached - if (this._dependencies) { - return Q.fcall(this._dependencies); - } - - // Check if name defined in the json is different - // If so and if the name was "guessed", assume the json name - if (this._guessedName && json.name !== this.name) { - this.name = json.name; - this.emit('name_change', this.name); - } - - // Handle ignore property, deleting all files from the temporary directory - return Q.fcall(function () { - // Delete all the files specified in the ignore from the temporary directory - // TODO: - }.bind(this)) - // Handle the dependencies property - .then(function () { - var key, - promises = []; - - // Read the dependencies, creating a package for each one - createPackage = createPackage || require('./createPackage'); - if (json.dependencies) { - for (key in json.dependencies) { - promises.push(createPackage(json.dependencies[key], { name: key, unitOfWork: this._unitOfWork })); - } - } - - // Resolve all the create packages promises - return Q.all(promises).then(function (packages) { - this._dependencies = packages; - return packages; - }.bind(this)); - }); -}; - - -Package.prototype._resolveDependencies = function (dependencies) { - console.log('_resolveDependencies'); - - var promises = dependencies.map(function (dep) { - return dep.resolve(); - }); - - return Q.all(promises); -}; - -Package.prototype._assertResolved = function () { - if (!this._resolved) { - throw createError('Package is not yet resolved', 'ENOTRES'); - } -}; - -module.exports = Package; \ No newline at end of file diff --git a/lib/core/packages/GitRemotePackage.js b/lib/core/packages/GitRemotePackage.js deleted file mode 100644 index 575ac544..00000000 --- a/lib/core/packages/GitRemotePackage.js +++ /dev/null @@ -1,75 +0,0 @@ -var util = require('util'); -var Q = require('q'); -var Package = require('../Package'); - -var GitRemotePackage = function (endpoint, options) { - Package.call(this, endpoint, options); -}; - -util.inherits(GitRemotePackage, Package); - -// ----------------- - -GitRemotePackage.prototype._resolveSelf = function () { - var promise; - - console.log('_resolveSelf of git remote package'); - promise = this._clone() - .then(this._fetch.bind(this)) - .then(this._versions.bind(this)) - .then(this._checkout.bind(this)); - - return promise; -}; - -GitRemotePackage.prototype._clone = function () { - // check cache - // clone only if not cached - var deferred = Q.defer(); - - console.log('_clone'); - setTimeout(function () { - deferred.resolve(); - }, 1000); - - return deferred.promise; -}; - -GitRemotePackage.prototype._fetch = function () { - // fetch origin with --prune - // reset --hard origin/HEAD - var deferred = Q.defer(); - - console.log('_fetch'); - setTimeout(function () { - deferred.resolve(); - }, 1000); - - return deferred.promise; -}; - -GitRemotePackage.prototype._versions = function () { - // retrieve versions - var deferred = Q.defer(); - - console.log('_versions'); - setTimeout(function () { - deferred.resolve(); - }, 1000); - - return deferred.promise; -}; - -GitRemotePackage.prototype._checkout = function () { - // resolve range to a specific version and check it out - var deferred = Q.defer(); - - console.log('_checkout'); - setTimeout(function () { - deferred.resolve(); - }, 1000); - - return deferred.promise; -}; - -module.exports = GitRemotePackage; diff --git a/lib/core/packages/index.js b/lib/core/packages/index.js deleted file mode 100644 index 97e06876..00000000 --- a/lib/core/packages/index.js +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = { - UrlPackage: require('./UrlPackage'), - GitFsPackage: require('./GitFsPackage'), - GitRemotePackage: require('./GitRemotePackage') -}; \ No newline at end of file diff --git a/lib/index.js b/lib/index.js index 7cf835ed..0637cf4f 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,4 +1,4 @@ module.exports = { commands: require('./commands'), - config: require('./core/config') + config: require('./config') }; \ No newline at end of file diff --git a/lib/resolve/Manager.js b/lib/resolve/Manager.js new file mode 100644 index 00000000..e69de29b diff --git a/lib/core/UnitOfWork.js b/lib/resolve/UnitOfWork.js similarity index 100% rename from lib/core/UnitOfWork.js rename to lib/resolve/UnitOfWork.js diff --git a/lib/core/createPackage.js b/lib/resolve/createResolver.js similarity index 55% rename from lib/core/createPackage.js rename to lib/resolve/createResolver.js index 72b53d42..cede181a 100644 --- a/lib/core/createPackage.js +++ b/lib/resolve/createResolver.js @@ -1,7 +1,11 @@ var Q = require('Q'); -var packages = require('./packages'); +var GitFsResolver = require('./resolvers/GitFsResolver'); +var GitRemoteResolver = require('./resolvers/GitRemoteResolver'); +var LocalResolver = require('./resolvers/LocalResolver'); +var UrlResolver = require('./resolvers/UrlResolver'); +var GitFsResolver = require('./resolvers/GitFsResolver'); -function createPackage(endpoint, options) { +function createResolver(endpoint, options) { var split = endpoint.split('#'), range; diff --git a/lib/resolve/resolvers/FsResolver.js b/lib/resolve/resolvers/FsResolver.js new file mode 100644 index 00000000..e69de29b diff --git a/lib/core/packages/GitFsPackage.js b/lib/resolve/resolvers/GitFsResolver.js similarity index 100% rename from lib/core/packages/GitFsPackage.js rename to lib/resolve/resolvers/GitFsResolver.js diff --git a/lib/resolve/resolvers/GitRemoteResolver.js b/lib/resolve/resolvers/GitRemoteResolver.js new file mode 100644 index 00000000..799fd859 --- /dev/null +++ b/lib/resolve/resolvers/GitRemoteResolver.js @@ -0,0 +1,200 @@ +var util = require('util'); +var Q = require('q'); +var semver = require('semver'); +var mout = require('mout'); +var Resolver = require('./Resolver'); +var cmd = require('../../util/cmd'); +var createError = require('../../util/createError'); + +var GitRemoteResolver = function (source, options) { + Resolver.call(this, source, options); +}; + +util.inherits(GitRemoteResolver, Resolver); + +// ----------------- + +GitRemoteResolver.prototype.hasNew = function (oldTarget, oldResolution) { + return this._resolveTarget(this._target) + .then(function (resolution) { + // Resolution types are different + if (oldResolution.type !== resolution.type) { + return true; + } + + // If resolved to a tag + // There is new content if the tags are not equal + if (resolution.type === 'tag') { + return semver.neq(resolution.tag, oldResolution.tag); + } + + + // If resolved to a commit hash, just check if they are different + // Use the same strategy if it the resolution is to a branch + return resolution.commit !== oldResolution.commit; + }); +}; + +GitRemoteResolver.prototype._resolveSelf = function () { + var promise; + + promise = this._resolveTarget() + .then(this._checkout.bind(this)); + + return promise; +}; + +GitRemoteResolver.prototype._resolveTarget = function () { + var target = this._target, + source = this._source, + promise, + branches, + errorMessage, + errorDetails; + + // Target is a range/version + if (semver.valid(target) || semver.validRange(target)) { + return GitRemoteResolver._fetchVersions(this._source) + .then(function (versions) { + // Find the highest one that satifies the target + var version = mout.array.find(versions, function (version) { + return semver.satisfies(version, target); + }); + + if (!version) { + errorMessage = !semver.validRange(target) ? + 'Tag "' + target + '" does not exist' : + 'No tag found that was able to satisfy "' + target + '"'; + errorDetails = !versions.length ? + 'No tags found in "' + source + '"' : + 'Available tags in "' + source + '" are: ' + versions.join(', '); + throw createError(errorMessage, 'ENORESTARGET', errorDetails); + } + + return { type: 'tag', tag: version }; + }); + } + + // Resolve the rest to a commit version + promise = GitRemoteResolver._fetchHeads(this._source); + + // Target is a commit, so it's a stale target (not a moving target) + // There's nothing to do in this case + if ((/^[a-f0-9]{40}$/).test(target)) { + return Q.resolve({ type: 'commit', commit: target }); + } + + // If target is *, use master branch + if (target === '*') { + target = 'master'; + } + + // Target is a branch + return promise.then(function (heads) { + if (!heads[target]) { + branches = Object.keys(heads); + errorDetails = !branches.length ? + 'No branches found in "' + source + '"' : + 'Available branches in "' + source + '" are ' + branches.join(', '); + + throw createError('Branch "' + target + '" does not exist', 'ENORESTARGET', errorDetails); + } + + return { type: 'branch', branch: target, commit: heads[target] }; + }); +}; + +GitRemoteResolver.prototype._checkout = function (resolution) { + var dir = this._tempDir, + branch; + + console.log(resolution); + if (resolution.type === 'commit') { + return Q.nfcall(cmd, 'git', ['clone', this._source, dir]) + .then(function () { + return Q.nfcall(cmd, 'git', ['checkout', resolution.commit], { cwd: dir }); + }); + } else { + branch = resolution.tag || resolution.branch; + return Q.nfcall(cmd, 'git', ['clone', this._source, '-b', branch, '--depth', 1], { cwd: dir }); + } +}; + +// ------------------------------ + +GitRemoteResolver._fetchRefs = function (source) { + if (this._refs && this._refs[source]) { + return Q.resolve(this._refs[source]); + } + + return Q.nfcall(cmd, 'git', ['ls-remote', '--tags', '--heads', source]) + .then(function (stdout) { + // Make them an array + var refs = stdout.toString().split('\n'); + + this._refs = this._refs || {}; + return this._refs[source] = refs; + }.bind(this)); +}; + +GitRemoteResolver._fetchVersions = function (source) { + if (this._versions && this._versions[source]) { + return Q.resolve(this._versions[source]); + } + + return this._fetchRefs(source) + .then(function (refs) { + var versions = []; + + // Parse each ref line, extracting the tag + refs.forEach(function (line) { + var match = line.match(/^[a-f0-9]{40}\s+refs\/tags\/(\S+)$/), + cleaned; + + // Ensure it's valid + if (match) { + cleaned = semver.clean(match[1]); + if (cleaned) { + versions.push(cleaned); + } + } + }); + + // Sort them by desc order + versions = versions.sort(function (a, b) { + return semver.gt(a, b) ? -1 : 1; + }); + + this._versions = this._versions || {}; + return this._versions[source] = versions; + }.bind(this)); +}; + +GitRemoteResolver._fetchHeads = function (source) { + if (this._heads && this._heads[source]) { + return Q.resolve(this._heads[source]); + } + + // Request heads of the source of only the specified branch + return this._fetchRefs(source) + .then(function (refs) { + this._heads = this._heads || {}; + var heads = this._heads[source] = this._heads[source] || {}; + + // Foreach line in the refs, extract only the heads + // Organize them in an object where keys are branches and values + // the commit hash + mout.array.forEach(refs, function (line) { + var match = line.match(/^([a-f0-9]{40})\s+refs\/heads\/(\S+)$/); + + if (match) { + heads[match[2]] = match[1]; + } + }); + + + return heads; + }.bind(this)); +}; + +module.exports = GitRemoteResolver; diff --git a/lib/resolve/resolvers/Resolver.js b/lib/resolve/resolvers/Resolver.js new file mode 100644 index 00000000..2cc62bf2 --- /dev/null +++ b/lib/resolve/resolvers/Resolver.js @@ -0,0 +1,138 @@ +var util = require('util'); +var fs = require('fs'); +var path = require('path'); +var events = require('events'); +var Q = require('q'); +var tmp = require('tmp'); +var config = require('../../config'); +var createError = require('../../util/createError'); + +var Resolver = function (source, options) { + options = options || {}; + + this._source = source; + this._target = options.target || '*'; + this._name = options.name; + this._guessedName = !this.name; + this._config = options.config || config; +}; + +util.inherits(Resolver, events.EventEmitter); + +// ----------------- + +Resolver.prototype.getSource = function () { + return this._name; +}; + +Resolver.prototype.getTarget = function () { + return this._target; +}; + +Resolver.prototype.getTempDir = function () { + return this._tempDir; +}; + +Resolver.prototype.resolve = function () { + // 1nd - Create temporary dir + return this._createTempDir() + // 2nd - Resolve self + .then(this._resolveSelf.bind(this)) + // 3th - Read json + .then(this._readJson.bind(this)) + // 4th - Parse json + .then(this._parseJson.bind(this)); +}; + +Resolver.prototype.isCacheable = function () { + return false; +}; + +Resolver.prototype.getDependencies = function () { + return this._json.dependencies; +}; + +// ----------------- + +Resolver.prototype.hasNew = function (oldTarget, oldResolution) { + return true; +}; + +Resolver.prototype._resolveSelf = function () {}; + +// ----------------- + +Resolver.prototype._createTempDir = function () { + return Q.nfcall(tmp.dir, { + prefix: 'bower-' + this._name + '-', // TODO: add a bower folder as the prefix + mode: parseInt('0777', 8) & (~process.umask()), + unsafeCleanup: true + }) + .then(function (dir) { + this._tempDir = dir; + return dir; + }.bind(this)); +}; + +Resolver.prototype._readJson = function () { + var jsonFile; + + // Try bower.json + jsonFile = path.join(this.getTempDir(), 'bower.json'); + return Q.nfcall(fs.readFile, jsonFile) + // Try component.json + .then(null, function (err) { + if (err.code !== 'ENOENT') { + throw err; + } + + jsonFile = path.join(this.getTempDir(), 'component.json'); + return Q.nfcall(fs.readFile, jsonFile) + // Issue a deprecation message if it exists + .then(function (contents) { + this.emit('warn', 'Package "' + this.name + '" is using the deprecated component.json file'); + return contents; + }.bind(this)); + }.bind(this)) + // If we got the file contents, validate them + .then(function (contents) { + // TODO: change the validation to a separate module in the bower organization + try { + this._json = JSON.parse(contents); + return this._json; + } catch (e) { + throw createError('Unable to parse "' + jsonFile + '" file', e.code, { + details: e.message + }); + } + // Otherwise there was an error + }.bind(this), function (err) { + // If no json file was found, return one just with the name + if (err.code === 'ENOENT') { + this._json = { name: this.name }; + return this._json; + } + + // If we got here, the error code is something else so we re-throw it + throw err; + }.bind(this)); +}; + +Resolver.prototype._parseJson = function () { + // Check if name defined in the json is different + // If so and if the name was "guessed", assume the json name + if (this._guessedName && this._json.name !== this.name) { + this.name = this._json.name; + this.emit('name_change', this.name); + } + + this._json.dependencies = this._json.dependencies || {}; + + // Handle ignore property, deleting all files from the temporary directory + return Q.fcall(function () { + // Delete all the files specified in the ignore from the temporary directory + // TODO: + }.bind(this)); +}; + +module.exports = Resolver; \ No newline at end of file diff --git a/lib/core/packages/UrlPackage.js b/lib/resolve/resolvers/UrlResolver.js similarity index 100% rename from lib/core/packages/UrlPackage.js rename to lib/resolve/resolvers/UrlResolver.js diff --git a/lib/util/cmd.js b/lib/util/cmd.js new file mode 100644 index 00000000..77c20eb7 --- /dev/null +++ b/lib/util/cmd.js @@ -0,0 +1,52 @@ +var cp = require('child_process'); +var createError = require('./createError'); + +// Executes a shell command + +// TODO: I think we need to use spawn because it escapes args + +module.exports = function (command, args, options, callback) { + var process, + stderr = '', + stdout = ''; + + if (!callback) { + callback = options || args; + } + + process = cp.spawn(command, args, options); + + process.stdout.on('data', function (data) { + stdout += data.toString(); + }); + + process.stderr.on('data', function (data) { + stderr += data.toString(); + }); + + process.on('exit', function (code) { + var fullCommand, + error; + + process.removeAllListeners(); + + if (code) { + // Generate the full command to be presented in the error message + if (!Array.isArray(args)) { + args = []; + } + + fullCommand = command; + fullCommand += args.length ? ' ' + args.join(' ') : ''; + + // Build the error instance + error = createError('Failed to execute "' + fullCommand + '", exit code of #' + code, 'ECMDERR'); + error.details = stderr; + error.exitCode = code; + + return callback(error); + } + + return callback(null, stdout, stderr); + }); +}; \ No newline at end of file diff --git a/package.json b/package.json index 6f6b37ba..d7901230 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,8 @@ "tmp": "0.0.16", "rc": "~0.1.0", "mkdirp": "~0.3.5", - "nopt": "~2.1.1" + "nopt": "~2.1.1", + "semver": "~1.1.4" }, "devDependencies": { "mocha": "~1.8.2", diff --git a/test/test.js b/test/test.js index f67a241d..9140e657 100644 --- a/test/test.js +++ b/test/test.js @@ -1,21 +1,14 @@ -var UrlPackage = require('../lib/core/packages/UrlPackage'); -var GitRemotePackage = require('../lib/core/packages/GitRemotePackage'); +var GitResolver = require('../lib/resolve/resolvers/GitRemoteResolver'); -function testUrlPackage() { - var bootstrapPackage = new UrlPackage('http://twitter.github.com/bootstrap/assets/bootstrap.zip', { name: 'bootstrap' }); - - return bootstrapPackage.resolve() - .then(function () { - console.log('ok!'); - }, function (err) { - console.log('failed to resolve', err); +function testGitResolver() { + var dejavuResolver = new GitResolver('git://github.com/IndigoUnited/dejavu.git', { + name: 'dejavu', + //target: '962be0f7b779b061eccce6a661928cb719031964' + //target: 'master' + target: '~0.4.1' }); -} -function testGitRemotePackage() { - var dejavuPackage = new GitRemotePackage('git://github.com/IndigoUnited/dejavu.git', { name: 'bootstrap' }); - - return dejavuPackage.resolve() + return dejavuResolver.resolve() .then(function () { console.log('ok!'); }, function (err) { @@ -24,6 +17,5 @@ function testGitRemotePackage() { } if (process.argv[1] && !/mocha/.test(process.argv[1])) { - testUrlPackage() - .then(testGitRemotePackage); + testGitResolver(); } \ No newline at end of file