Permalink
Browse files

- some progress

  • Loading branch information...
1 parent eb5b22e commit 7f32391c2a805f6fad960dc49db50420102030a9 @SamuraiJack SamuraiJack committed Sep 3, 2011
View
@@ -9,8 +9,12 @@ var argv = require('optimist')
.option('require', {
alias : 'r',
- desc : 'A file to nodify (has the same semantic as `require` made in `root` directory. You can specify several `require`',
- demand : true
+ desc : 'A file to nodify (has the same semantic as `require` made in `root` directory. You can specify several `require`'
+ })
+
+ .option('file', {
+ alias : 'f',
+ desc : 'A file to nodify (has the same semantic as `require` made in `root` directory. You can specify several `require`'
})
.option('help', {
@@ -19,6 +23,8 @@ var argv = require('optimist')
})
.check(function (argv) {
if (argv.help) throw ''
+
+ if (!argv.file && !argv.require) throw 'At least one `require` or `file` is required'
})
.argv
@@ -30,4 +36,4 @@ var librarian = new Librarian({
root : path.resolve(argv.root || './')
})
-librarian.writeBundleTo(process.stdout, [].concat(argv.require || []))
+librarian.writeBundleTo(process.stdout, [].concat(argv.require || []), [].concat(argv.file || []))
@@ -1,13 +1,16 @@
var argv = require('optimist')
.usage('Usage: $0 {OPTIONS}')
.wrap(80)
+
.option('port', {
- alias : 'p',
- desc : 'The port to listen for connections'
+ alias : 'p',
+ desc : 'The port to listen for connections. Default value is 5000',
+ 'default' : 5000
})
- .option('webroot', {
- alias : 'r',
- desc : 'A path directory which will act as a web root. Default is current working directory'
+
+ .option('root', {
+ desc : 'A path directory which will act as a web root. Default is current working directory',
+ 'default' : './'
})
// .option('entry', {
// alias : 'e',
@@ -25,8 +28,8 @@ var argv = require('optimist')
// + 'Example: --plugin \'fileify:["files","."]\''
// })
.option('help', {
- alias : 'h',
- desc : 'Show this message'
+ alias : 'h',
+ desc : 'Show this message'
})
.check(function (argv) {
if (argv.help) throw ''
@@ -39,31 +42,29 @@ var path = require('path')
var http = require('http')
var paperboy = require('paperboy')
-var port = argv.port || 5000
-var webRoot = path.resolve(argv.webroot || './')
+var Librarian = require('librarian')
-var librarian = new require('librarian')({
-
- webRoot : webRoot
+var root = path.resolve(argv.root)
+
+var librarian = new Librarian({
+ root : root
})
http.createServer(function(req, res) {
var pathName = path.normalize(url.parse(req.url).pathname)
- if (/\.\.\//.test(pathName)) throw new Error("Can't serve the files above the webRoot directory")
+ if (/\.\.\//.test(pathName)) throw new Error("Can't serve the files above the root directory")
- librarian.find(pathName, function () {
+ librarian.process(pathName, function (fileName, dir) {
var ip = req.connection.remoteAddress;
paperboy
- .deliver(webRoot, req, res)
+ .deliver(dir, req, res)
.addHeader('Expires', 300)
- .addHeader('X-PaperRoute', 'Node')
- .addHeader('Content-Type', 'text/plain')
.before(function() {
console.log('Received Request');
})
@@ -81,11 +82,11 @@ http.createServer(function(req, res) {
log(404, req.url, ip, err);
})
- }, function () {
- throw new Error("Can't find file: [" + pathName + "] in the webRoot: [" + webRoot + "]")
+ }, function (e) {
+ throw new Error("Can't find file: [" + pathName + "] in the webRoot: [" + root + "], e: " + e)
})
-}).listen(port)
+}).listen(argv.port)
var log = function (statCode, url, ip, err) {
View
@@ -1,68 +1,70 @@
{
+ Inner : [
+ 'Joose',
+ 'Joose.Proto.Empty',
+ 'Joose.Proto.Object',
+ 'Joose.Proto.Class',
+
+ 'Joose.Managed.Property',
+ 'Joose.Managed.Property.ConflictMarker',
+ 'Joose.Managed.Property.Requirement',
+ 'Joose.Managed.Property.Attribute',
+ 'Joose.Managed.Property.MethodModifier',
+ 'Joose.Managed.Property.MethodModifier.Override',
+ 'Joose.Managed.Property.MethodModifier.Put',
+ 'Joose.Managed.Property.MethodModifier.After',
+ 'Joose.Managed.Property.MethodModifier.Before',
+ 'Joose.Managed.Property.MethodModifier.Around',
+ 'Joose.Managed.Property.MethodModifier.Augment',
+
+ 'Joose.Managed.PropertySet',
+ 'Joose.Managed.PropertySet.Mutable',
+
+ 'Joose.Managed.StemElement.Attributes',
+ 'Joose.Managed.StemElement.Methods',
+ 'Joose.Managed.StemElement.Requirements',
+ 'Joose.Managed.StemElement.MethodModifiers',
+
+ 'Joose.Managed.PropertySet.Composition',
+ 'Joose.Managed.Stem',
+ 'Joose.Managed.Builder',
+ 'Joose.Managed.Class',
+ 'Joose.Managed.Role',
+
+ 'Joose.Managed.Attribute',
+
+ 'Joose.Managed.Attribute.Builder',
+ 'Joose.Managed.My',
+ 'Joose.Namespace.Able',
+
+ 'Joose.Managed.Bootstrap',
+
+ 'Joose.Meta.Object',
+ 'Joose.Meta.Class',
+ 'Joose.Meta.Role',
+
+ 'Joose.Namespace.Keeper',
+ 'Joose.Namespace.Manager',
+
+ 'Joose.Attribute.Delegate',
+ 'Joose.Attribute.Trigger',
+ 'Joose.Attribute.Lazy',
+ 'Joose.Attribute.Accessor.Combined',
+ 'Joose.Attribute',
+
+ 'Joose.Meta.Singleton',
+ ],
All : {
saveAs : 'joose-all.js',
contains : [
{
- text : ';(function () {'
+ text : ';!function () {'
},
- 'Joose',
- 'Joose.Proto.Empty',
- 'Joose.Proto.Object',
- 'Joose.Proto.Class',
-
- 'Joose.Managed.Property',
- 'Joose.Managed.Property.ConflictMarker',
- 'Joose.Managed.Property.Requirement',
- 'Joose.Managed.Property.Attribute',
- 'Joose.Managed.Property.MethodModifier',
- 'Joose.Managed.Property.MethodModifier.Override',
- 'Joose.Managed.Property.MethodModifier.Put',
- 'Joose.Managed.Property.MethodModifier.After',
- 'Joose.Managed.Property.MethodModifier.Before',
- 'Joose.Managed.Property.MethodModifier.Around',
- 'Joose.Managed.Property.MethodModifier.Augment',
-
- 'Joose.Managed.PropertySet',
- 'Joose.Managed.PropertySet.Mutable',
-
- 'Joose.Managed.StemElement.Attributes',
- 'Joose.Managed.StemElement.Methods',
- 'Joose.Managed.StemElement.Requirements',
- 'Joose.Managed.StemElement.MethodModifiers',
-
- 'Joose.Managed.PropertySet.Composition',
- 'Joose.Managed.Stem',
- 'Joose.Managed.Builder',
- 'Joose.Managed.Class',
- 'Joose.Managed.Role',
-
- 'Joose.Managed.Attribute',
-
- 'Joose.Managed.Attribute.Builder',
- 'Joose.Managed.My',
- 'Joose.Namespace.Able',
-
- 'Joose.Managed.Bootstrap',
-
- 'Joose.Meta.Object',
- 'Joose.Meta.Class',
- 'Joose.Meta.Role',
-
- 'Joose.Namespace.Keeper',
- 'Joose.Namespace.Manager',
-
- 'Joose.Attribute.Delegate',
- 'Joose.Attribute.Trigger',
- 'Joose.Attribute.Lazy',
- 'Joose.Attribute.Accessor.Combined',
- 'Joose.Attribute',
-
- 'Joose.Meta.Singleton',
-
+ '+Inner',
{
- text : '})();'
+ text : '}();'
},
]
},
@@ -76,7 +78,33 @@
contains : [
'+All'
]
- }
+ },
+
+
+ WebSeed : {
+ saveAs : 'joose-webseed.js',
+
+ contains : [
+ {
+ text : ';require = (function () {'
+ },
+ 'node_modules/librarian/util/module_resolver.js',
+ 'node_modules/librarian/util/require.js',
+ {
+ text : '})();'
+ },
+ ]
+ },
+
+
+ AllWeb : {
+ saveAs : 'joose-all-web.js',
+
+ contains : [
+ '+All',
+ ]
+ },
+
}
View
@@ -37,7 +37,8 @@ update_sources = 0
[Web::Bundle] ; after docs generation to avoid docs for bundles
[Web::NPM::Package]
-bin = nodify bin/joose-nodify.js
+bin = joose-nodify bin/joose-nodify.js
+bin = joose-server bin/joose-server.js
main = joose-all.js
@@ -47,6 +48,11 @@ dependency = detective
devDependency = test-run
+;====================================================================
+; after build
+
+[Run::AfterBuild]
+;run = node %d/bin/joose-nodify.js --root=%d --require=joose > %d/temp; mv %d/temp %d/joose-all-web.js
; before release
View
@@ -19,7 +19,8 @@ Joose.VERSION = ({ /*VERSION*/ }).VERSION
if (typeof module != 'undefined') module.exports = Joose
-/*if (!Joose.is_NodeJS) */this.Joose = Joose
+/*if (!Joose.is_NodeJS) */
+this.Joose = Joose
// Static helpers for Arrays
Oops, something went wrong.

0 comments on commit 7f32391

Please sign in to comment.