Method: Falsework::Mould#upgradable_files
- Defined in:
- lib/falsework/mould.rb
#upgradable_files ⇒ Object
Search for all files in the template directory the line
/^..? :erb:/
in first n lines. If the line is found, the file is considered a candidate for an upgrade. Return a hash target:template
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
# File 'lib/falsework/mould.rb', line 362 def upgradable_files() line_max = 4 r = {} Mould.traverse(@dir_t) {|i| next if File.directory?(i) next if File.symlink?(i) # hm... File.open(i) {|fp| n = 0 while n < line_max && line = fp.gets if line =~ /^..? :erb:/ t = i.sub(/#{@dir_t}\//, '') r[Mould.get_filename(t, binding)] = i break end n += 1 end } } r end |