Top Level Namespace
Defined Under Namespace
Modules: Broadside
Instance Method Summary collapse
- #add_command_flags(cmd) ⇒ Object
- #add_deploy_flags(cmd) ⇒ Object
- #add_instance_flag(cmd) ⇒ Object
- #add_tag_flag(cmd) ⇒ Object
- #add_target_flag(cmd) ⇒ Object
- #call_hook(type, command, options, args) ⇒ Object
Instance Method Details
#add_command_flags(cmd) ⇒ Object
20 21 22 23 |
# 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) ⇒ Object
25 26 27 28 |
# 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) ⇒ Object
13 14 15 16 17 18 |
# 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) ⇒ Object
1 2 3 4 5 |
# 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) ⇒ Object
7 8 9 10 11 |
# 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) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/broadside/gli/global.rb', line 24 def call_hook(type, command, , 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: , 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 |