New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

heroku-source-deployer

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

heroku-source-deployer - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

README.md

5

package.json
{
"name": "heroku-source-deployer",
"version": "0.0.3",
"version": "0.0.4",
"description": "Deploys sources to Heroku",

@@ -39,3 +39,4 @@ "main": "plugin.js",

"mocha": "~2.3.3",
"mocha-spec-reporter-async": "~0.5.7"
"mocha-spec-reporter-async": "~0.5.7",
"tmp": "~0.0.28"
},

@@ -42,0 +43,0 @@ "scripts": {

4

plugin.js

@@ -43,3 +43,5 @@ 'use strict';

options.ignore = function(name) {
return gitignore.denies(name);
// name could be absolute but we need a relative name since .gitignore is relative
var relativeName = path.relative(dir, name);
return gitignore.denies(relativeName);
};

@@ -46,0 +48,0 @@ }

@@ -8,3 +8,5 @@ 'use strict';

var Promise = require('bluebird');
var fs = require('fs');
var path = require('path');
var herokuSourceDeployer = require('../');

@@ -29,8 +31,51 @@

it('dirToTarGz should create a tar.gz and apply the .gitignore', function() {
return assert.eventually.isBelow(herokuSourceDeployer.dirToTarGz('.').then(function(d) {return d.length;}), 5000000);
function dirToTarGzTest(dir) {
var tmp = require('tmp');
var tmpDir = tmp.dirSync().name;
var untgzPromise = herokuSourceDeployer.dirToTarGz(dir).then(function(data) {
return new Promise(function(resolve, reject) {
var zlib = require('zlib');
var tar = require('tar-fs');
var stream = require('stream');
var bufferStream = new stream.PassThrough();
bufferStream.end(data);
var write = bufferStream.pipe(zlib.createGunzip()).pipe(tar.extract(tmpDir));
write.on('error', reject);
write.on('finish', resolve);
});
});
var gitIgnoreCheckPromise = untgzPromise.then(function() {
return new Promise(function(resolve, reject) {
var nodeModulesExists = fs.existsSync(path.join(tmpDir, "node_modules", "tar-fs"));
var testAppIndexPhpExists = fs.existsSync(path.join(tmpDir, "test", "app", "index.php"));
if (!nodeModulesExists && testAppIndexPhpExists) {
resolve("The .gitignore was applied correctly");
}
else {
reject("The .gitignore was not applied correctly");
}
});
});
return assert.isFulfilled(gitIgnoreCheckPromise);
}
it('dirToTarGz should create a tar.gz from a relative path and apply the .gitignore', function() {
this.timeout(10000);
return dirToTarGzTest(".");
});
it('dirToTarGz should create a tar.gz from an absolute path and apply the .gitignore', function() {
this.timeout(10000);
return dirToTarGzTest(path.resolve("."));
});
it('deploy should fail when the dir does not exist', function() {
return assert.isRejected(herokuSourceDeployer.deployDir(apiToken, 'foo', 'foo'), /no such file or directory, stat 'foo'/);
return assert.isRejected(herokuSourceDeployer.deployDir(apiToken, 'foo', 'foo'), /stat 'foo'/);
});

@@ -37,0 +82,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc