Skip to content
Browse files

Move remaining Makefile tasks into the Jakefile.

  • Loading branch information...
1 parent ecce20a commit f2c42147383d6c64039b87ae3a2037598924f286 @reid reid committed Feb 7, 2014
Showing with 50 additions and 43 deletions.
  1. +40 −23 Jakefile.js
  2. +10 −20 Makefile
View
63 Jakefile.js
@@ -10,8 +10,8 @@ var walkdir = require("walkdir");
var version = require("./lib/package-metadata").readPackageSync().version;
-function nuke(dir, completer) {
- rimraf(dir, function (err) {
+function nuke(f, completer) {
+ rimraf(f, function (err) {
if (err) {
fail(err);
} else if ("function" === typeof completer) {
@@ -107,15 +107,6 @@ task("test-unit", function () {
desc("Run all of Yeti's tests");
task("test", ["test-functional", "test-unit"]);
-/*
-desc("Run all of Yeti's unit tests with the '--spec' flag");
-task("spec", ["dep"], function () {
- bin("vows", ["--spec"].concat(getTestFiles()), complete);
-}, {
- async: true
-});
-*/
-
desc("Report functional test coverage as HTML");
task("coverage-functional", function () {
spawn("bash", ["scripts/coverage.sh", "functional"], complete);
@@ -133,16 +124,26 @@ task("coverage-unit", function () {
desc("Report test coverage as HTML");
task("coverage", ["coverage-functional", "coverage-unit"]);
+function mustachify(inFile, outFile) {
+ var md, html, data, opts;
+ opts = {
+ encoding: "utf8"
+ };
+ data = fs.readFileSync(inFile, opts);
+ // Remove header
+ md = data.split("\n").slice(4).join("\n"),
+ html = new Ronn(md).html()
+ .replace(/<[\/]*html>/, "")
+ .replace("<pre>", '<pre class="code"');
+ fs.writeFileSync(outFile, html, opts);
+}
+
desc("Build HTML documentation");
task("html", function () {
- fs.readFile("README.md", "utf8", function (err, data) {
- var md, html;
- // Remove Travis info
- md = data.split("\n").slice(4).join("\n"),
- html = new Ronn(md).html()
- .replace(/<[\/]*html>/, "")
- .replace("<pre>", '<pre class="code"');
- fs.writeFileSync("doc/quick-start/index.mustache", html);
+ mustachify("README.md", "doc/quick-start/index.mustache");
+ mustachify("CONTRIBUTING.md", "doc/contribute/index.mustache");
+ spawn(process.argv[0], ["scripts/generate_selleck_project.js"], function (err) {
+ if (err) { return complete(err); }
bin("selleck", [], complete);
});
}, {
@@ -151,35 +152,51 @@ task("html", function () {
desc("Build API documentation");
task("html-api", ["html"], function () {
+ jake.mkdirP('build_docs/api/everything');
bin("yuidoc", ["--project-version", version], complete);
}, {
async: true
});
desc("Run JSLint on all files, or a specific given file");
task("lint", function () {
- getJsFiles("./lib", function (files) {
- bin("jshint", files, complete);
- });
+ bin("jshint", ["lib", "test"], complete);
}, {
async: true
});
desc("Remove build documentation");
task("clean", function () {
nuke("build_docs");
+ nuke("doc/yeti/project.json");
+ nuke("doc/quick-start/index.mustache");
+ nuke("doc/contribute/index.mustache");
});
+desc("Build website");
+task("site", ["clean", "html-api", "html", "coverage"]);
+
desc("Remove development tools");
task("maintainer-clean", function () {
spawn("rpm", ["rm", "webkit-devtools-agent"]);
nuke("tools");
});
-desc("Fetch external dependencies");
+desc("Fetch external dependencies for development");
task("dep", function () {
jake.mkdirP('dep/dev');
spawn(process.argv[0], ["./scripts/fetch_deps.js", "--dev"], complete);
}, {
async: true
});
+
+desc("Fetch external dependencies for release packaging");
+task("release-dep", function () {
+ nuke("dep", function (err) {
+ if (err) { return complete(err); }
+ jake.mkdirP('dep');
+ spawn(process.argv[0], ["./scripts/fetch_deps.js"], complete);
+ });
+}, {
+ async: true
+});
View
30 Makefile
@@ -13,7 +13,7 @@ test:
spec:
# Problem? Type `make install` first.
- ./node_modules/.bin/vows --spec test/*.js
+ ./jake test
.PHONY: spec
coverage:
@@ -23,43 +23,33 @@ coverage:
html:
# Problem? Type `make install` first.
- cat README.md | sed '1,4d' | \
- ./node_modules/.bin/ronn -5 | \
- sed -e 's/<[\/]*html>//g' -e 's/<pre>/<pre class="code">/g' \
- > doc/quick-start/index.mustache
- cat CONTRIBUTING.md | sed '1,4d' | \
- ./node_modules/.bin/ronn -5 | \
- sed -e 's/<[\/]*html>//g' -e 's/<pre>/<pre class="code">/g' \
- > doc/contribute/index.mustache
- node scripts/generate_selleck_project.js
- ./node_modules/.bin/selleck
+ ./jake html
.PHONY: html
html-api:
# Problem? Type `make install` first.
- mkdir -p build_docs/api/everything
- ./node_modules/.bin/yuidoc --project-version `node cli.js -v`
+ ./jake html-api
.PHONY: html-api
lint:
# Problem? Type `make install` first.
- find lib test -name "*.js" \! -name "*min.js" -print0 | xargs -0 ./go lint
+ ./jake lint
.PHONY: lint
site: clean html-api html coverage
.PHONY: site
release-dep:
- rm -rf dep
- node scripts/fetch_deps.js
+ # Problem? Type `make install` first.
+ ./jake release-dep
.PHONY: release-dep
clean:
- rm -rf build_docs
- rm doc/yeti/project.json
+ # Problem? Type `make install` first.
+ ./jake clean
.PHONY: clean
maintainer-clean:
- npm rm webkit-devtools-agent
- rm -rf tools
+ # Problem? Type `make install` first.
+ ./jake maintainer-clean
.PHONY: maintainer-clean

0 comments on commit f2c4214

Please sign in to comment.
Something went wrong with that request. Please try again.