Class: Bixby::Provision::DirDSL

Inherits:
Base
  • Object
show all
Defined in:
lib/bixby/provision/dsl/dir.rb

Constant Summary collapse

EXPORTS =
[:mkdir, :mkdir_p]

Constants inherited from Base

Base::PATH

Instance Attribute Summary

Attributes inherited from Base

#manifest, #proxy

Instance Method Summary collapse

Methods inherited from Base

#get_gid, #get_group, #get_uid, #get_user, #initialize, #tap

Methods included from Util::File

#chmod, #chown, #sha256sum, #which

Constructor Details

This class inherits a constructor from Bixby::Provision::Base

Instance Method Details

#create(path, opts = {}) ⇒ Object Also known as: mkdir, mkdir_p



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bixby/provision/dsl/dir.rb', line 9

def create(path, opts={})
  logger.info "[dir] ensuring #{path} exists"
  path = File.expand_path(path)
  begin
    FileUtils.mkdir_p(path) if !File.exists? path
    chown(path, opts[:chown])
    chmod(path, opts[:chmod])
  rescue Errno::EACCES => ex
    logger.info "[dir] permission denied, trying again with sudo"
    logged_sudo("mkdir -p #{path}")
    chown(path, opts[:chown])
    chmod(path, opts[:chmod])
  end
end

#recreate(path, opts = {}) ⇒ Object



26
27
# File 'lib/bixby/provision/dsl/dir.rb', line 26

def recreate(path, opts={})
end