Browse files

Merge branch 'release/0.0.2'

  • Loading branch information...
2 parents 5903412 + 74b9030 commit 9a78290fc920c4593e79d5080bb43ccc54a9df95 Rod Waldhoff committed Apr 23, 2012
Showing with 66 additions and 11 deletions.
  1. +1 −0 .gitignore
  2. +35 −7 Makefile
  3. +24 −0 bin/phony
  4. +0 −1 lib/phony-cli.coffee
  5. +0 −1 lib/phony.coffee
  6. +6 −2 package.json
View
1 .gitignore
@@ -4,4 +4,5 @@ test/*.js
docs/docco
docs/*.html
README.html
+module
View
42 Makefile
@@ -22,6 +22,8 @@ NPM_EXE ?= npm
PACKAGE_JSON ?= package.json
# where npm installs external modules
NODE_MODULES ?= node_modules
+# where to place the generated module
+MODULE_DIR ?= module
# ## node-jscoverage
@@ -71,20 +73,45 @@ RM_DASH_I ?= -f
# ## "Meta" Targets
# `.PHONY` - make targets that aren't actually files
-.PHONY: all clean help clean-node-modules fully-clean-node-modules build js clean-js
+.PHONY: all build-coffee clean clean-coverage clean-docco clean-docs clean-test-module-install clean-js clean-markdown clean-module clean-node-modules coffee.js coverage docco docs fully-clean-node-modules help js markdown module targets test test-module-install todo
+
+# `clean` - delete all generated files
+clean: clean-coverage clean-docco clean-docs clean-js clean-module clean-node-modules
# `all` - the default target
all: coverage docco
-# `clean` - delete all generated files
-clean: clean-node-modules clean-coffee-js clean-coverage clean-docco clean-markdown
-
# `help` - list targets.
help:
make -rpn | sed -n -e '/^$$/ { n ; /^[^ ]*:/p }' | egrep -v '^\.' | egrep --color '^[^ ]*:'
+# `targets` - list Makefile targets that are likely to be .PHONY targets
+targets:
+ grep -E "^[^ #.$$]+:( |$$)" Makefile | sort
+
# ## NPM targets
+# `module` - create an npm-publishable module directory
+module: js test docs coverage
+ mkdir -p $(MODULE_DIR)
+ cp -r lib $(MODULE_DIR)
+ cp -r test $(MODULE_DIR)
+ cp -r bin $(MODULE_DIR)
+ cp -r docs $(MODULE_DIR)
+ cp $(PACKAGE_JSON) $(MODULE_DIR)
+ cp README.* $(MODULE_DIR)
+ cp Makefile $(MODULE_DIR)
+
+test-module-install: clean-test-module-install module
+ mkdir ../testing-module-install; cd ../testing-module-install; npm install ../phony/module; node -e "require('assert').ok(require('phony').make_phony().name())"; cd ../phony; rm -r $(RM_DASH_I) ../testing-module-install
+
+clean-test-module-install:
+ rm -r $(RM_DASH_I) ../testing-module-install
+
+# `clean-module` - remove the `$(MODULE_DIR)`
+clean-module:
+ rm -r $(RM_DASH_I) $(MODULE_DIR)
+
# `$(NODE_MODULES)` - install node dependencies via npm
$(NODE_MODULES): $(PACKAGE_JSON)
$(NPM_EXE) prune
@@ -101,12 +128,12 @@ fully-clean-node-modules:
# ## Coffee/JS Targets
-# `build` - build everything we need to run under coffee
-build: $(NODE_MODULES)
+# `build-coffee` - build everything we need to run under coffee
+build-coffee: $(NODE_MODULES)
rm -r $(RM_DASH_I) $(LIB_COV)
# `js` - build everything we need to run under js/node
-js: $(COFFEE_JS)
+js: build-coffee $(COFFEE_JS)
# `.coffee.js` - compile coffee files into js files
.SUFFIXES: .js .coffee
@@ -169,6 +196,7 @@ markdown: $(MARKDOWN_HTML)
# `docco` - generate docco documentation from coffee sources
docco: $(COFFEE_SRCS) $(COFFEE_TEST_SRCS) $(NODE_MODULES)
+ rm -r $(RM_DASH_I) docs/docco
mkdir -p docs
mv docs docs-temporarily-renamed-so-docco-doesnt-clobber-it
docco $(COFFEE_SRCS) $(COFFEE_TEST_SRCS)
View
24 bin/phony
@@ -0,0 +1,24 @@
+#!/usr/bin/env node
+var path = require('path'),
+ fs = require('fs'),
+ util = require('util'),
+ events = require('events');
+
+var ext;
+try {
+ var coffee = require('coffee-script');
+ if (require.extensions) {
+ require.extensions['.coffee'] = function (module, filename) {
+ var content = coffee.compile(fs.readFileSync(filename, 'utf8'));
+ return module._compile(content, filename);
+ };
+ } else {
+ require.registerExtension('.coffee', function (content) { return coffee.compile(content) });
+ }
+ ext = /\.(js|coffee)$/;
+} catch (_) {
+ ext = /\.js$/;
+}
+
+require(__dirname + '/../lib/phony-cli');
+
View
1 lib/phony-cli.coffee
@@ -1,6 +1,5 @@
#---------------------------------------------------------------------
HOMEDIR = __dirname + "/.."
-IS_MOCHA = process.argv[1].indexOf("/_mocha") >= 0
IS_COFFEE = process.argv[0].indexOf("coffee") >= 0
IS_INSTRUMENTED = (require('path')).existsSync(HOMEDIR+'/lib-cov')
LIB_DIR = if IS_INSTRUMENTED then HOMEDIR+"/lib-cov" else HOMEDIR+"/lib"
View
1 lib/phony.coffee
@@ -1,6 +1,5 @@
#---------------------------------------------------------------------
HOMEDIR = __dirname + "/.."
-IS_MOCHA = process.argv[1].indexOf("/_mocha") >= 0
IS_COFFEE = process.argv[0].indexOf("coffee") >= 0
IS_INSTRUMENTED = (require('path')).existsSync(HOMEDIR+'/lib-cov')
LIB_DIR = if IS_INSTRUMENTED then HOMEDIR+"/lib-cov" else HOMEDIR+"/lib"
View
8 package.json
@@ -1,22 +1,26 @@
{
"name" : "phony" ,
- "version" : "0.0.1" ,
"description" : "A fake data generator.",
"keywords" : [ "fake", "phony", "data", "generator", "test", "testing", "mock", "person", "name", "email", "address" ],
"homepage" : "http://rodw.github.com/phony",
+ "repository" : {"type": "git", "url": "git://github.com/rodw/phony.git"},
"bugs" : "https://github.com/rodw/phony/issues",
"author" : "Rod Waldhoff (http://rodw.github.com/)",
+ "version" : "0.0.2" ,
+ "main" : "lib/phony.js",
+ "bin" : { "phony": "./bin/phony" },
"dependencies" : {
- "coffee-script" : "~1.2",
"optimist" : "latest"
},
"devDependencies" : {
+ "coffee-script" : "latest",
"expresso" : "latest",
"jscoverage" : "latest",
"mocha" : "latest",
"should" : "latest",
"docco" : "latest"
},
"scripts" : {
+ "test" : "make test"
}
}

0 comments on commit 9a78290

Please sign in to comment.