Class: Mockup::Options

Inherits:
Object show all
Defined in:
lib/mockup/options.rb

Class Method Summary collapse

Class Method Details

.parse(args) ⇒ Object



4
5
6
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/mockup/options.rb', line 4

def self.parse(args)
  options = OpenStruct.new
  
  ParseOptions.new(args) do |opts|

    opts.value('create') do |name|
      options.name = name
    end

    opts.boolean('convert') do |convert|
      options.convert = !!convert
    end

    opts.value('-l', '--location') do |location|
      options.location = location
    end
    
    opts.boolean('with-jquery') do |jquery|
      options.jquery = !!jquery
    end
    
    opts.boolean('with-mootools') do |mootools|
      options.mootools = !!mootools
    end
    
    opts.boolean('with-prototype') do |prototype|
      options.prototype = !!prototype
    end

    opts.help('help', '-h') do
      puts <<-HELP

Usage: mockup create name --location /path/to/mockup

Mockup Options:

create:           The name of the mockup project. 
                e.g. mockup create project
                
-l:               Specify a location to create your mockup project. 
                e.g. mockup create project -l /path/to/mockup
                
convert:          Convert an existing Compass project to a mockup project. 
                e.g. mockup convert
                
with-jquery       Install jQuery and jQuery UI
                e.g. mockup create project with-jquery

with-mootools     Install Mootools
                e.g. mockup create project with-mootools

with-prototype   Install Prototype and Scriptaculous
                e.g. mockup create project with-prototype

help              View the Help Screen
version           View the current version of mockup

      HELP
      exit(0)
    end

    opts.version('-v', 'version') do
      puts "Mockup's current version is #{Mockup.version}"
      exit(0)
    end
  end
  options
end