Sha256: bbe665c57a34c9392b55fe43fcfc68872eabf6f42b2afe581d45a529ff2b0f91
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 Bytes
Contents
require 'cinch' require 'file-tail' module Cinch module Plugins # Cinch plugin to report usage of Sudo on a machine class Sudo include Cinch::Plugin listen_to :connect def initialize(*args) super @logfile = config[:logfile] @channel = config[:channel] end def listen(_m) if File.exist?(@logfile) start_tail else debug "File (#{@filename}) not found!" end end private def start_tail File.open(@logfile) do |log| log.extend(File::Tail) log.interval = 3 log.backward(0) log.tail do |line| entry = Entry.new(line) next unless entry.valid? Channel(@channel).send entry.to_text end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cinch-sudo-0.1.1 | lib/cinch/plugins/sudo.rb |