Skip to content

Instantly share code, notes, and snippets.

@tal
Created November 10, 2011 16:59
Show Gist options
  • Select an option

  • Save tal/1355400 to your computer and use it in GitHub Desktop.

Select an option

Save tal/1355400 to your computer and use it in GitHub Desktop.
#!/usr/bin/env coffee
optparse = require('./optparse')
console.log module
fi = require('findit')
path = require('path')
util = require('util')
cp = require('child_process')
DEFAULT_PATH = './public/javascripts'
BANNER = "Usage: woody [options] path/to/javascripts\n\nIf called without options, `woody` will default to #{DEFAULT_PATH}"
SWITCHES = [['--verbose', 'say what yo\' doin'],['-v','--version','version']]
opts = null
parseOptions = ->
optionParser = new optparse.OptionParser(SWITCHES,BANNER)
o = opts = optionParser.parse(process.argv.slice(2))
o.path = path.resolve(o.arguments[0]||DEFAULT_PATH)
o
updateAssets = ->
cmd = "npm --registry=http://jsregistry.qa.ec2.gilt.com/registry/_design/app/_rewrite --dev install"
exec = (cmd,cb) ->
cp.exec cmd, ->
console.log("++ #{cmd}") if opts.verbose
cb?(arguments...)
console.log(parseOptions())
console.log(process)
if opts.version
console.log('0.0.0')
process.exit()
$ lib/woodchipper/command.coffee
# => Works!!!
$ npm link
$ woody
Error: Cannot find module 'findit'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/Users/tatlas/Projects/woodchipper/lib/woodchipper/command.coffee:8:8)
at Object.<anonymous> (/Users/tatlas/Projects/woodchipper/lib/woodchipper/command.coffee:53:4)
at Module._compile (module.js:432:26)
at Object.run (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:66:25)
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:147:29
at /usr/local/lib/node_modules/coffee-script/lib/coffee-script/command.js:115:19
[email protected] /Users/tatlas/Projects/woodchipper
├── [email protected]
└─┬ [email protected]
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└── [email protected]
{
"name": "woodchipper",
"author": {
"name": "Tal Atlas",
"email": "[email protected]",
"url": "http://tal.by/"
},
"version": "0.0.1",
"bin": {
"woody": "./lib/woodchipper/command.coffee"
},
"directories" : {
"lib" : "./lib/woodchipper"
},
"dependencies": {
"coffee-script": "*",
"findit": "*"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment