Class: Resource::Directory
Instance Method Summary collapse
-
#initialize(target, &block) ⇒ Directory
constructor
A new instance of Directory.
- #run ⇒ Object
Methods inherited from Base
inherited, #not_if, #set_base_defaults, #should_skip?, #unix_mode
Methods included from ClassAttr
Methods included from BlockAttr
Constructor Details
#initialize(target, &block) ⇒ Directory
7 8 9 10 11 |
# File 'lib/resource/directory.rb', line 7 def initialize target, &block set_base_defaults @target = target self.instance_eval(&block) end |
Instance Method Details
#run ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/resource/directory.rb', line 13 def run Execution.block 'Creating directory', @target, 'root' do |b| b.always_run @always_run b.run "mkdir -p #{@target}" b.run "chmod #{unix_mode} #{@target}" b.run "chown #{@owner}:#{@group} #{@target}" end end |