class Object
Public Instance Methods
add_command_flags(cmd)
click to toggle source
# File lib/broadside/gli/commands.rb, line 20 def add_command_flags(cmd) add_instance_flag(cmd) add_target_flag(cmd) end
add_deploy_flags(cmd)
click to toggle source
# File lib/broadside/gli/commands.rb, line 25 def add_deploy_flags(cmd) add_tag_flag(cmd) add_target_flag(cmd) end
add_instance_flag(cmd)
click to toggle source
# File lib/broadside/gli/commands.rb, line 13 def add_instance_flag(cmd) cmd.desc '0-based index into the array of running instances' cmd.default_value 0 cmd.arg_name 'INSTANCE' cmd.flag [:n, :instance], type: Integer end
add_tag_flag(cmd)
click to toggle source
# File lib/broadside/gli/commands.rb, line 1 def add_tag_flag(cmd) cmd.desc 'Docker tag for application container' cmd.arg_name 'TAG' cmd.flag [:tag] end
add_target_flag(cmd)
click to toggle source
# File lib/broadside/gli/commands.rb, line 7 def add_target_flag(cmd) cmd.desc 'Deployment target to use, e.g. production_web' cmd.arg_name 'TARGET' cmd.flag [:t, :target], type: Symbol, required: true end
call_hook(type, command, options, args)
click to toggle source
# File lib/broadside/gli/global.rb, line 24 def call_hook(type, command, options, args) hook = Broadside.config.public_send(type) return if hook.nil? raise "#{type} hook is not a callable proc" unless hook.is_a?(Proc) hook_args = { options: options, args: args } if command.parent.is_a?(GLI::Command) hook_args[:command] = command.parent.name hook_args[:subcommand] = command.name else hook_args[:command] = command.name end debug "Calling #{type} with args '#{hook_args}'" hook.call(hook_args) end