lib/vedeu/cli/helpers.rb in vedeu_cli-0.0.3 vs lib/vedeu/cli/helpers.rb in vedeu_cli-0.0.4

- old
+ new

@@ -51,54 +51,63 @@ end # @param destination [String] # @return [void] def make_directory(destination) - Vedeu.log_stdout(type: :create, message: "#{destination}") + log_processed_file(destination) FileUtils.mkdir_p(destination) end # @param source [String] # @param destination [String] # @return [void] def copy_file(source, destination) if File.exist?(destination) - skipped_file(destination) + log_skipped_file(destination) else - Vedeu.log_stdout(type: :create, message: "#{destination}") + log_processed_file(destination) FileUtils.cp(source, destination) end end # @param source [String] # @param destination [String] # @return [void] def make_file(source, destination) if File.exist?(destination) - skipped_file(destination) + log_skipped_file(destination) else - Vedeu.log_stdout(type: :create, message: "#{destination}") + log_processed_file(destination) File.write(destination, parse(source)) end end # @param destination [String] - # @return [void] - def skipped_file(destination) + # @return [TrueClass] + def log_processed_file(destination) + Vedeu.log_stdout(type: :create, message: "#{destination}") + + true + end + + # @param destination [String] + # @return [TrueClass] + def log_skipped_file(destination) Vedeu.log_stdout(type: :create, message: "#{destination} " + Esc.red { 'already exists, skipped.' }) + true end # @param destination [String] # @return [void] def touch_file(destination) - Vedeu.log_stdout(type: :create, message: "#{destination}") + log_processed_file(destination) FileUtils.touch(destination) end # @return [String]