Use Dir[..] with sort to prevent different results

It seems that older Ruby versions (before openSUSE 13.2) have a different
order of the file list than newer ones. This shouldn't happen with sort.