Class: Jenkins::Launcher
- Inherits:
-
Object
- Object
- Jenkins::Launcher
- Includes:
- Plugin::Wrapper
- Defined in:
- lib/jenkins/launcher.rb
Overview
Launch processes on build slaves. No functionality is currently exposed
Defined Under Namespace
Classes: Proc
Instance Attribute Summary
Attributes included from Plugin::Wrapper
Instance Method Summary collapse
-
#execute(*args) ⇒ Object
execute( command… [,options]) -> fixnum.
-
#spawn(*args) ⇒ Object
spawn( command… [,options]) -> proc.
Methods included from Plugin::Wrapper
Methods included from Plugin::Behavior
extended, #implemented, #included
Methods included from Plugin::Behavior::BehavesAs
Instance Method Details
#execute(*args) ⇒ Object
execute( command… [,options]) -> fixnum
38 39 40 |
# File 'lib/jenkins/launcher.rb', line 38 def execute(*args) spawn(*args).join end |
#spawn(*args) ⇒ Object
spawn( command… [,options]) -> proc
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/jenkins/launcher.rb', line 43 def spawn(*args) env, cmd, = scan_args(args) starter = @native.launch() starter.envs(env) if opt_chdir = [:chdir] starter.pwd(opt_chdir.to_s) end if opt_in = [:in] starter.stdin(opt_in.to_inputstream) end if opt_out = [:out] if opt_out.is_a?(Jenkins::Model::Listener) starter.stdout(Jenkins::Plugin.instance.export(opt_out)) else starter.stdout(opt_out.to_outputstream) end end if opt_err = [:err] starter.stderr(opt_err.to_outputstream) end case cmd when Array starter.cmds(cmd) else begin # when we are on 1.432, we can use cmdAsSingleString starter.cmdAsSingleString(cmd.to_s) rescue NoMethodError # http://d.hatena.ne.jp/sikakura/20110324/1300977208 is doing # Arrays.asList(str.split(" ")) which should be wrong. require 'shellwords' starter.cmds(*Shellwords.split(cmd.to_s)) end end Proc.new(starter.start()) end |