Class: Evesync::OS::PackageWatcher

Inherits:
Watcher::Interface show all
Defined in:
lib/evesync/os/linux/arch/package_watcher.rb,
lib/evesync/os/linux/deb/package_watcher.rb,
lib/evesync/os/linux/rhel/package_watcher.rb

Overview

Watcher for package changes for Arch Linux

Example

Thread.new { IPC::Data::PackageWatcher.new(queue).run }

Instance Method Summary collapse

Constructor Details

#initialize(queue) ⇒ PackageWatcher

Returns a new instance of PackageWatcher.



8
9
10
11
12
# File 'lib/evesync/os/linux/deb/package_watcher.rb', line 8

def initialize(queue)
  @queue = queue
  @dpkg = Dpkg.new
  Log.debug('Debian Package watcher initialized')
end

Instance Method Details

#startObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/evesync/os/linux/deb/package_watcher.rb', line 14

def start
  Log.debug('Debian Package watcher started')
  @thr = Thread.new do
    loop do
      sleep 10
      @dpkg.changes.each do |pkg|
        @queue << pkg
        Log.debug 'Debian Package watcher enqued:', pkg
      end
    end
  end
end

#stopObject



27
28
29
# File 'lib/evesync/os/linux/deb/package_watcher.rb', line 27

def stop
  @thr.exit
end