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.1-beta to 0.0.2-beta

23

lib/punch.js

@@ -27,3 +27,2 @@ var fs = require("fs");

//TODO: add tests
rendererFor: function(content_type){

@@ -34,3 +33,2 @@ var self = this;

//TODO: add tests
parserFor: function(content_type){

@@ -263,14 +261,17 @@ var self = this;

if(err || !stats.isDirectory()){
fs.mkdir(current_output_dir, function(err){
if(!err){
console.log("Created " + current_output_dir + " directory");
try {
fs.mkdirSync(current_output_dir);
console.log("Created " + current_output_dir + " directory");
}
catch(e) {
if(e.code === "EEXIST"){
proceedToNextOrCallback();
}
});
} else {
proceedToNextOrCallback();
}
};
}
}
proceedToNextOrCallback();
});
}
};

@@ -277,0 +278,0 @@ createOutputDirs("", output_dirs, function(){

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

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

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

# Punch
### Generate static sites with Mustache templates & JSON
### Easy way to generate static sites with Mustache templates & JSON

@@ -11,10 +11,19 @@ NOTE: I will update the README with more elaborative details and examples.

http://nodejs.org/#download
http://nodejs.org/#download
* Install `npm`
curl http://npmjs.org/install.sh | sh
`curl http://npmjs.org/install.sh | sh`
* Then run `npm intall punch`
Usage
-----
Go inside your site's directory and then run `punch` to generate the output.
If you got a `config.json` file inside the site's directory its configurations will be used to generate the site. Alternatively, you can provide a path to custom configuration file when running punch (eg. `punch path/to/config`)
If no configuration found, `punch` will use the default configurations. According to default configurations, you expect to have `templates` and `contents` directories and output will be written to `public` directory.
Sample

@@ -21,0 +30,0 @@ ------

@@ -21,2 +21,16 @@ var util = require("util");

describe("returning an instance of renderer", function(){
var fake_renderer = jasmine.createSpy();
punch.registeredRenderers["sample"] = fake_renderer;
expect(punch.rendererFor("sample") instanceof fake_renderer).toBeTruthy();
});
describe("returning an instance of parser", function(){
var fake_parser = jasmine.createSpy();
punch.registeredParsers["sample"] = fake_parser;
expect(punch.parserFor("sample") instanceof fake_parser).toBeTruthy();
});
describe("traversing templates", function() {

@@ -253,5 +267,3 @@

spyOn(fs, "writeFile");
spyOn(fs, "mkdir").andCallFake(function(path, callback){
callback(null);
});
spyOn(fs, "mkdirSync");

@@ -262,3 +274,3 @@ punch.fetchAndRender("templates/sub/simple.mustache", config);

expect(fs.mkdir.callCount).toEqual(2);
expect(fs.mkdirSync.callCount).toEqual(2);

@@ -265,0 +277,0 @@ });

Sorry, the diff of this file is not supported yet

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