Class: PhoneGapConsole

Inherits:
Object
  • Object
show all
Defined in:
bin/phonegap

Overview

Wraps the command line and passes switches and options back to the PhoneGap class.

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'bin/phonegap', line 7

def self.parse(args)
   p = PhoneGap.new
   
   opts = OptionParser.new do |opts|
     b = <<-E
     
     PhoneGap #{ p.version }
     --------------
     Usage: phonegap [options]
     
     E
     opts.banner = b.gsub("      ","")

     opts.on("-g", "--generate PATH", "Generates a new PhoneGap application skeleton.") do |path|
       puts p.generate(path)
       exit
     end
     
     opts.on("-i", '--install', "Installs PhoneGap source #{ p.version } into ~/.phonegap") do 
       puts p.install_phonegap_sauce
       exit
     end
     
     opts.on("-b", "--build PATH", "Compiles your PhoneGapp application for supported platforms.") do |path|
       puts p.build(path)
       exit
     end 
     
     opts.on("-r", "--report", "Generates a report for supported SDK's.") do
       puts p.report
       exit
     end
     
     opts.on_tail("-h", "--help", "Display this message.") do
       puts "#{ opts }\n"
       exit
     end
     
     opts.on_tail("-v", "--version", "Display the version.") do
       puts p.version
       exit
     end
  end
  opts.parse!(args)
end