class Aptly::Watcher::EventDispatcher

Public Class Methods

new(aptly) click to toggle source
# File lib/aptly/watcher/event_dispatcher.rb, line 4
def initialize(aptly)
  @added = []
  @aptly = aptly
end

Public Instance Methods

process(dir, event, component) click to toggle source
# File lib/aptly/watcher/event_dispatcher.rb, line 9
def process(dir, event, component)
  return false unless valid_event?(event)
  
  filepath  = "#{dir}/#{event.name}"

  raise StandardError, "File not found: #{filepath}" unless File.exists? filepath

  @aptly.add(component, filepath)
  @aptly.publish

  @added << event.name
  true
end
valid_event?(event) click to toggle source
# File lib/aptly/watcher/event_dispatcher.rb, line 23
def valid_event?(event)
  return false if
    ( @added.include? event.name ) or
    ( event.name.nil? or event.name == '' )
  true
end