Class: Hookit::Resource::File

Inherits:
Base
  • Object
show all
Defined in:
lib/hookit/resource/file.rb

Instance Attribute Summary

Attributes inherited from Base

#dict

Instance Method Summary collapse

Methods inherited from Base

#action, actions, #can_run?, default_action, #default_action, field, #not_if, #only_if

Constructor Details

#initialize(name) ⇒ File

Returns a new instance of File.



14
15
16
17
# File 'lib/hookit/resource/file.rb', line 14

def initialize(name)
  path name unless path
  super
end

Instance Method Details

#run(action) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/hookit/resource/file.rb', line 19

def run(action)
  case action
  when :create
    create!
    chown!
    chmod!            
  when :create_if_missing
    create_if_missing!
    chown!
    chmod!
  when :delete
    delete!
  when :touch
    touch!
  end
end