Class: SvnAuto::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/svnauto/command.rb

Direct Known Subclasses

Bug, Checkout, Config, Create, Experimental, Externals, Info, List, Release

Constant Summary collapse

VALID_SET_KEYS =
Set.new([
 :name, 
 :description, 
 :example,
 :without_project, 
 :without_repository,
 :usage,
 :args_min,
 :args_max,
])

Class Method Summary collapse

Class Method Details

.commandsObject



61
62
63
# File 'lib/svnauto/command.rb', line 61

def self.commands
  instance_eval { @commands }
end

.force?Boolean

Was the –force option given to the command?

Returns:

  • (Boolean)


86
87
88
# File 'lib/svnauto/command.rb', line 86

def self.force?
  instance_eval { @opthash[:force] }
end

.inherited(klass) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/svnauto/command.rb', line 44

def self.inherited (klass)
  klass.instance_eval do
    @options = OptionParser.new
    @opthash ||= {}
    @attributes = {}
  end

  instance_eval do
    (@commands ||= []) << klass
  end

  klass.option('-f', '--force', "Don't display any confirmation prompts") do |val, opthash|
    opthash[:force] = true
  end
end

.optionsObject



66
67
68
# File 'lib/svnauto/command.rb', line 66

def self.options
  instance_eval { @options }
end

.reset!Object

reset to a good state, mostly for testing, since commands get run over and over



80
81
82
# File 'lib/svnauto/command.rb', line 80

def self.reset!
  instance_eval { @opthash.clear }
end