class Idcf::Cli::Lib::Util::CliFile
cli file
Public Class Methods
mkdir(path)
click to toggle source
mkdir
@param path [String] @raise
# File lib/idcf/cli/lib/util/cli_file.rb, line 12 def mkdir(path) target = file?(path) ? File.dirname(path) : path FileUtils.mkdir_p(target, mode: 0o755) rescue StandardError => e raise Idcf::Cli::Error::CliError, e.message end
writable(path)
click to toggle source
writable
@param path [String] @raise
# File lib/idcf/cli/lib/util/cli_file.rb, line 23 def writable(path) msg = "Permission error (#{path})" raise Idcf::Cli::Error::CliError, msg unless File.writable?(path) end
Protected Class Methods
file?(path)
click to toggle source
# File lib/idcf/cli/lib/util/cli_file.rb, line 30 def file?(path) return false if Dir.exist?(path) last_path = path.split('/').pop last_path.split('.').size > 1 end