Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

- some progress

  • Loading branch information...
commit 99b6a47c7e123e13b06c6468c7592a057e50da7c 1 parent 7f32391
@SamuraiJack SamuraiJack authored
View
1  bin/joose-server.js
@@ -54,6 +54,7 @@ var librarian = new Librarian({
http.createServer(function(req, res) {
var pathName = path.normalize(url.parse(req.url).pathname)
+ pathName = pathName.replace(/^\//, '')
if (/\.\.\//.test(pathName)) throw new Error("Can't serve the files above the root directory")
View
21 node_modules/librarian/lib/Librarian.js
@@ -108,7 +108,7 @@ module.exports = Joose.Class({
getFile : function (fileName) {
var files = this.files
- if (files[ fileName ]) return fileName
+ if (files[ fileName ]) return files[ fileName ]
return files[ fileName ] = new File({
name : fileName,
@@ -138,16 +138,18 @@ module.exports = Joose.Class({
return me.getFile(me.resolve(require, '.', allDeps))
})
- var files = Joose.A.map(files, function (file) {
+ var scripts = Joose.A.map(files, function (file) {
return me.getFile(path.relative(me.root, path.resolve(file)))
})
- Joose.A.each(files.concat(requirements), function (file) {
+// console.log('WRITE BUNDLE: requirements: %s, files: %s, scripts: %s', requires, files, scripts)
+
+ Joose.A.each(scripts.concat(requirements), function (file) {
allDeps[ file.name ] = file
Joose.O.each(file.getInDepthDependencies(), function (file, name) {
- if (allFiles[ name ] && allFiles[ name ] != file) throw new Error('Inconsistency')
+ if (allDeps[ name ] && allDeps[ name ] != file) throw new Error('Inconsistency')
allDeps[ name ] = file
})
@@ -157,7 +159,7 @@ module.exports = Joose.Class({
stream.write(me.wrap(file) + ';\n')
})
- Joose.A.each(files, function (file) {
+ Joose.A.each(scripts, function (file) {
stream.write('require("' + file.name + '");\n')
})
},
@@ -175,9 +177,14 @@ module.exports = Joose.Class({
else {
var tempFile = path.join(tempRoot, fileName)
+ fs.mkdirSync(path.dirname(tempFile), 0777)
+
var stream = fs.createWriteStream(tempFile, { encoding : 'utf8'})
- stream.on('close', callback)
+ stream.on('close', function () {
+
+ callback(fileName, tempRoot)
+ })
stream.on('error', errback)
try {
@@ -185,7 +192,7 @@ module.exports = Joose.Class({
this.processed[ file.name ] = true
- stream.destroySoon()
+ stream.end()
} catch (e) {
errback(e)
View
2  t/001_helpers.t.js
@@ -3,7 +3,7 @@ StartTest(function (t) {
//==================================================================================================================================================================================
t.diag("Joose.A.*")
- var Joose = require('../joose-all')
+// var Joose = require('../joose-all')
var counter = 0
View
165 t/index.js
@@ -1,11 +1,9 @@
var Harness
if (typeof process != 'undefined' && process.pid) {
- require('Task/Test/Run/NodeJSBundle')
-
- Harness = Test.Run.Harness.NodeJS
+ Harness = require('test-run')
} else
- Harness = Test.Run.Harness.Browser.ExtJS
+ Harness = Test.Run.Harness.Browser
Harness.configure({
@@ -20,92 +18,93 @@ Harness.configure({
autoCheckGlobals : true,
expectedGlobals : [
- 'Joose', 'Class', 'Role', 'Module', 'Singleton'
+ 'Joose', 'Class', 'Role', 'Module', 'Singleton', 'require'
],
preload : [
- '../joose-webseed.js',
- '../joose-all-web.js'
+// '../joose-webseed.js',
+// '../joose-all-web.js'
+
+ '../joose-all.js'
]
})
Harness.start(
- '001_helpers.t.js'
-// ,
-// {
-// group : 'Proto class tests',
-//
-// items : [
-// '010_proto_class.t.js',
-// '011_propertyset.t.js',
-// '012_propertyset_mutable.t.js'
-// ]
-// },
-// {
-// group : 'Managed class tests',
-//
-// items : [
-// '020_managed_class.t.js',
-// '021_method_modifiers.t.js',
-// '022_inheriting_from_proto_class.t.js',
-// '023_builder_stem_inheritance.t.js',
-// '024_builder_stem_inheritance.t.js',
-// '031_managed_role.t.js',
-// '032_role_application_basic.t.js',
-// '033_role_application_sugar.t.js',
-// '040_my_symbiont.t.js',
-// '041_my_mutation.t.js',
-// '045_role_builder.t.js'
-// ]
-// },
-// {
-// group : 'Meta level',
-//
-// items : [
-// '050_helpers.t.js',
-// '051_advanced_attribute.t.js',
-// '052_advanced_attribute.t.js',
-// '052_role_application_advanced.t.js',
-// '052_adv_attr_in_metaclasses.t.js',
-// '052_advanced_attribute_set_raw_inlining.t.js',
-// '053_using_class_as_role.t.js',
-// '054_meta_roles.t.js',
-// '055_role_to_instance_application.t.js',
-// '056_arbitrary_object_from_constructor.t.js',
-// '057_role_with_tostring.t.js',
-// {
-// group : 'Misc (testing nesting)',
-//
-// items : [
-// '060_modules.t.js',
-// '061_modules.t.js',
-// '070_reflection.t.js',
-// '071_reflection_current_method.t.js',
-// '080_non_joose_inheritance.t.js',
-// '090_sanity_checks.t.js'
-// ]
-// }
-// ]
-// },
-// {
-// group : 'Advanced features of attribute',
-//
-// items : [
-// 'attribute/010_trigger.t.js',
-// 'attribute/020_lazy.t.js',
-// 'attribute/030_combined.t.js',
-// 'attribute/040_delegation.t.js',
-// 'attribute/100_all_in_one.t.js'
-// ]
-// },
-// {
-// group : 'Singleton',
-//
-// items : [
-// 'singleton/010_sanity.t.js',
-// 'singleton/020_singleton_with_traits.t.js'
-// ]
-// }
+ '001_helpers.t.js',
+ {
+ group : 'Proto class tests',
+
+ items : [
+ '010_proto_class.t.js',
+ '011_propertyset.t.js',
+ '012_propertyset_mutable.t.js'
+ ]
+ },
+ {
+ group : 'Managed class tests',
+
+ items : [
+ '020_managed_class.t.js',
+ '021_method_modifiers.t.js',
+ '022_inheriting_from_proto_class.t.js',
+ '023_builder_stem_inheritance.t.js',
+ '024_builder_stem_inheritance.t.js',
+ '031_managed_role.t.js',
+ '032_role_application_basic.t.js',
+ '033_role_application_sugar.t.js',
+ '040_my_symbiont.t.js',
+ '041_my_mutation.t.js',
+ '045_role_builder.t.js'
+ ]
+ },
+ {
+ group : 'Meta level',
+
+ items : [
+ '050_helpers.t.js',
+ '051_advanced_attribute.t.js',
+ '052_advanced_attribute.t.js',
+ '052_role_application_advanced.t.js',
+ '052_adv_attr_in_metaclasses.t.js',
+ '052_advanced_attribute_set_raw_inlining.t.js',
+ '053_using_class_as_role.t.js',
+ '054_meta_roles.t.js',
+ '055_role_to_instance_application.t.js',
+ '056_arbitrary_object_from_constructor.t.js',
+ '057_role_with_tostring.t.js',
+ {
+ group : 'Misc (testing nesting)',
+
+ items : [
+ '060_modules.t.js',
+ '061_modules.t.js',
+ '070_reflection.t.js',
+ '071_reflection_current_method.t.js',
+ '080_non_joose_inheritance.t.js',
+ '090_sanity_checks.t.js'
+ ]
+ }
+ ]
+ },
+ {
+ group : 'Advanced features of attribute',
+
+ items : [
+ 'attribute/010_trigger.t.js',
+ 'attribute/020_lazy.t.js',
+ 'attribute/030_combined.t.js',
+ 'attribute/040_delegation.t.js',
+ 'attribute/100_all_in_one.t.js'
+ ]
+ },
+ {
+ group : 'Singleton',
+
+ items : [
+ 'singleton/010_sanity.t.js',
+ 'singleton/020_singleton_with_traits.t.js'
+ ]
+ }
)
Please sign in to comment.
Something went wrong with that request. Please try again.