This repository has been archived by the owner on Aug 19, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a2d60c4
commit db17b1b
Showing
20 changed files
with
285 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,14 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# Deployed apps should consider commenting this line out: | ||
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git | ||
node_modules | ||
test/tmp | ||
tmp | ||
public | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
NODE_LOCAL_BIN=./node_modules/.bin | ||
|
||
test: | ||
@${NODE_LOCAL_BIN}/mocha --reporter spec test/specs/**/*.js | ||
|
||
.PHONY: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Description: | ||
Creates a new project. | ||
|
||
Example: | ||
yo metalpages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
install: | ||
@npm install | ||
@bower install | ||
|
||
clean: | ||
@rm -rf build public | ||
|
||
build: clean | ||
@gulp build | ||
|
||
serve: build | ||
@gulp | ||
|
||
publish: | ||
@gulp deploy | ||
|
||
.PHONY: install clean build serve publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
## <%= appname %> | ||
|
||
### Installation | ||
|
||
``` | ||
$ make install | ||
$ make serve | ||
$ open http://localhost:3000 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "<%= _.slugify(appname) %>", | ||
"version": "0.0.0", | ||
"private": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"name": "<%= _.slugify(appname) %>", | ||
"version": "0.0.0", | ||
"private": true, | ||
"engines": { | ||
"node": ">=0.10.0" | ||
}, | ||
"devDependencies": { | ||
"express": "^4.4.3", | ||
"gulp": "^3.8.1", | ||
"gulp-concat": "^2.2.0", | ||
"gulp-gh-pages": "^0.3.2", | ||
"gulp-jsonlint": "0.0.3", | ||
"gulp-minify-css": "^0.3.5", | ||
"metalsmith": "^0.8.0", | ||
"metalsmith-markdown": "^0.2.1", | ||
"metalsmith-metadata": "0.0.1", | ||
"metalsmith-templates": "^0.5.1", | ||
"swig": "^1.3.2" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
var Metalsmith = require('metalsmith'); | ||
var metadata = require('metalsmith-metadata'); | ||
var templates = require('metalsmith-templates'); | ||
var markdown = require('metalsmith-markdown'); | ||
|
||
module.exports = build; | ||
|
||
var m = new Metalsmith(__dirname); | ||
|
||
m.destination('./public'); | ||
m.use(metadata({metadata: 'metadata.json'})); | ||
m.use(markdown({smartypants: true, gfm: true, tables: true})); | ||
m.use(templates({engine: 'swig', directory: 'templates'})); | ||
|
||
function build(done) { | ||
m.build(function(err) { | ||
if (err) return done(err); | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.DS_Store | ||
node_modules | ||
bower_components | ||
build | ||
public |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
var express = require('express'); | ||
var gulp = require('gulp'); | ||
var concat = require('gulp-concat'); | ||
var minify = require('gulp-minify-css'); | ||
var jsonlint = require("gulp-jsonlint"); | ||
var deploy = require('gulp-gh-pages'); | ||
var swig = require('swig'); | ||
var build = require('./build'); | ||
|
||
gulp.task('css', function() { | ||
return gulp.src([ | ||
'static/css/**/*.css' | ||
]) | ||
.pipe(concat('bundle.css')) | ||
.pipe(minify()) | ||
.pipe(gulp.dest('build')); | ||
}); | ||
|
||
gulp.task('images', function() { | ||
return gulp.src(['static/images/**/*']) | ||
.pipe(gulp.dest('build')); | ||
}); | ||
|
||
gulp.task('lint:json', function() { | ||
return gulp.src([ | ||
'src/**/*.json' | ||
]) | ||
.pipe(jsonlint()) | ||
.pipe(jsonlint.reporter()); | ||
}); | ||
|
||
gulp.task('build:metalsmith', ['lint:json'], function(done) { | ||
build(function(err){ | ||
if (err) return err; | ||
console.log('Metalsmith building... Done.'); | ||
done(); | ||
}); | ||
}); | ||
|
||
gulp.task('build', ['build:metalsmith', 'css', 'images'], function() { | ||
return gulp.src(['build/**/*']) | ||
.pipe(gulp.dest('public')); | ||
}); | ||
|
||
gulp.task('deploy', ['build'], function() { | ||
return gulp.src('./public/**/*') | ||
.pipe(deploy()); | ||
}); | ||
|
||
gulp.task('serve', ['watch', 'build'], function() { | ||
var port = process.env.NODE_PORT || 3000; | ||
var app = express(); | ||
app.set('view cache', false); | ||
swig.setDefaults({cache: false}); | ||
app.use(express.static(path.join(__dirname, 'public'))); | ||
app.listen(port); | ||
console.log('Server running on localhost:%d...', port); | ||
}); | ||
|
||
gulp.task('watch', function() { | ||
gulp.watch([ | ||
'static/**/*', | ||
'src/**/*', | ||
'templates/**/*' | ||
], ['build']); | ||
}); | ||
|
||
gulp.task('default', ['serve']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
template: index.html | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"hello": "Hello, you!" | ||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block content %} | ||
<h1><%= appname %></h1> | ||
<p>{{ metadata.hello }}</p> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title><%= appname %></title> | ||
<link rel="stylesheet" href="bundle.css"> | ||
</head> | ||
<body> | ||
<div id="content"> | ||
<div class="container"> | ||
{% block content %} | ||
{% endblock %} | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
'use strict'; | ||
|
||
var path = require('path'); | ||
|
||
var config = module.exports = {}; | ||
|
||
config.testDirectory = path.join(__dirname, 'tmp'); | ||
config.appPath = path.join(__dirname, '..', 'app'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/*jshint expr: true*/ | ||
/*global describe, beforeEach, it*/ | ||
'use strict'; | ||
|
||
var generator = require('yeoman-generator'); | ||
var helpers = generator.test; | ||
var assert = generator.assert; | ||
var config = require('../config'); | ||
|
||
describe('base', function() { | ||
|
||
beforeEach(function(done) { | ||
helpers.testDirectory(config.testDirectory, function(err) { | ||
if (err) return done(err); | ||
this.app = helpers.createGenerator('metalpages', [config.appPath]); | ||
this.app.options['skip-install'] = true; | ||
done(); | ||
}.bind(this)); | ||
}); | ||
|
||
it('should properly setup project', function(done) { | ||
helpers.mockPrompt(this.app, this.prompts); | ||
var expected = [ | ||
'src/metadata.json', | ||
'src/index.md', | ||
'static/css/index.css', | ||
'static/images', | ||
'templates/layout.html', | ||
'templates/index.html', | ||
'.editorconfig', | ||
'.gitignore', | ||
'bower.json', | ||
'package.json', | ||
'build.js', | ||
'gulpfile.js', | ||
'Makefile', | ||
'README.md' | ||
]; | ||
this.app.run({}, function() { | ||
assert.file(expected); | ||
done(); | ||
}); | ||
}); | ||
|
||
it('should properly setup app name in all templates', function(done) { | ||
helpers.mockPrompt(this.app, this.prompts); | ||
var files = [ | ||
'bower.json', | ||
'package.json', | ||
'README.md', | ||
'templates/layout.html', | ||
'templates/index.html' | ||
]; | ||
this.app.run({}, function() { | ||
files.forEach(function(file) { | ||
assert.fileContent(file, /tmp/); | ||
}); | ||
done(); | ||
}); | ||
}); | ||
|
||
}); |