bin/launcher.example in pigeon-0.2.0 vs bin/launcher.example in pigeon-0.3.0
- old
+ new
@@ -1,54 +1,6 @@
#!/usr/bin/env ruby
-COMMAND_NAME = 'launcher'
-engine = engine
+$LOAD_PATH << File.expand_path(File.join(*%w[ .. lib ]), File.dirname(__FILE__))
+require 'pigeon'
-options = {
- :dir => engine.pid_dir,
- :debug => true, # ((ENV['RAILS_ENV'] == 'production') ? ENV['PINGITY_DEBUG'] : true),
- :modules => [ ]
-}
-
-begin
- case (command)
- when 'start'
- engine.start(options) do |pid|
- puts "Pigeon Engine now running. [%d]" % pid
- end
- when 'stop'
- engine.stop(options) do |pid|
- if (pid)
- puts "Pigeon Engine shut down. [%d]" % pid
- else
- puts "Pigeon Engine was not running."
- end
- end
- when 'restart'
- engine.restart(options) do |old_pid, new_pid|
- if (old_pid)
- puts "Pigeon Engine terminated. [%d]" % old_pid
- end
- puts "Pigeon Engine now running. [%d]" % new_pid
- end
- when 'status'
- engine.status(options) do |pid|
- if (pid)
- puts "Pigeon Engine running. [%d]" % pid
- else
- puts "Pigeon Engine is not running."
- end
- end
- when 'run'
- options[:logger] = Pigeon::Logger.new(STDOUT)
-
- engine.run(options) do |pid|
- puts "Pigeon Engine now running. [%d]" % pid
- puts "Use ^C to terminate."
- end
- else
- puts "Usage: #{COMMAND_NAME} [start|stop|restart|status|run]"
- end
-rescue Interrupt
- puts "Shutting down."
- exit(0)
-end
+Pigeon::Launcher.new(Pigeon::Engine).handle_args(ARGV)