Class: Idcf::Cli::Lib::Util::CliFile
- Inherits:
-
Object
- Object
- Idcf::Cli::Lib::Util::CliFile
- Defined in:
- lib/idcf/cli/lib/util/cli_file.rb
Overview
cli file
Class Method Summary collapse
-
.mkdir(path) ⇒ Object
mkdir.
-
.writable(path) ⇒ Object
writable.
Class Method Details
.mkdir(path) ⇒ Object
mkdir
12 13 14 15 16 17 |
# 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. end |
.writable(path) ⇒ Object
writable
23 24 25 26 |
# 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 |