Class: Jenkins::CLI::CommandProxy
- Inherits:
-
Object
- Object
- Jenkins::CLI::CommandProxy
- Includes:
- Plugin::Proxy
- Defined in:
- lib/jenkins/cli/command_proxy.rb,
lib/jenkins/cli/command_proxy.rb,
lib/jenkins/cli/command_proxy.rb
Constant Summary collapse
- AbortException =
Java.hudson.AbortException
Instance Method Summary collapse
- #createClone ⇒ Object
-
#getName ⇒ Object
This mirrors what Java.hudson.cli.CLICommand#getName does, but with the @object’s class instead.
- #getShortDescription ⇒ Object
-
#main(args, locale, stdin, stdout, stderr) ⇒ Object
main(List<String> args, Locale locale, InputStream stdin, PrintStream stdout, PrintStream stderr).
- #run ⇒ Object
Methods included from Plugin::Proxy
Methods included from Plugin::Behavior
extended, #implemented, #included
Methods included from Plugin::Behavior::BehavesAs
Instance Method Details
#createClone ⇒ Object
24 25 26 27 28 |
# File 'lib/jenkins/cli/command_proxy.rb', line 24 def createClone self.dup.tap do |dup| dup.instance_variable_set(:@object, @object.dup) end end |
#getName ⇒ Object
This mirrors what Java.hudson.cli.CLICommand#getName does, but with the @object’s class instead.
32 33 34 |
# File 'lib/jenkins/cli/command_proxy.rb', line 32 def getName @object.class.command_name end |
#getShortDescription ⇒ Object
20 21 22 |
# File 'lib/jenkins/cli/command_proxy.rb', line 20 def getShortDescription @object.class.description end |
#main(args, locale, stdin, stdout, stderr) ⇒ Object
main(List<String> args, Locale locale, InputStream stdin, PrintStream stdout, PrintStream stderr)
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/jenkins/cli/command_proxy.rb', line 42 def main(args, locale, stdin, stdout, stderr) old_in, old_out, old_err = $stdin, $stdout, $stderr begin $stdin, $stdout, $stderr = stdin.to_io, stdout.to_io, stderr.to_io if @object.parse(args.to_a) @object.run return 0 else return -1 end rescue AbortException return -1 rescue => e $stderr.puts e. return -1 ensure $stdin, $stdout, $stderr = old_in, old_out, old_err end end |
#run ⇒ Object
36 37 38 39 |
# File 'lib/jenkins/cli/command_proxy.rb', line 36 def run # We don't call run from within our main, but needs to be here to satisfy the Java Interface raise RuntimeError, "This method should never be called." end |