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

Fix template names when walkdir returns absolute paths. #71

Merged
merged 1 commit into from
Aug 6, 2013

Conversation

pwnall
Copy link
Collaborator

@pwnall pwnall commented Jul 7, 2013

I used the following command in Ubuntu 12.04.2 with node 0.10.12

haml-coffee -i . -o ../some/path/templates.js

The template names contained absolute paths instead of relative paths. I traced that to walkdir returning absolute paths when called as walkdir.sync('.'). This change works around the walkdir oddness and gets the correct template names.

@@ -185,6 +186,10 @@ exports.run = ->

# Loop through all Haml files and compile them
for filename in walkdir.sync baseDir
# walkdir sometimes returns absolute paths
if filename.substring(0, 1) is '/'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filename = path.relative baseDir, filename if filename[..0] is '/'

Seems a bit more coffee-ish. Just a minor nitpick though.

@mehcode
Copy link
Collaborator

mehcode commented Jul 7, 2013

Looks good to me. Thanks for the contribution.

Would you mind adding a test case to the spec that proves the bug existed (and that this patch fixes it) before we merge this in?

@netzpirat
Copy link
Owner

Thanks for the PR and @mehcode for handling this. I'm on holiday and won't be able to do any work before the first week of August. I'm fine merging this without tests, because we do not have a single unit test yet at all.

@netzpirat netzpirat merged commit da51fc7 into netzpirat:master Aug 6, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants