arboleya / coffee-toaster

Minimalist build system for CoffeeScript.
114 stars 23 forks source link

Autorun mode #56

Closed G3z closed 11 years ago

G3z commented 11 years ago

you have now the ability to compile run and debug node.js applications using toaster. i hope you like it :)

arboleya commented 11 years ago

Apparently all goes fine, thank you very much. :)

I'm just wondering, maybe it's cool to let some option like default args to be passed to the script?

What do you think of this?

toaster -a create some/path some/name

So if you log the process.argv in your release file, you should see:

console.log process.argv
# outputs
# [ 'create', 'some/path/', 'some/name' ]

Important to considerer that it may be called in more than one way:

toaster -a args.. # ok
toaster -ad args.. # not ok, the args will go to the `debug` option
toaster -da args.. # ok

Did you needed when using this autorun mode?

G3z commented 11 years ago

i needed this feature while i was building a webserver so i din't need args. what i needed, but don't have a clue on how to do, it is file splitting for debug. I love that toaster splits files in debug mode so it's easier to follow the code, but i don't know how to do it properly in node.js. i'll look into arguments implementation BTW.

G3z commented 11 years ago

this

console.log process.argv

launched with

toaster -a bella

now outputs

[16:51:53] Compiled /Users/g3z/Desktop/test/bin/app.js
Application started:
[ '/Users/g3z/.nvm/v0.8.16/bin/node',
  '/Users/g3z/Desktop/test/bin/app.js',
  'bella' ]

the only difference with a manual execution

node bin/app.js bella

is that the node path is not expanded

[ 'node',
  '/Users/g3z/Desktop/test/bin/app.js',
  'bella' ]

-a and -da works as expected. I've updated the Readme with a note on -ad not behaving as expeted

arboleya commented 11 years ago

Hi, thank you very much for contributing. :) https://github.com/serpentem/coffee-toaster/commits/master https://github.com/serpentem/coffee-toaster/blob/master/build/CHANGELOG.md#0611---12292012

About this:

I love that toaster splits files in debug mode so it's easier to follow the code, but i don't know how to do it properly in node.js.

Yes, there's no currently debug option for nodejs apps. Toaster do the individual compilation just for the browser by now.

But I assure you it's a TODO.

Will require a new nature property in the toaster.coffee which can be browser or node.

This should be enough plus the individual compilation.

The only point is that for this to work, the 'expose' property will have to be true, otherwise packages wont be available via require.