Sha256: 645f9d03919dfe267eec1b29d220148905de77f48c76230270e7904a19d9d0ea

Contents?: true

Size: 794 Bytes

Versions: 2

Compression:

Stored size: 794 Bytes

Contents

#!/usr/bin/env ruby

# Run an agent.  Any agent.

require "brown"

unless ARGV.length == 1
  $stderr.puts "Must specify a single agent file to load."
  exit 1
end

require ARGV.first

agent_classes = ObjectSpace.each_object(Class).select do |k|
	k != Brown::Agent and k.ancestors.include?(Brown::Agent)
end

if agent_classes.length > 1
  $stderr.puts "Multiple subclasses of Brown::Agent found.  I don't know what to run."
  exit 1
elsif
  agent_classes.length == 0
  $stderr.puts "No subclass of Brown::Agent found.  I don't have anything to run."
  exit 1
end

agent_class = agent_classes.first

$0 = "brown: #{agent_class.to_s}"

begin
  agent_class.new(ENV).start
rescue ServiceSkeleton::Error::InvalidEnvironmentError => ex
  $stderr.puts "Configuration error: #{ex.message}"
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
brown-2.2.2.27.gbc378e8 bin/brown
brown-2.2.2.25.g85ddf08 bin/brown