mirror of
https://github.com/jimeh/bunnyrun.git
synced 2026-02-19 07:56:40 +00:00
Replace CLI class with a more suitable Application class
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
$LOAD_PATH.unshift(File.expand_path('../../lib', File.realpath(__FILE__)))
|
||||
require 'bunnyrun'
|
||||
require 'foobar'
|
||||
|
||||
cli = BunnyRun::CLI.new(
|
||||
name: File.basename(__FILE__),
|
||||
version: Foobar::VERSION
|
||||
)
|
||||
module Foobar
|
||||
class Application < BunnyRun::Application
|
||||
name File.basename(__FILE__)
|
||||
usage '<options> [<path>]'
|
||||
version Foobar::VERSION
|
||||
|
||||
cli.run(ARGV)
|
||||
option :log_message, 'Message to log after success', type: :string
|
||||
end
|
||||
end
|
||||
|
||||
Foobar::Application.run(argv: ARGV)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'bunnyrun'
|
||||
|
||||
module Foobar
|
||||
@@ -15,6 +17,7 @@ module Foobar
|
||||
|
||||
publish('ping-pong', 'PONG', routing_key: 'pong')
|
||||
message.ack
|
||||
logger.info
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user