Class: Basketcase::UncheckoutCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/basketcase.rb

Instance Attribute Summary collapse

Attributes inherited from Command

#comment, #listener, #targets

Instance Method Summary collapse

Methods inherited from Command

#accept_args, #effective_targets, #option_comment, #option_graphical, #option_recurse, #report, #specified_targets

Methods included from Utils

#mkpath

Constructor Details

#initialize(*args) ⇒ UncheckoutCommand

Returns a new instance of UncheckoutCommand.



314
315
316
317
# File 'lib/basketcase.rb', line 314

def initialize(*args)
  super(*args)
  @action = '-keep'
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



325
326
327
# File 'lib/basketcase.rb', line 325

def action
  @action
end

Instance Method Details

#executeObject



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
# File 'lib/basketcase.rb', line 327

def execute
  cleartool_unsafe("uncheckout #{@action} #{specified_targets}") do |line|
    case line
    when /^Loading /
      # ignore
    when /^Making dir /
      # ignore
    when /^Checkout cancelled for "(.+)"\./
      report(:UNCO, mkpath($1))
    when /^Private version .* saved in "(.+)"\./
      report(:KEPT, mkpath($1))
    else
      cannot_deal_with line
    end
  end
end

#helpObject



306
307
308
309
310
311
312
# File 'lib/basketcase.rb', line 306

def help
  <<EOF
Undo a checkout, reverting to the checked-in version.

-r(emove)   Don\'t retain the existing version in a '.keep' file.
EOF
end

#option_removeObject Also known as: option_r



319
320
321
# File 'lib/basketcase.rb', line 319

def option_remove
  @action = '-rm'
end

#synopsisObject



302
303
304
# File 'lib/basketcase.rb', line 302

def synopsis
  "[-r] <element> ..."
end