Class: BuildTool::Commands::Modules::MyShell
- Includes:
- MJ::Tools::SubProcess
- Defined in:
- lib/build-tool/commands/modules/shell.rb
Overview
BuildCommand
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Standard
#complete_module, #complete_modules, #initialize, #log_directory, #while_logging_to
Methods inherited from Base
#<=>, #applicable?, #cleanup_after_vcs_access, #complete_arguments, #complete_readline, #configuration, #debug, #debug2, #do_complete, #each_option, #error, #execute, #fullname, #info, #initialize, #log?, #setup_command, #setup_options, #show_help, #skip_command, #summarize, #teardown_command, #trace, #usage, #verbose, #warn
Methods included from HelpText
#cmdalias, #description, included, #long_description, #name
Constructor Details
This class inherits a constructor from BuildTool::Commands::Standard
Instance Method Details
#do_execute(args) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/build-tool/commands/modules/shell.rb', line 40 def do_execute( args ) # Check the number of commandline args if args.length != 1 return usage( "Wrong number of arguments" ) end # Translate argument into modules mod = complete_modules( args[0] ) if mod.length != 1 return usage( "This command only works on one module" ) end # Get our one and only module verbose "> #{@command}" rc = mod[0].environment.shell( @command, { detach: @detach } ) verbose "> #{rc}" if not @detach verbose "> send to background" if @detach return rc.exitstatus if not @detach return 0 end |
#initialize_options ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/build-tool/commands/modules/shell.rb', line 22 def . = "Usage: #{self.fullname} [OPTIONS]... MODULE" .separator( "" ) .separator( "Options" ) @command = ENV['SHELL'] .on( "-c", "--command COMMAND", "Execute command COMMAND (#{@command}]" ) { |c| @command = "#{ENV['SHELL']} -c '#{c}'" } @detach = nil .on( "-d", "--detach", "Detach the process and return immediately" ) { @detach = true } super end |