Sha256: f76aca8cd0b09a500f24bbd270dd0a93dc526197f203adbfc8dd1adb06d73366
Contents?: true
Size: 1.49 KB
Versions: 3
Compression:
Stored size: 1.49 KB
Contents
module ThreeScaleToolbox module Command def self.included(base) base.extend(ClassMethods) end module ClassMethods def subcommands @subcommands ||= [] end def add_subcommand(command) subcommands << command end ## # Override to command # def command raise Exception, 'base command has no command definition' end ## # Iterate recursively over command tree # def build_command subcommands.each_with_object(command) do |subcommand, root_command| root_command.add_command(subcommand.build_command) end end end def config @config ||= ThreeScaleToolbox::Configuration.new(config_file) end def config_file options[:'config-file'] end def remotes @remotes ||= Remotes.new(config) end ## # Input param can be endpoint url or remote name # def threescale_client(str) ThreeScaleClientFactory.get(remotes, str, verify_ssl, verbose, keep_alive) end def verify_ssl # this is flag. It is either true or false. Cannot be nil !options[:insecure] end def verbose options[:verbose] end def keep_alive !options[:'disable-keep-alive'] end def exit_with_message(message) raise ThreeScaleToolbox::Error, message end def fetch_required_option(key) options.fetch(key) { exit_with_message "error: Missing argument #{key}" } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
3scale_toolbox-1.0.1 | lib/3scale_toolbox/base_command.rb |
3scale_toolbox-1.0.0 | lib/3scale_toolbox/base_command.rb |
3scale_toolbox-0.20.0 | lib/3scale_toolbox/base_command.rb |