lib/maprename/renamer.rb in maprename-0.1.0 vs lib/maprename/renamer.rb in maprename-0.1.1
- old
+ new
@@ -8,11 +8,11 @@
class Renamer
def initialize(file, config)
@context = OpenStruct.new
@file = file
@config = config
-
+ debug "Process file: #@file"
parse_config!
end
def parse_config!
@config[:input][:name_parse].try do |parse_config|
@@ -27,13 +27,13 @@
Maprename::MappingParser.new(mapping_config).parse!(@context)
end
end
def rename!(dry)
- if dry
- puts "mkdir -p %s" % File.dirname(destination)
- puts "cp %s %s" % [source, destination]
- else
+ puts "mkdir -p %s" % File.dirname(destination)
+ puts "cp %s %s" % [source, destination]
+
+ unless dry
FileUtils.mkdir_p(File.dirname(destination))
FileUtils.copy_file(source, destination)
end
end