Class: Motion::Util::Dispatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-util/util.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.dispatcherObject



10
11
12
# File 'lib/motion-util/util.rb', line 10

def dispatcher
  @@despatcher ||= self.new
end

.usageObject



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/motion-util/util.rb', line 14

def usage
  <<-EOF
Usage:
motion-util: command [subcommand] [options]

command:
  generate    Generate class and spec files.
      You can use g or generator instead of generate.
  ib_header   Generate Objective-C header files for Interface Builder.
      You can use ibh instead of ib_header.

  EOF
end

Instance Method Details

#runObject

— instance methoods



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/motion-util/util.rb', line 32

def run
  cmd = nil
  case ARGV[0]
  when "generate", "generator", "g"
    cmd = Generator.new
  when "ib_header", "ibh"
    cmd = IbHeaderGenerator.new
  end
  if cmd
    cmd.run
  else
    $stderr.puts self.class.usage 
    exit
  end
end