Replace CLI class with a more suitable Application class

This commit is contained in:
2017-10-23 13:58:19 +01:00
parent ee4d363d3a
commit 6812e52dee
8 changed files with 199 additions and 127 deletions

View File

@@ -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)

View File

@@ -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