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

Returns a new instance of CommandLine.



21
22
23
24
25
26
27
28
29
# File 'lib/svnx/base/cmdline.rb', line 21

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.



18
19
20
# File 'lib/svnx/base/cmdline.rb', line 18

def error
  @error
end

#outputObject (readonly)

Returns the value of attribute output.



17
18
19
# File 'lib/svnx/base/cmdline.rb', line 17

def output
  @output
end

#statusObject (readonly)

Returns the value of attribute status.



19
20
21
# File 'lib/svnx/base/cmdline.rb', line 19

def status
  @status
end

Instance Method Details

#command_line(cmdargs) ⇒ Object



48
49
50
# File 'lib/svnx/base/cmdline.rb', line 48

def command_line cmdargs
  Command::Cacheable::Command.new cmdargs, caching: @caching, dir: Svnx::Env.instance.cache_dir
end

#executeObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/svnx/base/cmdline.rb', line 31

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