Class: Piston::Commands::Base

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

Direct Known Subclasses

Import, Info, LockUnlock, Update

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



12
13
14
15
# File 'lib/piston/commands/base.rb', line 12

def initialize(options={})
  @options = options
  logger.debug {"#{self.class.name} with options #{options.inspect}"}
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/piston/commands/base.rb', line 10

def options
  @options
end

Class Method Details

.loggerObject



5
6
7
# File 'lib/piston/commands/base.rb', line 5

def logger
  @@logger ||= Log4r::Logger["main"]
end

Instance Method Details

#forceObject



21
22
23
# File 'lib/piston/commands/base.rb', line 21

def force
  @options[:force]
end

#guess_wc(wcdir) ⇒ Object



33
34
35
# File 'lib/piston/commands/base.rb', line 33

def guess_wc(wcdir)
  Piston::WorkingCopy.guess(wcdir)
end

#loggerObject



29
30
31
# File 'lib/piston/commands/base.rb', line 29

def logger
  self.class.logger
end

#quietObject



25
26
27
# File 'lib/piston/commands/base.rb', line 25

def quiet
  @options[:quiet]
end

#verboseObject



17
18
19
# File 'lib/piston/commands/base.rb', line 17

def verbose
  @options[:verbose]
end

#working_copy!(wcdir) ⇒ Object



37
38
39
40
41
# File 'lib/piston/commands/base.rb', line 37

def working_copy!(wcdir)
  wc = guess_wc(wcdir)
  wc.validate!
  wc
end