Permalink
Browse files

working CLI shell

  • Loading branch information...
1 parent fbafeca commit baba052da67082b40b0f0d47e25103c55251ad0e @chrisfjones chrisfjones committed Dec 17, 2012
Showing with 198 additions and 0 deletions.
  1. +4 −0 .gitignore
  2. +6 −0 bin/starman
  3. +54 −0 lib/cli.js
  4. +20 −0 lib/starman.js
  5. +33 −0 package.json
  6. +69 −0 src/cli.iced
  7. +12 −0 src/starman.iced
View
@@ -12,3 +12,7 @@ logs
results
npm-debug.log
+
+*.iml
+.idea/
+node_modules/
View
@@ -0,0 +1,6 @@
+#!/usr/bin/env node
+var path = require('path');
+var fs = require('fs');
+var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
+
+require(lib + '/cli').run();
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,33 @@
+{
+ "name": "starman",
+ "version": "0.0.0",
+ "description": "A simple utility to build static websites using coffeecup templates, coffeescript, and scss.",
+ "main": "lib/cli.js",
+ "scripts": {
+ "test": ""
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/thebrigade/starman.git"
+ },
+ "keywords": [
+ "coffeekup",
+ "coffeecup",
+ "coffeescript",
+ "static",
+ "middleman"
+ ],
+ "dependencies": {
+ "coffee-script" : "1.4.0",
+ "coffeecup":"0.3.18",
+ "commander" : "1.1.1",
+ "connect":"2.7.0",
+ "underscore":"1.4.2",
+ "walk":"2.2.1",
+ "node-fs":"0.1.5",
+ "colors":"0.6.0-1"
+ },
+ "author": "Chris Jones <chris@thebriga.de>",
+ "license": "MIT",
+ "readmeFilename": "README.md"
+}
View
@@ -0,0 +1,69 @@
+program = require 'commander'
+colors = require 'colors'
+starman = require './starman'
+
+todoString = 'todo: '.blue
+
+program
+ .version('0.0.1')
+ .option('-v, --verbose', 'be chatty.')
+
+program
+ .command('init')
+ .description('Set up a new project with the appropriate directory structure. Run this within your new project\'s root directory.')
+ .action((options) ->
+ #todo: grab any options
+ starman.init()
+ )
+
+program
+ .command('build')
+ .description('Compile everything into the release directory.')
+ .action((options) ->
+ #todo: grab any options
+ starman.build()
+ )
+
+program
+ .command('watch')
+ .description('Keep watching for changes and then compile everything into the release directory.')
+ .action((options) ->
+ #todo: grab any options
+ starman.watch()
+ )
+
+program
+ .command('serve')
+ .description('Throw up a server on $port to serve up everything in the release directory.')
+ .option('-p, --port [port]', 'The port with which to serve upon. Default is 8080.', parseInt)
+ .on("--help", ->
+ console.log "#{todoString}display help about serve?"
+ ).action((options) ->
+ port = options.port or 8080
+ portString = "#{port}".green
+ console.log "serving on #{portString}"
+ starman.serve port
+ )
+
+program
+ .command('dev')
+ .description('Throw up a server, watch for changes, and open the site in the default browser. Great for speedy development.')
+ .option('-p, --port [port]', 'The port with which to serve upon. Default is 8080.', parseInt)
+ .on("--help", ->
+ console.log "todo: display help about dev?"
+ ).action((options) ->
+ port = options.port or 8080
+ portString = "#{port}".green
+
+ starman.build()
+
+ starman.watch()
+
+ starman.serve port
+
+ url = "http://localhost:#{port}"
+ console.log "#{todoString}open #{url}"
+ )
+
+module.exports.run = ->
+ program.parse process.argv
View
@@ -0,0 +1,12 @@
+module.exports.init = ->
+ console.log 'init'
+
+module.exports.build = ->
+ console.log 'build'
+
+module.exports.watch = ->
+ console.log 'watch'
+
+module.exports.serve = ->
+ console.log 'serve'
+

0 comments on commit baba052

Please sign in to comment.