Socket
Socket
Sign inDemoInstall

punch

Package Overview
Dependencies
Maintainers
1
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

punch - npm Package Compare versions

Comparing version 0.0.5-beta to 0.0.6-beta

8

lib/punch.js

@@ -305,3 +305,9 @@ var fs = require("fs");

output_path[0] = config.output_dir;
fs.mkdirSync(output_path.join("/"));
fs.stat(config.output_dir, function(err, stats){
if(err || !stats.isDirectory()){
// Create the output directory
fs.mkdirSync(output_path.join("/"));
}
});
}

@@ -308,0 +314,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

, "keywords": ["static", "sites", "mustache", "json", "markdown"]
, "version": "0.0.5-beta"
, "version": "0.0.6-beta"
, "homepage": "https://github.com/laktek/punch"

@@ -8,0 +8,0 @@ , "author": "Lakshan Perera <lakshan@web2media.net> (http://laktek.com)"

@@ -98,4 +98,7 @@ var util = require("util");

});
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(fs, 'mkdirSync');
spyOn(punch, "fetchAndRender");

@@ -112,2 +115,6 @@

spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return false }} );
});
spyOn(fs, 'mkdirSync');

@@ -130,2 +137,26 @@ spyOn(punch, "fetchAndRender");

it("will skip creating already existing sub-directories in the output path", function(){
var config = {"template_dir": "templates", "output_dir": "public"};
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(fs, 'mkdirSync');
spyOn(punch, "fetchAndRender");
spyOn(fs, 'readdir').andCallFake(function(path, callback){
if(fs.readdir.mostRecentCall.args[0] === "templates"){
callback(null, ["index.mustache", "sub_dir"]);
} else {
callback(null, ["sub.mustache"]);
}
});
punch.traverseTemplates(config);
expect(fs.mkdirSync).not.toHaveBeenCalled();
});
it("calls to render content when a template is found", function(){

@@ -142,3 +173,6 @@ var config = {"template_dir": "templates"};

spyOn(fs, 'mkdirSync');
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(punch, "fetchAndRender");

@@ -163,3 +197,6 @@

spyOn(fs, 'mkdirSync');
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(punch, "fetchAndRender");

@@ -185,3 +222,2 @@

spyOn(fs, 'mkdirSync');
spyOn(punch, "staticFileHandler");

@@ -195,3 +231,2 @@

});

@@ -198,0 +233,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