Module: ClearcaseHelper::Executables

Included in:
CCFile, View
Defined in:
lib/clearcase_helper/executables.rb

Instance Method Summary collapse

Instance Method Details

#cleartool(command, options = {}) ⇒ Array[Boolean, String]

Returns success, stdout.

Parameters:

  • command (String)

    for dleartool to execute. including all cleartool options.

  • options (Hash) (defaults to: {})

    :noop => boolean, :vebose => boolean, :nostdout => boolean

Returns:

  • (Array[Boolean, String])

    success, stdout



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/clearcase_helper/executables.rb', line 6

def cleartool(command, options={})
  cmd = "cleartool #{command}"

  stdout  = options[:noop] ? '' : `#{cmd}`
  success = $? == 0

  puts "# #{cmd} (#{$?}, #{success})=>" if options[:verbose]
  if options[:verbose] && !options[:nostdout] && !stdout.empty?
    puts stdout.split("\n").collect {|l| "  #{l}"}.join("\n")
  end

  $stdout.flush

  return success, stdout
end