Class: Evesync::OS::PackageWatcher
- Inherits:
-
Watcher::Interface
- Object
- Watcher::Interface
- Evesync::OS::PackageWatcher
- 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
Instance Method Summary collapse
-
#initialize(queue) ⇒ PackageWatcher
constructor
A new instance of PackageWatcher.
- #start ⇒ Object
- #stop ⇒ Object
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
#start ⇒ Object
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 |
#stop ⇒ Object
27 28 29 |
# File 'lib/evesync/os/linux/deb/package_watcher.rb', line 27 def stop @thr.exit end |