Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
IanDuncanson opened this issue Jul 17, 2012 · 33 comments
Closed

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

IanDuncanson opened this issue Jul 17, 2012 · 33 comments
Assignees

Comments

@IanDuncanson
Copy link

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
Copy link

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
Copy link
Owner

arboleya commented Aug 2, 2012

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
Copy link

kisPocok commented Aug 6, 2012

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
Copy link
Owner

arboleya commented Aug 9, 2012

@kisPocok , please see #30

I guess it's more a node-thing than a toaster-thing:
nodejs/node-v0.x-archive#1358

@mmikeyy
Copy link

mmikeyy commented Nov 16, 2012

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
Copy link
Owner

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
Copy link

mmikeyy commented Nov 16, 2012

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

@ghost ghost assigned arboleya Nov 19, 2012
@arboleya
Copy link
Owner

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
Copy link

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

@mmikeyy
Copy link

mmikeyy commented Nov 19, 2012

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
Copy link
Owner

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
Copy link

mmikeyy commented Nov 19, 2012

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
Copy link
Owner

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
Copy link

mmikeyy commented Nov 20, 2012

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
Copy link
Owner

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
Copy link
Owner

NOTE FOR ALL WINDOWS USERS: This windows thing urged me straight to an unwanted 😄 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
Copy link
Owner

arboleya commented Dec 6, 2012

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:
nodejs/node-v0.x-archive#4337

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

@arboleya
Copy link
Owner

arboleya commented Dec 8, 2012

@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
Copy link

mmikeyy commented Dec 9, 2012

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
Copy link
Owner

arboleya commented Dec 9, 2012

Ops there was a typo, again:

npm install -g git://github.com/serpentem/coffee-toaster#cross-platform-refactor

@mmikeyy
Copy link

mmikeyy commented Dec 9, 2012

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
Copy link
Owner

arboleya commented Dec 9, 2012

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
Copy link

mmikeyy commented Dec 9, 2012

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

@arboleya
Copy link
Owner

arboleya commented Dec 9, 2012

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

  1. Enter the example folder

cd coffee-toaster/examples/single-folder

  1. Starting watching / compiling it in debug mode:

toaster -wd

  1. Open any file in the src folder and try to:
  • Edit it, with valid syntax and save it.
  • Edit it again, with invalid syntax, and save it.
  • Edit it again, with invalid syntax, and save it.
  • Delete it (copy all contents before)
  • Re-create it (pasting the contents)
  • Fix the syntax error, and save it.

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
Copy link

mmikeyy commented Dec 9, 2012

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
Copy link
Owner

arboleya commented Dec 9, 2012

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
Copy link

mmikeyy commented Dec 9, 2012

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
Copy link
Owner

arboleya commented Dec 9, 2012

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
Copy link
Owner

@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
Copy link
Owner

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

@mmikeyy
Copy link

mmikeyy commented Dec 16, 2012

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
Copy link
Owner

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
Copy link

mmikeyy commented Dec 16, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants