arboleya / coffee-toaster

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

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

Closed IanDuncanson closed 11 years ago

IanDuncanson commented 12 years ago

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

svdgriendt commented 12 years ago

Same thing here, compiling with -c goes just fine, but as soon as -d is added an error occurs:

path.existsSync is now called `fs.existsSync`.
Compiled [path]\js\test.js @ [time]
MSG:::: ENOENT, no such file or directory '[path]\src\test.js'
ERROR ENOENT, no such file or directory '[path]\src\test.js' at file: [path]\src\test.coffee
Compiled [path]\js\test-debug.js @ [time]
arboleya commented 12 years ago

Hi, as it seems there's some problems occurring in Windows. As I said before, sadly I dont have a windows machine to check this right now, but I'll take a look into it.

kisPocok commented 12 years ago

toaster -w is compile everything correctly until added file dependency. "WARNING Dependecy path/to/dependency/foo.coffee not found for file path/to/file/boo.coffee

Please, help us! Thank you. :-)

arboleya commented 12 years ago

@kisPocok , please see #30

I guess it's more a node-thing than a toaster-thing: https://github.com/joyent/node/issues/1358

mmikeyy commented 11 years ago

I've been spending hours trying to make this thing work. Got the same error described above.

Quite frankly I am starting to wonder if it wouldn't be faster (and healthier) to write my own program instead of finding my way around bugs in other people's programs. It may very well be a node problem. But in the end, it just doesn't work.

Above error followed by:

MSG:::: ENOENT, no such file or directory 'D:\toaster\:\www\maitre\src_coffee\login_c.js'

Seems that some part of the program is trying to build a path in a rather creative way.

Anyone got a solution?

If it can help, here's my toaster.coffee (very simple test file for first attempt at using program)

toast 'www/maitre/src_coffee'

httpfolder: 'include_js'
release: 'include_js/app.js'
debug: 'include_js-debug/app_debug.js'
arboleya commented 11 years ago

Hi, I perfectly understand your frustration.

I'll find a time to build up a windows vm so I can fix it, stay tunned.

mmikeyy commented 11 years ago

Staying tuned... fingers crossed! Thx for your time & effort.

arboleya commented 11 years ago

Hi @mmikeyy, could you please answer me a few questions?

1) Are you under Windows 7? 32 or 64bits? 2) Which bash emulator are using? Cygwin? Git Bash? Other? 3) Are you able to install the latest version (0.6.4) I just released? The problem persists, I guess.

I'm having problems with the windows's virtual machine I just created, but in time I'll get to the root of the problem.

kisPocok commented 11 years ago

Hi, I had same problems while using win7 64bit, with git bash.

mmikeyy commented 11 years ago

Hi Anderson,

I am using Windows 8 64-bit.

Not using a bash emulator - or perhaps using one unknowingly,being a newcomer in the Node world....... I run all commands directly from the Windows command line (without problems...)

Just installed the latest version of coffee-toaster. Big problem: now it can’t run at all. There seems to be a hard dependency on the Growl module, but Growl is Darwin/Linux only.

arboleya commented 11 years ago

Yes, things are worse than I thought on windows, the growl dependency is just one thing. This will surely consume more time than I was expecting. But I'll keep this thread up to date soon as I make some progress.

In this meantime, you can create a virtual machine using Virtual Box (its free) and install Ubuntu which is a very fancy linux distro to get started, I'm pretty sure you will like it. You will be able to share folders between your windows and the linux vm as well or use some service such as dropbox to keep files in sync between the windows and linux, so you don't get stucked in linux if this is a problem for you. You'll also find good code editors for linux as well, such as sublime etc. Totally worth a try.

It's the shortest way for you to get toaster running now without any complications. You'll spend no more than 2 hours gt get this setup up and running, and everything will be solved by now.

mmikeyy commented 11 years ago

Well...I've already set up a Linux VM with Ubuntu last week. I thought I'd give it another try, after coming to the conclusion a few years back that it was really too frustrating to use. Sadly, I've come to the same conclusion again, after hoping that it would have improved over time. I can find no way to make the mouse wheel work in linux. The choice of single-clicking or double-clicking on links to activate them is not offered. I'm stuck in a (relatively) small window of 1100 x 768 approximately, that I can't resize to take advantage of my screen size; I try to install Chrome and it tells me that a dependency is not satisfied (not the right version). I download the latest version of that module, and then it tells me of another dependency that is not satisfied. No time to waste on such things. On top of the mouse wheel not working, the scroll bars are all screwed up: sometimes they appear when the mouse cursor hovers over them, sometimes they are displayed, but so narrow that one has to aim carefully to use them.

I know that Linux is excellent, but why can't it be used by someone who just wants to get things done, but things unrelated to Linux itself? Why does Linux present itself as a wall that one must climb first?

Anyway... I'll see again if I can improve my install. It's a shame that it's so awkward to use, because I use Netbeans as an IDE and it does have a linux version. But I certainly won't give up the comfort of my dual 23-inch screens to do anything serious in a small window. I'll see if I can reasonably integrate toaster running in a linux vm to my windows workflow.

arboleya commented 11 years ago

Maybe you can let the ubuntu just compiling a shared folder that resides in your windows, while you still working on windows? Not the best solution but may work.

Please post the results of your attempts here, so others with the same problem can mimic you and use it as a palliative solution until I got something.

Thanks.

mmikeyy commented 11 years ago

Ok, I've spent a full day trying this with Ubuntu and mainly openSuse (after I read that Ubuntu is not supported by hyper-v). In one instance, I got a shared folder to appear in Linux, but I couldn't figure out how to refer to it from the command line. And further fiddling with the config made this folder disappear, and I could never make it appear again. Hyper-v complained that the integration services need to be upgraded or repaired for networking to work. I found a multi-page document filled with command line instructions (download this, mount that as a cd, etc etc) to do this.

I've been driving a car for many years, and I've never needed to take the motor apart. I really wonder why in the Linux world, users are expected to find it normal to be burdened with such uninteresting tasks.

Forgot to mention that I tried the Oracle VirtualBox too. No more luck.

So sorry, but I think I suck at this kind of thing. I'm used to working in javascript/php and I'm trying to set up a suitable workflow for coffeescript/node. I was looking for a tool to save time, but it seems that I fell in a mud hole instead and I've been stuck there.

I'm writing my own cake file now. It's taking some time, but at least I've got traction!

arboleya commented 11 years ago

Sorry for not being able to help you any further.

Thanks for your feedbacks, hopefully everything will be ok soon and maybe you can drop your Make and give Toaster another try.

arboleya commented 11 years ago

NOTE FOR ALL WINDOWS USERS: This windows thing urged me straight to an unwanted :smile: refactoring of all operations related to classpath evaluations to handle path separators which differs from *unix to windows. Basically, it's "/" against "\".

I'm aware of all current problems concerning it and already started this refactor. It should consume more time than I thought but Windows's users will also be able to use Toaster gracefully very soon.

I'll not interact in this thread again until I get everything fixed, so stay tunned.

Thanks for all feedbacks so far.

arboleya commented 11 years ago

Just to give an update here, I'm working hard on it: https://github.com/serpentem/fs-util

Even though there is some obstacles ahead, as you can see here: https://github.com/joyent/node/issues/4337

It's not an easy call but hopefully everything will be working soon.

arboleya commented 11 years ago

@mmikeyy Hi, can you pls check it out and tells me if it (finally) worked?

npm install -g git://github.com/serpentem/coffee-toster#cross-platform-refactor
mmikeyy commented 11 years ago

Entered the command exactly as you proposed. Got this:

image.png

Should I do something different? Looks like it's not finding your files. Or is the problem on my side?

arboleya commented 11 years ago

Ops there was a typo, again:

npm install -g git://github.com/serpentem/coffee-toaster#cross-platform-refactor
mmikeyy commented 11 years ago

Hey Anderson,

Got this error now:

image.png

Error in my setup file? On the one hand, it says 'unknown source' on one of the first lines (which could lead one to think that a directory is incorrectly specified). On the other hand, it says 'missing outdent on line 5862', implying that there's a syntax error, not a missing file...

My projects are all one level below the web root. (web root is www; project 1 directory is www/p1, etc.)

I assume that all directories are specified relative to the one from which the toaster program is called. Toaster file is in www/p1 for project 1.

FYI, I spent a good amount of time working on my cake file in the period between your 'stay tuned' msg and your message much later confirming that you were really working on fixing the program. I think, unless I missed something, that this toaster program is great for applications that must be assembled into one single release js file. But while the core of my (and any) application is built like that, I have hundreds of scripts that are left on the server to be loaded by the client as they are required. Each such script may have a few coffeescript sources from which it's assembled. It would be great if one could say in the configuration file, for example, here's a directory containing a bunch of subdirectories containing coffeescripts, and here's a destination directory in which I want to see these scripts individually compiled and assembled.

for example:

Source directory:

-<directory script1>
     ... bunch of coffeescript sources
     ... subdirectories containing other coffeescript sources
- < directory script2>
     ... bunch of coffeescript sources
     ... subdirectories containing other coffeescript sources

Target directory:

 - script1.js
 - script2.js

where script1.js is all coffeescripts in the original directory and subdirectories, compiled and concatenated...

That would allow one to use toaster not only for the core app, but also for all modules that are not to be assembled into it...

Anyway, perhaps there's an easier way. I'll let you be the judge.

FYI, my toaster file is as follows:

# => SRC FOLDER
     toast 'include/std'
     httpfolder: 'test_toaster/js_toaster'
     release: 'js_toaster'
     debug: 'js_toaster-debug'

the include/std folder contains a bunch of coffeescripts that my cake file has no problem compiling (I therefore doubt there's a syntax error on my side...)

arboleya commented 11 years ago

Got this error now:

You forgot to send the error.

But while the core of my (and any) application is built like that, I have hundreds of scripts that are left on the server to be loaded by the client as they are required.

There's a planned feature for exporting modular code in which you'll be able to specify a core set of classes while all the rest remais individual to be loaded on demand. But there's no milestone for this yet.

Anyway, what you're suggesting is currently possible without any changes. In your toaster.coffee file, use two parallels toast builds, one for each set of source files.

toast 'your/src/for/script1'
  release: '../www/script1.js'
  # ...

toast 'your/src/for/script2'
  release: '../www/script2.js'
  # ...
mmikeyy commented 11 years ago

OK... updated my previous message including the error.

arboleya commented 11 years ago

Hi, the universe is conspiring against you using Toaster. :)

This error msg is very weird and doesn't help much, so lets try to isolate the error at least:

1) Clone the toaster repo (we're gonna test one example)

git clone git://github.com/serpentem/coffee-toaster

2) Enter the example folder

cd coffee-toaster/examples/single-folder

3) Starting watching / compiling it in debug mode:

toaster -wd

4) Open any file in the src folder and try to:

Let let know if these seps run well or if you got some other error, after that we're going to clarify your complete folder structure and demystify your toaster.coffee config file which is a bit confusing.

For me everything worked as expected with theses 4 steps bellow:

simple-test.png

mmikeyy commented 11 years ago

Universe still conspiring!

All looks ok initially: I change a coffeescript source and it says 'file changed', it compiles and resumes waiting for the next change. As expected.

If change app.coffee as follows (adding test method):

    #<< genres/*

        class app.App
        constructor:->
          console.log "App created!"
          new genres.Progressive
          new genres.TripHop

        test: (a) -> a*2
    new app.App

I get this:

image.png

I restart toaster, and it compiles with no error...

Then I look in coffee-toaster\examples\single-folder\www\js\toaster\app\app.js and I find an empty function instead of what I expected:

(function() {

}).call(this);

I change app.coffee as follows (no syntax error, even though I'm calling test as fnct instead of method)

<< genres/*

class app.App
    constructor:->
        console.log "App created!"
        new genres.Progressive
        new genres.TripHop
        test(45)
    test: (a) -> alert(a*2)
    test2: (b) -> a*3

new app.App

I get this: image.png

Ahh I see what's going on (when I'm not getting the error above):

Whenever I change app.coffee and I let toaster watch and compile on its own, an empty app.js (i.e. empty function) results.

Whenever I exit toaster (ctrl-c) and restart it, app.coffee compiles and app.js is no longer an empty function (i.e. it's ok)

arboleya commented 11 years ago

Alright, it makes no sense at all.

It's like every time you save the file the file system reports a delete event instead of change.

You're using Windows 8 right?

Oh my, time to build a new VM.

mmikeyy commented 11 years ago

Yup! Windows 8.

I got the same problem when I worked on my cake file. Double triggering for every update to any file. Solution is simple: debounce all event-triggered function calls.

Hmm... actually, what I wrote probably seems clear, but it's actually a bit vague. If you just debounce fn calls, you'll just pick up the filename of the last file that was modified when a bunch of files are saved at the same time. What I do is each time a file needs to be updated, I create a function in an object (only if not already created) with key = pathname of the updated file, value = function to execute to compile just that file. And whenever a file is updated, it's that function (unique to each file) that is debounced before being executed. This way, all changed files get compiled, only once.

arboleya commented 11 years ago

Yep, I got it.

I've externalized the lib which take care of all filesystems operations, so now it should be a little easy to debug it. http://github.com/serpentem/fs-util

When I got the VM up and running I'll run the tests suite before anything else and so the work begins.

arboleya commented 11 years ago

@mmikeyy Hi, I made up a win8 vm and tested everything, and surprisingly it all worked gracefully.

Screen shot 2012-12-12 at 10 54 27 PM

Please, can you give detailed numbered steps to reproduce the error? Otherwise there's nothing I can do other than finally close this issue.

arboleya commented 11 years ago

Fixed in 0.6.6, please update and let me know if something weird occurs. Thanks. http://github.com/serpentem/coffee-toaster

mmikeyy commented 11 years ago

Anderson, Sorry for not getting back with test results. Totally overloaded these days and no time for testing stuff. I'll let you know how it goes in a few days (before xmas I hope)

arboleya commented 11 years ago

That's ok, tell me if you find any problems.

In case the weirdness continues, send me detailed steps to reproduce whats going on precisely, and tell me also what text editor you're using. I found a totally unexpected behavior when using VIM, maybe there's others conflicts related with another editors as well.

mmikeyy commented 11 years ago

Using sublime too. When I had the problem, I did nothing special: just changed a file and recompiling produced the error you've seen. We'll see how it goes when I try it again.