Class: Piston::Commands::LockUnlock

Inherits:
Base
  • Object
show all
Defined in:
lib/piston/commands/lock_unlock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#force, #guess_wc, #initialize, logger, #logger, #quiet, #verbose, #working_copy!

Constructor Details

This class inherits a constructor from Piston::Commands::Base

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/piston/commands/lock_unlock.rb', line 6

def options
  @options
end

Instance Method Details

#run(wcdir, lock) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/piston/commands/lock_unlock.rb', line 8

def run(wcdir, lock)
  working_copy = working_copy!(wcdir)

  values = working_copy.recall
  values["lock"] = lock
  working_copy.remember(values, values["handler"])
  working_copy.finalize

  text = lock ? "Locked" : "Unlocked"
  logger.info "#{text} #{working_copy} against automatic updates"
end