winton / stasis

Static sites made powerful
http://stasis.me
MIT License
677 stars 56 forks source link

Stasis rejects all files that start with public* #48

Closed HectorMalot closed 12 years ago

HectorMalot commented 12 years ago

I found this while running stasis on a project that had a file called publications.html.haml in the root path. This file gets excluded because it starts with the same characters as the destination path. This line seems to be the culprit.

I think that changing this:

# Reject paths that are directories or within the destination directory.
    @paths.reject! do |path|
      !File.file?(path) || path[0..@destination.length-1] == @destination
    end

to this would solve the issue:

# Reject paths that are directories or within the destination directory.
    @paths.reject! do |path|
      !File.file?(path) || path[0..@destination.length] == @destination+"/"
    end

(Because it will now match anything that starts with public/ rather than everything that starts with public. The actual public folder (not its contents) should be the only match to public (no slash), but this will already be excluded by the first validation where it checks for directories vs files.

I can create a pull request if you like.