Showing with 22 additions and 39 deletions.
  1. +14 −34 lib/jitsu/package.js
  2. +8 −5 package.json
@@ -10,37 +10,17 @@ var fs = require('fs'),
existsSync = fs.existsSync || path.existsSync,
util = require('util'),
spawnCommand = require('spawn-command'),
zlib = require('zlib'),
async = require('flatiron').common.async,
analyzer = require('require-analyzer'),
npm = require('npm'),
npmout = require('npm/lib/utils/output'),
semver = require('semver'),
jitsu = require('../jitsu');
jitsu = require('../jitsu'),
fstream = require('fstream'),
fstreamNpm = require('fstream-npm'),
tar = require('tar');

var package = exports;

//
// Monkey patch `npmout.write()` so that we don't need log or out files
//
npmout.write = function () {
var args = Array.prototype.slice.call(arguments),
callback;

args.forEach(function (arg) {
if (typeof arg === 'function') {
callback = arg;
}
});

callback();
};

//
// Setup `npmtar` to be a lazy loaded variable that
// isn't setup until `npm.load` is invoked.
//
var npmtar;

//
// ### function get (dir, callback)
// #### @dir {string} Directory to get the package.json from
@@ -384,16 +364,16 @@ package.createTarball = function (dir, version, callback) {
var name = [jitsu.config.get('username'), pkg.name, version || pkg.version].join('-') + '.tgz',
tarball = path.join(jitsu.config.get('tmproot'), name);

npm.load({ exit: false }, function () {
//
// Lazy load `npmtar`, then use it to package
// the specified tarball.
//
npmtar = npmtar || require('npm/lib/utils/tar');
npmtar.pack(tarball, dir, pkg, true, function (err) {
return err ? callback(err) : callback(null, pkg, tarball);
fstreamNpm({ path: dir })
.on('error', callback)
.pipe(tar.Pack())
.on('error', callback)
.pipe(zlib.Gzip())
.on('error', callback)
.pipe(fstream.Writer({ type: "File", path: tarball }))
.on('close', function () {
callback(null, pkg, tarball);
});
});
});
};

@@ -21,19 +21,22 @@
"preferGlobal": true,
"dependencies": {
"colors": "0.6.0-1",
"complete": "0.3.1",
"dateformat": "1.0.2-1.2.3",
"flatiron": "0.2.5",
"flatiron-cli-config": "0.1.1",
"flatiron-cli-config": "0.1.3",
"flatiron-cli-users": "0.1.1",
"fstream": "0.1.18",
"fstream-npm": "0.1.0",
"npm": "1.1.16",
"nodejitsu-api": "0.3.0",
"pkginfo": "0.2.2",
"pkginfo": "0.2.3",
"request": "2.9.100",
"require-analyzer": "0.4.0-3",
"spawn-command": "0.0.1",
"semver": "1.0.13",
"complete": "0.3.x",
"wizard": "0.0.x",
"spawn-command": "0.0.x"
"tar": "0.1.13",
"wizard": "0.0.1"
},
"devDependencies": {
"nock": "0.8.x",