Class: Bixby::Provision::DirDSL
- Defined in:
- lib/bixby/provision/dsl/dir.rb
Constant Summary collapse
- EXPORTS =
[:mkdir, :mkdir_p]
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #create(path, opts = {}) ⇒ Object (also: #mkdir, #mkdir_p)
- #recreate(path, opts = {}) ⇒ Object
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.(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 |