Class: Idcf::Cli::Lib::Util::CliFile

Inherits:
Object
  • Object
show all
Defined in:
lib/idcf/cli/lib/util/cli_file.rb

Overview

cli file

Class Method Summary collapse

Class Method Details

.mkdir(path) ⇒ Object

mkdir

Parameters:

  • path (String)

Raises:



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.message
end

.writable(path) ⇒ Object

writable

Parameters:

  • path (String)

Raises:



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