Class: Svnx::Base::CommandLine

Inherits:
Object
  • Object
show all
Includes:
Logue::Loggable
Defined in:
lib/svnx/base/cmdline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subcommand: nil, xml: true, caching: false, args: Array.new) ⇒ CommandLine



32
33
34
35
36
37
38
39
40
# File 'lib/svnx/base/cmdline.rb', line 32

def initialize subcommand: nil, xml: true, caching: false, args: Array.new
  debug "subcommand: #{subcommand}"
  debug "args: #{args}"
  @subcommand = subcommand
  @xml = xml
  @caching = caching
  @args = args
  debug "@args: #{@args}"
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error.



29
30
31
# File 'lib/svnx/base/cmdline.rb', line 29

def error
  @error
end

#outputObject (readonly)

Returns the value of attribute output.



28
29
30
# File 'lib/svnx/base/cmdline.rb', line 28

def output
  @output
end

#statusObject (readonly)

Returns the value of attribute status.



30
31
32
# File 'lib/svnx/base/cmdline.rb', line 30

def status
  @status
end

Instance Method Details

#command_line(cmdargs) ⇒ Object



59
60
61
62
# File 'lib/svnx/base/cmdline.rb', line 59

def command_line cmdargs
  cls = @caching ? CachingCommandLine : CmdLine::CommandLine
  cls.new cmdargs
end

#executeObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/svnx/base/cmdline.rb', line 42

def execute
  cmdargs = [ 'svn', @subcommand ]
  cmdargs << '--xml' if @xml
  cmdargs.concat @args
  debug "cmdargs: #{cmdargs}"
  
  cmdline = command_line cmdargs
  cmdline.execute
  debug "cmdline: #{cmdline}"
  
  @output = cmdline.output
  @error = cmdline.error
  @status = cmdline.status

  @output
end