Sha256: 8d06931840ed0b254960af6851f2aa514f69ed629db40ff454d91549f7978f27

Contents?: true

Size: 702 Bytes

Versions: 4

Compression:

Stored size: 702 Bytes

Contents

#!/usr/bin/env ruby
require 'active-listener'

running = true
Signal.trap("TERM") do
  running = false
end

if ARGV[0].nil? or ARGV[1].nil? or (ARGV[0] != '--stop' and ARGV[2].nil?)
  puts "USAGE:"
  puts "\tactive-listener <config_file> <log_file> <rake_root>"
  puts "\tactive-listener --stop <pid_file>"
  exit(1)
end

if ARGV[0] == "--stop"
  ActiveListener.stop(:pid_file => ARGV[1])
  exit(0)
end

@al = ActiveListener.new :config => ARGV[0], :log_file => ARGV[1], :rake_root => ARGV[2]

if @al.events.empty?
  log = File.new(ARGV[1], 'a')
  log.write "ActiveListener is very boring without events"
  log.close
  running = false
end

while running
  @al.fire_events
  @al.sleep_to_next_event
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ngauthier-active-listener-0.2.0 bin/active-listener
ngauthier-active-listener-0.2.1 bin/active-listener
ngauthier-active-listener-0.2.2 bin/active-listener
ngauthier-active-listener-0.2.3 bin/active-listener