Class: FaaStRuby::Local::StaticFileProcessor

Inherits:
Processor
  • Object
show all
Defined in:
lib/faastruby/local/processors/static_file.rb

Instance Attribute Summary

Attributes inherited from Processor

#queue, #thread

Instance Method Summary collapse

Methods inherited from Processor

#add_ignore, #add_thread, #get_thread, #initialize, #kill_thread, #present_in_ignore_list?, #remove_ignore, #remove_thread_record, #run, #should_ignore?, #start, #start_thread

Methods included from Logger

#debug, puts, #puts

Constructor Details

This class inherits a constructor from FaaStRuby::Local::Processor

Instance Method Details

#added(event) ⇒ Object



5
6
7
8
9
10
# File 'lib/faastruby/local/processors/static_file.rb', line 5

def added(event)
  debug "added(#{event.inspect})"
  # This should trigger
  # - Copy to workspace
  deploy(event)
end

#deploy(event) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/faastruby/local/processors/static_file.rb', line 26

def deploy(event)
  static_file = StaticFile.new(
    full_path: event.full_path,
    relative_path: event.relative_path,
    filename: event.filename,
    dirname: event.dirname
  )
  run(event.relative_path, 'deploy') {static_file.deploy}
end

#modified(event) ⇒ Object



12
13
14
15
16
17
# File 'lib/faastruby/local/processors/static_file.rb', line 12

def modified(event)
  debug "modified(#{event.inspect})"
  # This should trigger
  # - Copy to workspace
  deploy(event)
end

#remove_from_workspace(event) ⇒ Object



36
37
38
39
40
41
42
43
44
# File 'lib/faastruby/local/processors/static_file.rb', line 36

def remove_from_workspace(event)
  static_file = StaticFile.new(
    full_path: event.full_path,
    relative_path: event.relative_path,
    filename: event.filename,
    dirname: event.dirname
  )
  run(event.relative_path, 'remove_from_workspace') {static_file.remove_from_workspace}
end

#removed(event) ⇒ Object



19
20
21
22
23
24
# File 'lib/faastruby/local/processors/static_file.rb', line 19

def removed(event)
  debug "removed(#{event.inspect})"
  # This should trigger
  # - Remove from workspace
  remove_from_workspace(event)
end