Working "bin" script, and fix path for use from other modules

pull/9/head
rprieto 10 years ago
parent d82de1bbda
commit ddcf0c48aa

@ -0,0 +1,19 @@
#!/usr/bin/env node
var program = require('commander');
var index = require('../src/index');
program
.version('0.0.1')
.option('-i, --input [path]', 'Path to the folder with all photos/videos')
.option('-o, --output [path]', 'Output path for the static website')
.option('-p, --media-prefix [url]', 'URL prefix for all media')
.option('-s, --size [pixels]', 'Thumbnail size in pixels (square)', '100')
.parse(process.argv);
index.build({
input: program.input,
output: program.output,
mediaPrefix: program.prefix,
size: program.size
});

@ -18,7 +18,7 @@
"example": "node example/build.js"
},
"bin": {
"static-gallery": "./bin/generate.js"
"thumbsup": "./bin/thumbsup.js"
},
"dependencies": {
"gulp": "~3.6.0",
@ -31,6 +31,7 @@
"fs-extra": "~0.8.1",
"gulp-rename": "~1.2.0",
"exec-sync": "~0.1.6",
"gm": "~1.14.2"
"gm": "~1.14.2",
"commander": "~2.2.0"
}
}

@ -68,7 +68,7 @@ exports.build = function(opts) {
gulp.task('public', function() {
var dest = opts.output + '/public';
gulp
.src('public/**')
.src(path.join(__dirname, '..', 'public', '**'))
.pipe(newer(dest))
.pipe(gulp.dest(dest));
});

@ -3,7 +3,7 @@ var path = require('path');
var handlebars = require('handlebars');
function compileTemplate(hbsFile) {
var src = fs.readFileSync(path.join('templates', hbsFile));
var src = fs.readFileSync(path.join(__dirname, '..', 'templates', hbsFile));
return handlebars.compile(src.toString());
}

Loading…
Cancel
Save