Sha256: e89371a87680d336a00ec9ba1de940772c411829df6043be1a2104432b8d2230

Contents?: true

Size: 1.37 KB

Versions: 6

Compression:

Stored size: 1.37 KB

Contents

require "rubygems"
require 'gorgon/originator'
require 'gorgon/listener'
require 'gorgon/worker_manager'
require 'gorgon/ping_service'
require 'gorgon/gem_service'
require 'gorgon/version'

WELCOME_MSG = "Welcome to Gorgon #{Gorgon::VERSION}"

def start
  o = Originator.new
  o.originate
end

def listen
  l = Listener.new
  l.listen
end

def manage_workers
  config_path = ENV["GORGON_CONFIG_PATH"]

  manager = WorkerManager.build config_path
  manager.manage

  # For some reason I have to 'exit' here, otherwise WorkerManager process crashes
  exit
end

def ping_listeners
  PingService.new.ping_listeners
end

def run_gem command
  GemService.new.run command
end

def usage
  #print instructions on how to use gorgon
  puts "\tstart - remotely runs all tests specified in gorgon.json"
  puts "\tlisten - starts a listener process using the settings in gorgon_listener.json"
  puts "\tping - pings listeners and shows hosts and gorgon's version they are running"
  puts "\tgem command [options...] - execute the gem command on every listener and shutdown listener. e.g. 'gorgon gem install --version 1.0.0'"
end

puts WELCOME_MSG

case ARGV[0]
when nil
  start
when "start"
  start
when "listen"
  listen
when "manage_workers"
  manage_workers
when "ping"
  ping_listeners
when "gem"
  ARGV.shift
  run_gem ARGV.join(' ')
when "help"
  usage
else
  puts "Unknown command!"
  usage
  exit 1
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gorgon-0.4.0 bin/gorgon
gorgon-0.4.0.rc2 bin/gorgon
gorgon-0.4.0.rc1 bin/gorgon
gorgon-0.3.2 bin/gorgon
gorgon-0.3.1 bin/gorgon
gorgon-0.3.0 bin/gorgon