lib/maprename/app.rb in maprename-0.1.0 vs lib/maprename/app.rb in maprename-0.1.1
- old
+ new
@@ -6,17 +6,20 @@
class App
def initialize(config_file)
@config = YAML.load(IO.read(config_file)).with_indifferent_access
end
- def run!(dry = false)
+ def run!(opts)
input_files.each do |file|
file = File.join(@config[:input][:directory], file)
- Maprename::Renamer.new(file, @config).rename!(dry)
+ Maprename::Renamer.new(file, @config).rename!(opts)
end
end
def input_files
- Dir.children(@config[:input][:directory]).grep(Regexp.new(@config[:input][:pattern]))
+ files = Dir.children(@config[:input][:directory]).grep(Regexp.new(@config[:input][:pattern]))
+ debug 'Matched input files:'
+ debug files.map { |f| ' %s' % f}
+ files
end
end
end