Method: Webby::Apps::Generator#site_files
- Defined in:
- lib/webby/apps/generator.rb
#site_files ⇒ Object
Iterates over all the files in the template directory and stores them in a hash.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'lib/webby/apps/generator.rb', line 229 def site_files exclude = %r/tmp$|bak$|~$|CVS|\.svn/o rgxp = %r/\A#{template}\/?/o paths = Hash.new {|h,k| h[k] = []} Find.find(template) do |p| next if exclude =~ p if test(?d, p) paths[p.sub(rgxp, '')] next end dir = ::File.dirname(p).sub(rgxp, '') paths[dir] << p.sub(rgxp, '') end paths end |