Permalink
Browse files

added Jakefile with generate command to create a skeleton bogart appl…

…ication
  • Loading branch information...
1 parent 830fe7b commit cfa5959c2ce05d96a23a28277cadae378b3900fd @nrstott committed Nov 1, 2010
Showing with 42 additions and 0 deletions.
  1. +17 −0 Jakefile
  2. +13 −0 cli/templates/app.js.template
  3. +12 −0 cli/templates/package.json.template
View
@@ -0,0 +1,17 @@
+var sys = require("sys");
+
+desc("generate a new bogart application skeleton");
+task("generate", [], function(dir, name) {
+ console.log("generating bogart app in " + dir);
+ var fs = require("fs"),
+ path = require("path");
+
+ dir = dir || ".";
+
+ var appTemplate = fs.readFileSync(path.join(__dirname, "cli", "templates", "app.js.template"), 'utf8');
+ fs.mkdirSync(dir, 0777);
+ fs.writeFileSync(path.join(dir, "app.js"), appTemplate, 'utf8');
+
+ var packageJsonTemplate = fs.readFileSync(path.join(__dirname, "cli", "templates", "package.json.template"), 'utf8');
+ fs.writeFileSync(path.join(dir, "package.json"), packageJsonTemplate, 'utf8');
+});
@@ -0,0 +1,13 @@
+/**
+ * A bogart application skeleton
+ */
+
+var bogart = require("bogart");
+
+var homeRouter = bogart.router(function(get, post, put, del) {
+ get("/", function() {
+ return bogart.html("Hello World");
+ });
+});
+
+bogart.start(homeRouter);
@@ -0,0 +1,12 @@
+{
+ "author": "<Your Name>",
+ "email": "<Your Email>",
+ "version": "0.0.1",
+ "directories": {
+ "lib": "./lib"
+ },
+ "main": "./app.js",
+ dependencies: {
+ "bogart": ">=0.1.1"
+ }
+}

0 comments on commit cfa5959

Please sign in to comment.