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

coffee -co fails compiling file names with a leading dot, within a directory (foo/.bar.coffee) #2539

Closed
leeola opened this issue Sep 9, 2012 · 7 comments
Labels

Comments

@leeola
Copy link

leeola commented Sep 9, 2012

It seems coffee -co fails when run on a directory that has file names leading with dots.

For example, assume you have the following directory structure..

foo/
    .bar.coffee
    baz.coffee

Now, if you run the command coffee -co foo foo, your output will be the following..

foo/
    .bar.coffee
    baz.coffee
    baz.js

As you can see, only baz.coffee is compiled. Is there a way to make .bar.coffee compile, without manually calling it? And, is this a bug?

@TrevorBurnham
Copy link
Collaborator

This was an intentional change: files/directories starting with . are ignored, because we were having a lot of problems due to the massive number of .coffee files often found in .git subdirectories. A . prefix is supposed to indicate that something is "hidden," so it seems sensible for the compiler to ignore such items. See #1537 and commit 127653b.

@satyr
Copy link
Collaborator

satyr commented Sep 11, 2012

files/directories starting with . are ignored

Interestingly it does appear to want such a file at times:

$ coffee foo/
File not found: foo/.coffee

@leeola
Copy link
Author

leeola commented Sep 11, 2012

@TrevorBurnham Could we perhaps get a .coffeeignore to resolve this?

It's sensible sure, but it would be nice to have a way to override default behaviors, or at least behaviors of ignore files.

@TrevorBurnham
Copy link
Collaborator

I don't think a .coffeeignore file would be a very intuitive solution, but I do think we should make it so that

coffee src/.foo.coffee

works, whereas

coffee src

should ignore such hidden files. That way you can use your shell to collect the names of hidden files and pass them in.

@TrevorBurnham TrevorBurnham reopened this Sep 11, 2012
@leeola
Copy link
Author

leeola commented Sep 12, 2012

Well .coffeeignore or perhaps some coffee src --allow .foo.coffee syntax wouldn't be the default, mind you, they would be overrides. I just feel it is an odd solution to blanket ignore all leading dot names, when the real goal is to ignore .git/.svn/etc.

.coffeeignore would have the added benefit of allowing additional names as well. For example, currently i have both JavaScript and CoffeeScript in my "src" directories. The reasoning behind this, is mostly because CoffeeScript can't properly handle hashbangs for executable javascript files (Coffee adds that stupid // Compiled with coffee script advertisement at the top.). It would be handy to have an easy solution, similar to .gitignore and .npmignore, to allow coffee to compile and or copy what it can't compile, to the destination directory.

Copying what it can't compile may not be an ideal solution of course, but it would still work for coffee script files without extensions, such as bin/imacoffeefile.

Note that a .coffeeignore file may seem unintuitive when looked at from the angle of "how do i show coffee-script a file", but it's the same concept as .gitignore or .npmignore. You would use !.*.coffee, to allow dot coffee files, the same as with git.

(Pardon any grammar oddities, i just woke up)

@jashkenas
Copy link
Owner

The way that Trevor says it should be working is the way it is working, as far as I can tell. If you explicitly pass the file name, it'll go.

I've pushed commits to make sure we have a file name before checking for a fallback ... and also one to move the generated by comment to the bottom of the file to get it out of the way. It's not actually an advertisement -- it's so that you don't get lost trying to compile a bit of CoffeeScript with an incompatible version of the compiler.

@leeola
Copy link
Author

leeola commented Feb 2, 2013

It's just a different mindset with the compiler, i guess. There was a similar issue where, when attempting to run coffee files. The coffee compiler was actually executing multiple files within the given directory. #2496

This was fixed, but if the compiler still ignores dot files than coffee -co directory is still a bad command. I feel like directories should be supported fully, or removed fully.

As it is, if you want to compile a project you can use coffee -co directory unless of course you have any dot files. If you do, you must write a wrapper around coffee to iterate through all the files and call coffee -co directory/.foo. Not a problem i guess, but it just seems odd to break common conventions with other language's compilers/runtimes (node/python/ruby?/etc) by ignoring all dot files.

edit: I take that back, #2496 was not fixed, i believe. I misread a project reference.

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

No branches or pull requests

4 participants