lib/vedeu/cli/helpers.rb in vedeu_cli-0.0.5 vs lib/vedeu/cli/helpers.rb in vedeu_cli-0.0.6
- old
+ new
@@ -54,37 +54,47 @@
# @return [void]
def make_directory(destination)
log_processed_file(destination)
FileUtils.mkdir_p(destination)
+
+ true
end
# @param source [String]
# @param destination [String]
# @return [void]
def copy_file(source, destination)
if File.exist?(destination)
log_skipped_file(destination)
+ false
+
else
log_processed_file(destination)
FileUtils.cp(source, destination)
+
+ true
end
end
# @param source [String]
# @param destination [String]
# @return [void]
def make_file(source, destination)
if File.exist?(destination)
log_skipped_file(destination)
+ false
+
else
log_processed_file(destination)
File.write(destination, parse(source))
+
+ true
end
end
# @param destination [String]
# @return [TrueClass]
@@ -97,19 +107,23 @@
# @param destination [String]
# @return [TrueClass]
def log_skipped_file(destination)
Vedeu.log_stdout(type: :create,
message: "#{destination} " +
- Esc.red { 'already exists, skipped.' })
+ Vedeu::EscapeSequences::Esc.red {
+ 'already exists, skipped.'
+ })
true
end
# @param destination [String]
# @return [void]
def touch_file(destination)
log_processed_file(destination)
FileUtils.touch(destination)
+
+ true
end
# @return [String]
def name
@_name ||= @name.downcase