Skip to content

Commit

Permalink
future funkiness!
Browse files Browse the repository at this point in the history
  • Loading branch information
heavyk committed Mar 3, 2013
1 parent af7cb21 commit 0f01343
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 14 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ I am working on a Npm dependency module for meteor... not ready yet though...

due to a bug with multiple components depending on the same component (component-emitter for example), with the stock version of component, you might get hangs...

I have [made a pull request](https://github.com/component/component/pull/276), so you will have to wait, or you can optionally check out my [repo here](https://github.com/heavyk/component)
I have [made a pull request](https://github.com/component/component/pull/276), so you will have to wait, or you can optionally check out my [repo here](https://github.com/heavyk/component)

# Future

* add a lock file. when more than one instance of meteor is spawned... things get pretty crazy...
7 changes: 7 additions & 0 deletions client_tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@


Tinytest.add("component - presence", function(test) {
test.isTrue(typeof component === 'object');
test.isTrue(typeof component.require === 'function');
});

31 changes: 18 additions & 13 deletions package.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ Package.register_extension(
var conf = require(source_path);
var pkgs = conf.dependencies;
if(!pkgs) return;
var st, this_st = fs.statSync(source_path);
Fiber(function() {
var st, this_st = fs.statSync(source_path);
var future = new Future;
///*
try {
st = fs.statSync(component_json_path);
Expand Down Expand Up @@ -101,26 +102,29 @@ Package.register_extension(

batch = new Batch
_.each(pkgs, function(url, pkg) {

var parts = pkg.split('@');
var name = parts.shift();
var version = parts.shift() || 'master';
var rname = pkg.replace('/', '-');
//TODO: if some time has passed, say 2-3 days, do an update instead of skipping it (for master)
//TODO: when implementing specific versions, do a version compare here and update if necessary
if(fs.existsSync(Path.join(odir, name))) return;
batch.push(function(done) {
var parts = pkg.split('@');
var name = parts.shift();
var version = parts.shift() || 'master';
var rname = pkg.replace('/', '-');
//TODO: if some time has passed, say 2-3 days, do an update instead of skipping it (for master)
//TODO: when implementing specific versions, do a version compare here and update if necessary
if(fs.existsSync(Path.join(odir, name))) return;
install(name, version, done);
});
});
var future = new Future;

batch.end(function() {future.return()});
future.wait()
future.wait();
future = void(8);
try {
fs.utimesSync(js_path, new Date, new Date);
} catch(e) {}
}
//}).run();
//*/

//Fiber(function() {
try {
st = fs.statSync(js_path);
} catch(e) {}
Expand All @@ -132,11 +136,11 @@ Package.register_extension(
builder.copyFiles();
builder.addLookup(Path.join(process.cwd(), ".meteor", "components"));
console.log();
future = new Future;
if(!future) future = new Future;
builder.build(function(err, obj){
if (err) {
Component.utils.fatal(err.message);
future.return(err);
return future.return(err);
}

fs.writeFileSync(css_path, obj.css);
Expand Down Expand Up @@ -200,4 +204,5 @@ Package.register_extension(

Package.on_test(function (api) {
api.add_files(['component_tests.js'], 'server');
api.add_files(['client_tests.js'], 'client');
});

0 comments on commit 0f01343

Please sign in to comment.