Class: Producer::Core::Actions::Mkdir

Inherits:
Producer::Core::Action show all
Defined in:
lib/producer/core/actions/mkdir.rb

Constant Summary

Constants inherited from Producer::Core::Action

Producer::Core::Action::INSPECT_ARGUMENTS_SUM_LEN

Instance Attribute Summary

Attributes inherited from Producer::Core::Action

#arguments, #env, #options

Instance Method Summary collapse

Methods inherited from Producer::Core::Action

#initialize, #to_s

Constructor Details

This class inherits a constructor from Producer::Core::Action

Instance Method Details

#applyObject



16
17
18
19
20
21
22
# File 'lib/producer/core/actions/mkdir.rb', line 16

def apply
  @path.descend do |p|
    next if fs.dir? p
    fs.mkdir p.to_s
    fs.setstat p.to_s, @options unless @options.empty?
  end
end

#nameObject



12
13
14
# File 'lib/producer/core/actions/mkdir.rb', line 12

def name
  'mkdir'
end

#setupObject



5
6
7
8
9
10
# File 'lib/producer/core/actions/mkdir.rb', line 5

def setup
  check_arguments_size! 1
  @path = Pathname.new(arguments.first)
  @options[:permissions]  = @options.delete :mode if @options.key? :mode
  @options[:owner]        = @options.delete :user if @options.key? :user
end