Permalink
Browse files

Published on npm.

  • Loading branch information...
1 parent acffd0a commit 5846b7096bf01de4a7adca14515089f00a1f9682 @pguillory committed Feb 25, 2011
Showing with 73 additions and 63 deletions.
  1. +2 −2 README.md
  2. +22 −8 bin/node-cinch
  3. +22 −8 bin/node-cinch-save
  4. +5 −3 examples/recursive_ls.js_
  5. +0 −21 lib/run-save.js
  6. +0 −21 lib/run.js
  7. +21 −0 package.json
  8. +1 −0 test/{node-test.js → test.js}
View
@@ -32,12 +32,12 @@ The function `fileLength_()` will be converted into the following:
Running Cinch code
------------------
-The included script `bin/node-cinch` can be used in place of `node` to run `.js_` files directly. Or you can call `require('cinch').registerExtension()` from a running script to enable `.js_` modules to be `require()`-ed.
+Use included script `node-cinch` instead of `node` to run `.js_` files directly. Or you can call `require('cinch').registerExtension()` from a running script to enable `.js_` modules to be `require()`-ed.
Alternatively, you can use `node-cinch-save` or `registerExtension({ saveSource: true })` to have it save pure-Javascript copies of your Cinch modules as `.js` files. These are regular Javascript modules and can be used without Cinch.
History
-------
-Cinch started as a fork of [Streamline.js] [1] and turned into a full rewrite.
+Cinch started as a fork of the excellent [Streamline.js] [1] and turned into a full rewrite.
[1]: https://github.com/Sage/streamlinejs
View
@@ -1,8 +1,22 @@
-#!/bin/bash
-if [ -h "$0" ]; then
- self=`readlink $0`
-else
- self=$0
-fi
-dir=`dirname $self`
-node $dir/../lib/run.js $*
+#!/usr/bin/env node
+var path = require('path')
+require('..').registerExtension()
+
+process.argv.splice(1, 1)
+
+if (process.argv.length < 2) {
+ console.log("Syntax:")
+ console.log("node-cinch MYAPP.js_")
+ process.exit(1)
+}
+
+var filename = path.join(process.cwd(), process.argv[1])
+
+path.exists(filename, function(exists) {
+ if (!exists) {
+ console.log('File not found: ' + process.argv[1])
+ process.exit(1)
+ }
+
+ require(filename)
+})
View
@@ -1,8 +1,22 @@
-#!/bin/bash
-if [ -h "$0" ]; then
- self=`readlink $0`
-else
- self=$0
-fi
-dir=`dirname $self`
-node $dir/../lib/run-save.js $*
+#!/usr/bin/env node
+var path = require('path')
+require('..').registerExtension({ saveSource: true })
+
+process.argv.splice(1, 1)
+
+if (process.argv.length < 2) {
+ console.log("Syntax:")
+ console.log("node-cinch MYAPP.js_")
+ process.exit(1)
+}
+
+var filename = path.join(process.cwd(), process.argv[1])
+
+path.exists(filename, function(exists) {
+ if (!exists) {
+ console.log('File not found: ' + process.argv[1])
+ process.exit(1)
+ }
+
+ require(filename)
+})
@@ -5,17 +5,19 @@ var path = require('path')
var fs = require('fs')
var util = require('util')
-recursive_ls(path.join(process.cwd(), process.argv[2]))
+recursive_ls(path.normalize(process.argv[2]), function(err) {
+ if (err) throw err
+})
-function recursive_ls_(dir, depth) {
+function recursive_ls_(dir) {
var names = fs.readdir_(dir)
for (var i in names) {
if (names[i][0] !== '.') {
var name = path.join(dir, names[i])
console.log(name)
if (fs.stat_(name).isDirectory()) {
- recursive_ls_(name, depth)
+ recursive_ls_(name)
}
}
}
View
@@ -1,21 +0,0 @@
-var path = require('path');
-require('..').registerExtension({ saveSource: true });
-
-process.argv.splice(1, 1)
-
-if (process.argv.length < 2) {
- console.log("Syntax:");
- console.log("node-cinch MYAPP.js_");
- process.exit(1);
-}
-
-var filename = path.join(process.cwd(), process.argv[1])
-
-path.exists(filename, function(exists) {
- if (!exists) {
- console.log('File not found: ' + process.argv[1])
- process.exit(1)
- }
-
- require(filename);
-})
View
@@ -1,21 +0,0 @@
-var path = require('path');
-require('..').registerExtension();
-
-process.argv.splice(1, 1)
-
-if (process.argv.length < 2) {
- console.log("Syntax:");
- console.log("node-cinch MYAPP.js_");
- process.exit(1);
-}
-
-var filename = path.join(process.cwd(), process.argv[1])
-
-path.exists(filename, function(exists) {
- if (!exists) {
- console.log('File not found: ' + process.argv[1])
- process.exit(1)
- }
-
- require(filename);
-})
View
@@ -0,0 +1,21 @@
+{
+ "name": "cinch",
+ "description": "Async control flow made easy",
+ "version": "0.1.0",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/pguillory/cinch.git"
+ },
+ "author": "Preston Guillory <pguillory@gmail.com>",
+ "main": "index.js",
+ "scripts": {
+ "test": "test/test.js"
+ },
+ "engines": {
+ "node": "*"
+ },
+ "bin": {
+ "node-cinch": "./bin/node-cinch",
+ "node-cinch-save": "./bin/node-cinch-save"
+ }
+}
View
@@ -1,3 +1,4 @@
+#!/usr/bin/env node
var cinch = require('..');
var assert = require('./assert')
var fs = require('fs')

0 comments on commit 5846b70

Please sign in to comment.