Class: Utilikilt::Scanner
- Inherits:
-
Object
- Object
- Utilikilt::Scanner
- Includes:
- Loggable
- Defined in:
- lib/utilikilt/scanner.rb
Constant Summary collapse
- INPUT_TO_OUTPUT_EXT_MAP =
{ 'md' => 'html', 'markdown' => 'html', 'haml' => 'html', 'sass' => 'css', 'scss' => 'css', 'coffee' => 'js' }
- TILT_OPTIONS =
{:cache => false}
Instance Method Summary collapse
-
#initialize(opts) ⇒ Scanner
constructor
A new instance of Scanner.
- #scan ⇒ Object
Methods included from Loggable
Constructor Details
#initialize(opts) ⇒ Scanner
Returns a new instance of Scanner.
10 11 12 13 14 |
# File 'lib/utilikilt/scanner.rb', line 10 def initialize( opts ) @input_base = Pathname.new( opts['input_dir'] ). @output_base = Pathname.new( opts['output_dir'] ). @files_processed = 0 end |
Instance Method Details
#scan ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/utilikilt/scanner.rb', line 27 def scan @files_processed = 0 input_file_glob = '*.{'+INPUT_TO_OUTPUT_EXT_MAP.keys.join(',')+'}' Pathname.glob(File.join( @input_base, "**", input_file_glob )).each do |input| debug{"checking #{input}"} output = output_for_input(input) unless FileUtils.uptodate?( output, [input] ) filter( input, output ) end end log_files_processed end |