Sha256: fc74b8ddb10b46c8a22f2b9f05881599198496c0f9d460546547dec0ba2caa8b
Contents?: true
Size: 1.47 KB
Versions: 2
Compression:
Stored size: 1.47 KB
Contents
module WIP module Runner::Spec module Helpers::CommandHelpers def define_command(&block) klass = Class.new(WIP::Runner::Command) klass.instance_exec do def name 'Command' end end klass.class_exec(&block) klass end def example_command(implementation) ExampleCommands.const_get(implementation).new(ui) end module ExampleCommands class Simple < WIP::Runner::Command def execute(args, options) @executed = true end def executed? !! @executed end end class WithOptions < Simple options do |parser, config| config.flagged = false parser.on('-f', '--flag', 'Option 1') do config.flagged = true end end attr_reader :flagged def execute(args, options) super @flagged = options.flagged end end class WithArguments < Simple argument :arg_01, { overview: 'Argument 1' } argument :arg_02, { overview: 'Argument 2' } end class WithNested < Simple ; end class WithNested::Nested < Simple overview 'A nested command' def execute(args, options) super @ui.out { @ui.say('running nested command...') } end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
wip-runner-0.4.1 | lib/wip/runner/spec/helpers/command_helpers.rb |
wip-runner-0.4.0 | lib/wip/runner/spec/helpers/command_helpers.rb |