Move `lib` directory to a correct position, fixes test that do not work.
require_dependencies should be sorted for each directory.
Improve code (@ujifgc's suggestion).
Merge pull request #1527 from padrino/fix-require_dependencies

require_dependencies should be sorted for each directory.