documentcloud / jammit

Industrial Strength Asset Packaging for Rails
http://documentcloud.github.io/jammit/
MIT License
1.16k stars 197 forks source link

Updated glob sorting to sort files in parent directories ahead of files in sub-directories. #195

Open liehann opened 13 years ago

liehann commented 13 years ago

Previously Dir[].sort was called, which would result in the following sort order: /a/a/a.js /a/b.js

The patch changes the sort order to the following: /a/b.js /a/a/a.js

My motivation for the patch was having the following structure: views/views.js views/model/action.js

view.js defined a views namespace. action.js used it. Of course there are other ways to fix this, but the updated sort order seemed to make sense anyway.

I added one test to test the behaviour.