Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.4-beta to 0.0.5-beta

26

lib/punch.js

@@ -327,2 +327,19 @@ var fs = require("fs");

prepareOutputDirectory: function(config){
var self = this;
// Check whether the output directory exists
fs.stat(config.output_dir, function(err, stats){
if(err || !stats.isDirectory()){
// Create the output directory
fs.mkdirSync(config.output_dir);
}
// traverse templates
self.traverseTemplates(config);
});
},
generate: function(supplied_config){

@@ -360,10 +377,7 @@

// Create the output directory
fs.mkdirSync(config.output_dir);
// traverse templates
self.traverseTemplates(config);
// prepare output directory
self.prepareOutputDirectory(config);
}
}

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

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

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

@@ -35,2 +35,53 @@ var util = require("util");

describe("prepare output directory", function(){
it("creates the output directory if it doesn't exist", function(){
var config = {"template_dir": "templates"};
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return false }} );
});
spyOn(punch, "traverseTemplates");
spyOn(fs, "mkdirSync");
punch.prepareOutputDirectory(config);
expect(fs.mkdirSync).toHaveBeenCalled();
});
it("will not create the output directory if it exists", function(){
var config = {"template_dir": "templates"};
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(punch, "traverseTemplates");
spyOn(fs, "mkdirSync");
punch.prepareOutputDirectory(config);
expect(fs.mkdirSync).not.toHaveBeenCalled();
});
it("it calls to traverse templates", function(){
var config = {"template_dir": "templates"};
spyOn(fs, 'stat').andCallFake(function(path, callback){
callback(null, {isDirectory: function(){ return true }} );
});
spyOn(punch, "traverseTemplates");
punch.prepareOutputDirectory(config);
expect(punch.traverseTemplates).toHaveBeenCalledWith(config);
});
});
describe("traversing templates", function() {

@@ -37,0 +88,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