Giter VIP home page Giter VIP logo

coffee-toaster's People

Contributors

arboleya avatar g3z avatar joaomdmoura avatar lokaltog avatar lorensr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

coffee-toaster's Issues

Handling errors

There is no errors handling about the CoffeScript syntax, so there is no feedback, the compilation just stop at the middle of the release file.

file deletion

i have a file with dependency
#<< utils/*
and i removed the only file in there
this is what happened.

fs.js:338
  return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
                 ^
Error: ENOENT, no such file or directory '/Users/g3z/Sites/flowments/src/utils/textUtil.coffee'
    at Object.fs.openSync (fs.js:338:18)
    at Object.fs.readFileSync (fs.js:182:15)
    at f.__t.Script.f.getinfo (/Users/g3z/.nvm/v0.8.9/lib/node_modules/coffee-toaster/lib/toaster.js:1:8364)
    at __t.Builder.l.watch (/Users/g3z/.nvm/v0.8.9/lib/node_modules/coffee-toaster/lib/toaster.js:1:15395)
    at __t.FnUtil.a.proxy (/Users/g3z/.nvm/v0.8.9/lib/node_modules/coffee-toaster/lib/toaster.js:1:2633)
    at StatWatcher.__t.FsUtil.f.watch_file (/Users/g3z/.nvm/v0.8.9/lib/node_modules/coffee-toaster/lib/toaster.js:1:4364)
    at StatWatcher.EventEmitter.emit (events.js:91:17)
    at StatWatcher._handle.onchange (fs.js:886:10)
Jackbook:flowments g3z$ toaster -wd
path.existsSync is now called `fs.existsSync`.

a second run noticed me with
WARNING Nothing found inside 'utils/'*

I totally LOVE toaster BTW

class name toaster.generators.Config generates an error

in file src/generators/config.coffee class name toaster.generators.Config generates the following error :

$ make test
build/coffee-toaster/bin/toaster . -c
path.existsSync is now called `fs.existsSync`.
Compiled /Users/g3z/Documents/coffee-toaster-G3z/lib/toaster.js @ 0:33:30
node_modules/vows/bin/vows spec/*.coffee --spec

/Users/g3z/Documents/coffee-toaster-G3z/lib/toaster.js:1086
  __t('toaster.generators').toaster.generators.Config = (function(_super) {
                                   ^
TypeError: Cannot read property 'generators' of undefined
    at Object.<anonymous> (/Users/g3z/Documents/coffee-toaster-G3z/lib/toaster.js:1086:36)
    at Object.<anonymous> (/Users/g3z/Documents/coffee-toaster-G3z/lib/toaster.js:1380:4)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/Users/g3z/Documents/coffee-toaster-G3z/spec/error_with_line_number.coffee:16:13)
    at Object.<anonymous> (/Users/g3z/Documents/coffee-toaster-G3z/spec/error_with_line_number.coffee:56:4)
make: *** [test] Error 1

changing class name to Config fixes the problem

$ make test
build/coffee-toaster/bin/toaster . -c
path.existsSync is now called `fs.existsSync`.
Compiled /Users/g3z/Documents/coffee-toaster-G3z/lib/toaster.js @ 0:33:54
node_modules/vows/bin/vows spec/*.coffee --spec

  ♢ Error with line number 

  Compiling a project that has syntax error on file "app.js" at line 12
    ✓ should rise the error precisely

  ♢ Generators (-n, -i) 

  A new project created with default values
    ✓ should match the default template
  A new project created with custom values
    ✓ should match the custom template
  A config file created for an existent project
    ✓ should match the 'toaster.coffee' template

✓ OK » 4 honored (0.988s) 

Compile switch (-c or --compile) doesn't work?

If i execute toaster -w everything works fine. But when i execute toaster -c i just get the overview output (usage etc.).
Am i missing something or is the -c switch not implemented (yet)?

Line numbers are wrong

It seems that coffee toaster will actually strip the #<< lines, resulting in reporting the wrong line number when there's a compile error. (decreased by number of #<< lines)

npm install issue

coffee-toaster is now a dependency in the framework I've been writing this weekend (https://github.com/cif/bangup-js) Seems like there is a problem with the npm install ?

npm ERR! SyntaxError: Unexpected token }
npm ERR! at Object.parse (native)
npm ERR! at Packer.readRules (/usr/local/lib/node_modules/npm/node_modules/fstream-npm/fstream-npm.js:185:33)

Let me know if you're experiencing anything similar on your end, thanks!

Duplicated folder when creating new toaster

I'm having a problem with the latest version (0.6.4), that every time I create a new toaster project, it creates two folders (one inside the other), like this:

toaster -n helloworld

and the folder structure results on this:

helloworld/helloworld/toaster.coffee

And that's happening in every project since I've updated to the latest version.

Watching temporary files

My text editor creates files of the form [filename]~, and these files are watched by toaster. Could toaster either take an option in toaster.coffee like:

tempfile_regexes = [
  /~$/
  /\.swp$/
  /\.DS_Store$/
  /^#/
]

or just filter those by default?

Cannot install 0.3.8 via NPM

This could very well be due to my configuration, but I'm getting the following error when installing [email protected] via npm:

frost:~/build/$ sudo npm install [email protected] -g
npm ERR! error installing [email protected] Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/coffee-toaster/bin/toaster'
npm ERR! Error: ENOENT, no such file or directory '/usr/local/lib/node_modules/coffee-toaster/bin/toaster'
npm ERR! Report this *entire* log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <[email protected]>
npm ERR! 
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "[email protected]" "-g"
npm ERR! cwd /Users/staffhome/build/gemstone-client/web
npm ERR! node -v v0.6.2
npm ERR! npm -v 1.0.106
npm ERR! path /usr/local/lib/node_modules/coffee-toaster/bin/toaster
npm ERR! code ENOENT
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/staffhome/build/gemstone-client/web/npm-debug.log
npm not ok

In contrast:

frost:~/build/web$ sudo npm install [email protected] -g
/usr/local/bin/toaster -> /usr/local/lib/node_modules/coffee-toaster/bin/toaster
[email protected] /usr/local/lib/node_modules/coffee-toaster 
├── [email protected]
├── [email protected]
└── [email protected]

Any ideas?

No longer packaging some of our files

When I run toaster -w in a clone of https://github.com/shipstar/space-shooter, I get several warning messages:

WARNING.bold No class found, skiping file: space-shooter/src/game.coffee
WARNING.bold No class found, skiping file: space-shooter/src/overlay.coffee
WARNING.bold No class found, skiping file: space-shooter/src/util.coffee

It compiles the Ship file just fine, but as a result the game itself is broken. Looking at the line that is printing this out in coffee-toaster (note potential misspelling of skipping) is at src/toaster/grains/script.coffee#collect(), and looking at the history of the file indicates that that section was changed recently.

We were using coffee-toaster just for the capability of splitting up files and merging them after compilation into one. It seems like this functionality has changed? I was not banking on needing to have every file including a class. Thanks for your help!

Toaster always loads files from /toaster instead of /public/javascripts/toaster

What I do:
ray@arch ~/programming/fh/bif4-itp/src/webchat/public $ toaster -wd
path.existsSync is now called fs.existsSync.
Compiled /home/ray/programming/fh/bif4-itp/src/webchat/public/javascripts/app.js @ 19:15:59
Compiled /home/ray/programming/fh/bif4-itp/src/webchat/public/javascripts/app-debug.js @ 19:15:59

My structure:

ray@arch ~/programming/fh/bif4-itp/src/webchat/public $ ls
audio coffee fonts images javascripts toaster.coffee vendors

My toaster config:
toast 'coffee'
httpdfolder: '/public/javascripts/'
release: 'javascripts/app.js'
debug: 'javascripts/app-debug.js'

Error:

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/activechannel.js"

activechannel.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/inviteusermessage.js"

invite...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/model.js"

model.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/channelmodel.js"

channelmodel.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/websocket.js"

websocket.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/app.js"

app.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/invitegroupmessage.js"

invite...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/message.js"

message.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/readonlyusermessage.js"

readon...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/modusermessage.js"

modusermessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/pingmessage.js"

pingmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/ui.js"

ui.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/sendmessage.js"

sendmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/modgroupmessage.js"

modgro...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/readonlygroupmessage.js"

readon...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/joinmessage.js"

joinmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/user_in_group_filter.js"

user_i...lter.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/group_in_channel_filter.js"

group_...lter.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/user_in_channel_filter.js"

user_i...lter.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/controllers/channel_controller.js"

channe...ller.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/controllers/channellistcontroller.js"

channe...ller.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/activechannel.js"

activechannel.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/websocket.js"

websocket.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/channelmodel.js"

channelmodel.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/services/model.js"

model.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/inviteusermessage.js"

invite...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/pingmessage.js"

pingmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/modusermessage.js"

modusermessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/readonlyusermessage.js"

readon...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/message.js"

message.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/invitegroupmessage.js"

invite...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/joinmessage.js"

joinmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/readonlygroupmessage.js"

readon...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/modgroupmessage.js"

modgro...sage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/messages/sendmessage.js"

sendmessage.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/ui.js"

ui.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/controllers/channellistcontroller.js"

channe...ller.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/controllers/channel_controller.js"

channe...ller.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/user_in_channel_filter.js"

user_i...lter.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/group_in_channel_filter.js"

group_...lter.js

"NetworkError: 404 Not Found - http://localhost:9000/toaster/filters/user_in_group_filter.js"

Ignore SVN files

the compiler doesnt ignore the SVN folder and compile the source twice

toaster -w conflict with the default saving file behavior in vim

2012-12-11

I thought there was vim environment problem, NOT a coffee-toaster bug. so, I rename the title.



here is the error output:

[14:17:01] File deleted, stop watching /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/timer.coffee
[14:17:01] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js

/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:1200
              file.item.getinfo();
                  ^
TypeError: Cannot read property 'item' of null
    at __t.Builder.Builder.watch (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:1200:19)
    at __t.FnUtil.FnUtil.proxy (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:348:19)
    at StatWatcher.__t.FsUtil.FsUtil.watch_file (/home/zx1986/.nvm/v0.8.14/lib/node_modules/coffee-toaster/lib/toaster.js:530:51)
    at StatWatcher.EventEmitter.emit (events.js:99:17)
    at StatWatcher._handle.onchange (fs.js:889:10)

### after restart toaster without modify my coffee file, everything goes fine again.

zx1986@mfc66:~/work/log-watcher-gts$ toaster -w
[14:18:48] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js
[14:18:50] File changed /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/coffeescripts/timer.coffee
[14:18:50] Compiled /home/zx1986/Dropbox/Projects/log-watcher-gts/assets/javascripts/main.js

here is the offee file, timer.coffee:

get_time = (holder_id) ->
    s = $("##{holder_id} p:last-child").text().split(' ')
    time = s[4] + s[1] + s[2] + s[3] 
    console.log time 

In file.item.getinfo(), the file means that file which has been watched ?
I ran guard + livereload + toaster at same time, will that cause this problem ?

Debug mode: toaster directory sent to release directory instead of debug

According to the README

In debug mode (option -d) all files will be compiled individually inside a
folder called "toaster" in the same directory you've pointed your debug file,

However it's created in the release directory instead.

Steps to recreate

Define release and debug directories:

# => SRC FOLDER
toast 'source'
    release: 'release/main.js'
    debug: 'debug/debug.js'

Expected result

The following directory structure would be created:

release
    main.js
debug
    toaster
    debug.js

Actual result

The toaster directory is created in the release directory

release
    toaster
    main.js
debug
    debug.js

toaster -w fails if you have .DS_Store file on source folder

My source files:

coffee/
coffee/app
coffee/app/.DS_Store
coffee/app/app.coffee
coffee/vendors

// Calling toaste -w fails
$ toaster -w

/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1
"+this.filepath)),this.filename=/[\w-]+.[\w-]+/.exec(this.filepath)[0],this.f
^
TypeError: Cannot read property '0' of null
at f.__t.Script.f.getinfo (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:8688)
at new f (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:8158)
at l.__t.Builder.l.init (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:12960)
at l.__t.Builder.l.init (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:13040)
at new l (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:11901)
at Toast.__t.Toast.Toast.toast (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:23818)
at Toast.__bind as toast
at Toast.eval (eval at Toast (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:22357))
at new Toast (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:22352)
at new f (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:24550)

// I Guess the problem is on src/toaster/core/script.coffee
Script error: line 29 : @filename = /[\w-]+.[\w-]+/.exec( @filepath )[ 0 ]

// current workaround
$ find . -name .DS_Store | xargs rm -rf

toaster -w conflicts with emacs

Hi,

I'm an emacs user and try to use toaster on one of my coffee project.
If i edit a file with emacs that is currently watched by toaster, it will make coffee script crash due to some emacs behavior.

Whenever you edit a file with emacs, it creates a simlink to a non-existing file (it holds informations about who's currently editing the file), this cause a ENOENT exception within DirWatcher which is not handled and make toaster quit.

Here's an example trace :

[16:36:35] Compiled /home/lta/code/node/test/www/js/test.js

fs.js:524
  return binding.stat(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '/home/lta/code/node/test/src/.#test.coffee'
    at Object.fs.statSync (fs.js:524:18)
    at DirWatcher.diff (/usr/local/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:313:21)
    at DirWatcher.onchange (/usr/local/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:284:17)
    at FSWatcher.__bind (/usr/local/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:4:61)
    at FSWatcher.EventEmitter.emit (events.js:99:17)
    at FSEvent._handle.onchange (fs.js:826:12)

Errors when packaging = false

Ians-MacBook-Pro:liblol simplyianm$ toaster -cd
path.existsSync is now called `fs.existsSync`.

/usr/local/lib/node_modules/coffee-toaster/node_modules/coffee-script/lib/coffee-script/coffee-script.js:51
      throw err;
            ^
Error: Parse error on line 3: Unexpected '{'
    at Object.parseError (/usr/local/lib/node_modules/coffee-toaster/node_modules/coffee-script/lib/coffee-script/parser.js:477:11)
    at Object.parse (/usr/local/lib/node_modules/coffee-toaster/node_modules/coffee-script/lib/coffee-script/parser.js:554:22)
    at Object.exports.compile.compile (/usr/local/lib/node_modules/coffee-toaster/node_modules/coffee-script/lib/coffee-script/coffee-script.js:43:20)
    at new Toast (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:22230)
    at new f (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:24498)
    at Object.exports.run (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:1:23865)
    at Object.<anonymous> (/usr/local/lib/node_modules/coffee-toaster/bin/toaster:7:27)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)

Limitation of includes

Could it be that there's a limitation of the number of files I want to include using the import directive? After including around 40 files, it says:

/node_modules/coffee-toaster/lib/toaster.js:226 by_property = [].concat(by_property); ^ RangeError: Maximum call stack size exceeded

Uncaught ReferenceError: __t

I'm in debug mode. I get this error - Uncaught ReferenceError: __t

The problem appears to be the way toaster is compiling the coffeescript into js.

Here is the coffeescript -

class Task extends Backbone.Model
    alert "test"

Here is Toaster's output -

(function() {
  var __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  __t('models').Task = (function(_super) {

    __extends(Task, _super);

    function Task() {
      return Task.__super__.constructor.apply(this, arguments);
    }

    alert("test");

    return Task;

  })(Backbone.Model);

}).call(this);

Here is the normal coffeescript compiler output (which works fine)

(function() {
  var Task,
    __hasProp = {}.hasOwnProperty,
    __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };

  Task = (function(_super) {

    __extends(Task, _super);

    function Task() {
      return Task.__super__.constructor.apply(this, arguments);
    }

    alert("test");

    return Task;

  })(Backbone.Model);

}).call(this);

Why is the output different. How can I fix this?

I love this tool, hopefully I can get it to work right.

Changing order of import directives

First of all, thanks for that great tool!

Question: Could it be that changing the order of directives requires a restart of coffee-toaster?

Compiling with watch (-w) on Windows breaks

When compiling with the -w flag, the process halts in the command line.
As soon as a source file is edited, it shows the following error:

[modules]\coffee-toaster\lib\toaster.js:1
th"),g.item.geti

TypeError: cannot read property 'item' of null
  at __t.Builder.l.watch ([modules]\cofee-toaster\lib\toaster.js:1:15389)
  at __t.FnUtil.a.proxy ([modules]\lib\toaster.js:1:2633)
  at StatWatcher.__t.FsUtil.f.watch_file ([modules]\cofee-toaster\lib\toaster.js:1:4346)
  at StatWatcher.EventEmitter.emit (events.js:91:17)
  at StatWatcher._handle.onchange (fs.js:886:10)

Defining `vendors` causes release path & filename to be ignored

Using [email protected], when I define my release path in toaster.coffee it works fine and builds to the correct place. However, when I define a list of vendor files I get the following output:

Compiled /path/to/sample-toaster-app/undefined @ 9:30:37

This undefined file does contain JavaScript, however it is not in the correct path or filename.

I have tried moving the vendor files to different places, and even defining an empty list of vendors - this still causes the error.

Are you able to duplicate? My toaster file looks like this:

# => SRC FOLDER
toast 'src/coffee'

  # EXCLUDED FOLDERS (optional)
  # exclude: ['src/coffee/background.coffee']

  # => VENDORS (optional)
  vendors: [
    'src/vendor/underscore.min.js',
    'src/vendor/backbone.js',
    'src/vendor/jquery.min.js'
  ]

  # => OPTIONS (optional, default values listed)
  # bare: false
  # packaging: true
  # expose: 'window'
  # minify: true

  # => HTTPFOLDER (optional), RELEASE / DEBUG (required)
  httpfolder: 'bookmarklet'
  release: 'build/bookmarklet/bookmarklet.js'
  debug: 'build/bookmarklet/bookmarklet-debug.js'

window.onload or $(document).ready at the beginning?

I'm pretty newbie to javascript.

I just wonder:
How could I make the compiled javascript file begin with (function($){$(document).ready(function(){
and end with });}(jQuery));

by default, coffee-toaster compiled to(function() {
end with }).call(this)

any trick to make what I say happen?

Compile to debug (-d) doesn't work as expected

I am using coffee-toaster on Windows. When I compile to release it works as expected, but compiling in debug mode does not process the individual coffee files correctly - it seems to be stuffing up the path - for example if my root app directory is c:\test, source directory is 'src' (so c:\test\src), I get an error when doing toaster -c -d along the lines of -

MSG:::: ENOENT, no such file or directory 'C:\toaster:\test\src\HtmlUtils.js'
ERROR ENOENT, no such file or directory 'C:\toaster:\src\test\HtmlUtils.js' at file: :\test\src\HtmlUtils.coffee

I get this error for every coffee file under the src directory. It seems to be adding the 'toaster' (by the way - is this folder name configurable?) in the wrong spot, and for some reason seems to be adding it to the source path, not to the debug path as is described in the documentation.

Regards,
Ian

Add option to ignore the packaging system

There must to be some way to complete disable the packaging system in the config file.

This way standard CoffeeScript libraries can be managed as well without getting the odd 'pkg_helper' prepended to the release file.

Files not picked up in namespace when they are subclasses

Seems like if I have a file in a folder dist/foo

class Foo

and then , in the same folder

class Bar extends Foo

then Bar isn't available in the foo namespace (e.g. foo.Bar) but Foo is (foo.Foo). If I remove the extends from Bar, it is available.

Feature Request: toaster via argument specified toaster file

First of all, this is the best thing I've found in a long time. The expose approach is epic. Scoping has always been tough with ECMA languages and see no point to things like User = require('models/user') or template = require('views/templates/whatever.eco') found in frameworks like brunch.io and spine.js ... It's all in one file, just scope/namespace, looks like finally someone agrees.

Anyway, I'm integrating coffee-toaster into a client side development framework that also compiles stylus into a single application.css file as well as precompiles handlebars.js templates into a single templates.js via three watch commands executed at once.

My feature request is a command line argument to specify a different toaster.coffee file which I could use to concatenate different vendor files and change my export destination. For example, if I'm building a mobile version I would want to toast Zepto instead of jQuery, wouldn't need many web-only vendor libs, as well as output to mobile.js instead of application.js.

I won't be writing much of the mobile version of my current app until this fall, so no rush at all and of course I could alwasy not be lazy and work in another directory.

Thanks so much for all the hard work so far!

Error when requiring based on file path

$ cat toaster.coffee

modules = 
  name: 'test'
  src: 'app'
  release: 'out/o.js'

$ ls app
app.coffee helper.coffee

$ cat app/app.coffee

#<< helper
foo = 0

$ toaster
Watching folder /Users/me/code/toaster-test/app
Watching file /Users/me/code/toaster-test/app/app.coffee
Watching file /Users/me/code/toaster-test/app/app.coffee~
Watching file /Users/me/code/toaster-test/app/helper.coffee

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
TypeError: Cannot read property 'yellow' of undefined
    at Script.reorder (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:456:130)
    at Script.<anonymous> (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:355:24)
    at /usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:3:63
    at Script.<anonymous> (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:415:16)
    at /usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:3:63
    at Function.<anonymous> (/usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:26:16)
    at /usr/local/lib/node_modules/coffee-toaster/lib/toaster.js:3:63
    at ChildProcess.exithandler (child_process.js:100:7)
    at ChildProcess.emit (events.js:67:17)
    at Socket.<anonymous> (child_process.js:179:12)

I've also tried #<< app/helper and adding .coffee to the end.

file dependencies now need ' / '

I noticed that my dependencies exploded migrating from 0.6.4 to 0.6.7
the reason is that i need to prepend a slash ( / ) before any filename
so if i have main.coffee and lib.coffee in src
i had to write
#<< /lib
same thing if lib.coffee is in libs folder
#<< /libs/lib

but not if i want the full folder
#<< libs/*
which works like a charm

is this an intended behavior ?

Temporary files produced by WebStorm IDE crash Toaster in watch mode

My IDE seems to produce and then immediately delete temporary files at save time. Unfortunately, the appearance/disappearance of this unexpected file crashes Toaster even if I provide the file extension in my excludes array.

I've checked and there doesn't seem to be a way to configure WebStorm to prevent the file's creation like Vim allows.

I can save the toaster.coffee file without issue.

$ toaster -w
[18:32:16] Compiled /Users/z/testbed/ct/r/release/js/r.js
[18:32:21] Changed /Users/z/testbed/ct/r/toaster.coffee
[18:32:22] Compiled /Users/z/testbed/ct/r/release/js/r.js
[18:32:23] Changed /Users/z/testbed/ct/r/toaster.coffee
[18:32:24] Compiled /Users/z/testbed/ct/r/release/js/r.js

fs.js:524
return binding.stat(pathModule.makeLong(path));
^
Error: ENOENT, no such file or directory '/Users/z/testbed/ct/r/src/R/main.coffee___jb_bak
__'
at Object.fs.statSync (fs.js:524:18)
at DirWatcher.diff (/usr/local/share/npm/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:313:21)
at DirWatcher.onchange (/usr/local/share/npm/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:284:17)
at FSWatcher.__bind (/usr/local/share/npm/lib/node_modules/coffee-toaster/node_modules/fs-util/lib/fs-util.js:4:61)
at FSWatcher.EventEmitter.emit (events.js:99:17)
at FSEvent._handle.onchange (fs.js:826:12)

Toaster's great! I'm hoping I can use its watch feature. Thanks!

Add buid routines

Example:

# BUILDS

build 'insects_animals'
    modules: ['insects', 'animals']
    release: 'insects_animals.js'

build 'animals_insects'
    modules: ['animals', 'insects']
    release: 'animals_insects.js'

Start namespace with an uppercase letter

Hi! I really like your project.
But I mentioned a little but annoying thing while trying to enhance my old project with Toaster.

So I already had a namespaces implemented in my project and they were all starting with capital letters. But Toaster rewrote them starting with the lowercase as expected matching my dirs structure. I use backbonejs and that's the reason I was naming my namespaces this way, in order to match backbone style.

Is it possible to have an option responsible for namespaces naming format?

I'm new to node/coffee stuff so I'm sorry if this proposition is against some convention or community rule.

Wrong behaviour when source coffee files are not inside subfolders of src

I have the following folder structure:

  • src
    • app.coffee
    • some_lib.coffee

Inside some_lib.coffee there's a class declaration SomeLib

I noticed that in the compiled some_lib.js that it is outputted when compiling with the debug flag the call to the function __t that declares the name space is not present at all, but rather we have the normal compiled output from coffeescript, as if coffee-toaster had not done anything to that file.

If I wrap the sources in sub-folders inside src everything works fine:

  • app
    • app.coffee
  • some_lib
    • some_lib.coffee

This behavior shows whether I have the package flag set to true or not in the config file.

Adam

functions are not included into the modules

Only classes are included in the modules, functions are not..

Try under math/math.coffee

limit = (low, value, high) -> Math.max(low, Math.min(value, high))

You have to do math.limit = ....

Multiple outputs?

Have you considered having multiple outputs along with multiple watch folders?

For instance, I'd like to watch one set of folders and output my app.js file. I'd like to watch another set of folders and output my specs.js file. For obvious reasons, I'd like my specs to be separate from my actual app file.

Right now, I have two toaster configs and two instances of toaster running. Not a huge problem... but if I had one config, it would be cleaner.

Allow requiring outside src directory

If I have:

$ cat toaster.coffee
module 'production'
  src: 'app'
  release: 'out/o.js'

module 'test'
  src: 'test'
  release: 'out/test.js'
$ ls *
toaster.coffee
app:
foo.coffee

test:
test.coffee

out:
$ cat test/test.coffee
#<< ../src/foo
# does some tests on the functions in foo

Note the first line in test/test.coffee. As far as I can tell it isn't supported, but it would be nice if it worked since it would facilitate easy testing (currently tests have to be placed in the src tree, in which case the tests are compiled into production code).

Cross reference between classes

If your class B extends the class A, and you include class B rendering first in class A file this will start a infinite loop and stop the processing of compilation without show any treated error.

The code:

a.coffee
class A extends D constructor:-> console.log "lol"


b.coffee
#<< A class D constructor:-> console.log "lol"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.