lib/maprename/app.rb in maprename-0.1.3 vs lib/maprename/app.rb in maprename-0.1.4

- old
+ new

@@ -8,11 +8,18 @@ @config = YAML.load(IO.read(config_file)).with_indifferent_access end def run!(opts) input_files.each do |file| + begin file = File.join(@config[:input][:directory], file) Maprename::Renamer.new(file, @config).rename!(opts[:dry]) + rescue => e + STDERR.puts("Error occurs when processing file: #{file}, skipped") + if $debug + STDERR.puts "#{e.inspect}, #{e.backtrace}" + end + end end end def input_files files = Dir.children(@config[:input][:directory]).grep(Regexp.new(@config[:input][:pattern]))