Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[refactor] Rename http to web. Cleaned up code.

  • Loading branch information...
commit b5125026d88f6091cc820fafd935b99f4b888f7f 1 parent aa4a113
@Marak authored
View
4 .gitignore
@@ -1 +1,3 @@
-.node_modules
+node_modules/
+.gitignore
+.DS_Store
View
1  config.json
@@ -0,0 +1 @@
+{"name":"my awesome app","port":8080,"host":"localhost"}
View
1  examples/config.json
@@ -0,0 +1 @@
+{"name":"my awesome app","port":8080,"host":"localhost"}
View
7 examples/helloworld/config/schema.json
@@ -1,18 +1,19 @@
{
+ "_resource": "app",
"properties": {
"name": {
- "description": "the name of your awesome new site",
+ "description": "the name of your awesome new node app",
"type": "string",
"default": "my awesome app",
"required": true
},
"port": {
- "description": "the port your application should listen on",
+ "description": "the port your node app should listen on",
"type": "number",
"default": 8080
},
"host": {
- "description": "the host your application should listen on",
+ "description": "the host your node app should listen on",
"type": "any",
"default": "localhost"
}
View
33 examples/helloworld/form-installer.js
@@ -0,0 +1,33 @@
+var wizard = require('../../lib/wizard'),
+ fs = require('fs');
+
+//
+// Load schema object from config.schema file ( regular JSON-schema)
+//
+var schema = wizard.load('./config/schema.json');
+
+//
+// Run the CLI configuration wizard
+//
+wizard.web.run(schema, function(err, results){
+
+ if(err){
+ console.log(err);
+ }
+
+ //
+ // After the wizard completes, write the results to the config.json file
+ //
+
+ fs.writeFileSync('./config.json', JSON.stringify(results));
+
+ //
+ // Now that the app is configured, see if user wants to start it!
+ //
+
+ //
+ // TODO: Cli prompt for starting
+ //
+
+});
+
View
6 lib/wizard.js
@@ -1,10 +1,8 @@
var wizard = exports,
fs = require('fs');
-
-wizard.cli = require('./wizard/cli');
-wizard.http = require('./wizard/http');
-
+wizard.cli = require('./wizard/cli');
+wizard.web = require('./wizard/web');
//
// Simple wrapper for loading JSON-schema files from a path
View
7 lib/wizard/http.js
@@ -1,7 +0,0 @@
-var http = exports;
-
-http.run = function (schema, callback) {
-
- // TODO
-
-};
View
7 lib/wizard/web.js
@@ -0,0 +1,7 @@
+var web = exports;
+
+web.run = function (schema, callback) {
+
+ // TODO
+
+};
View
4 package.json
@@ -2,9 +2,9 @@
"author": "marak <marak.squires@gmail.com>",
"name": "wizard",
"version": "0.0.0",
+ "main": "./lib/wizard",
"dependencies": {
- "prompt": "*",
- "nconf": "*"
+ "prompt": "*"
},
"devDependencies": {},
"optionalDependencies": {},
Please sign in to comment.
Something went wrong with that request. Please try again.