Class: IOSDevTools::Help

Inherits:
Object
  • Object
show all
Defined in:
lib/ios_dev_tools/commands/help.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Help

Returns a new instance of Help.



38
39
40
41
42
# File 'lib/ios_dev_tools/commands/help.rb', line 38

def initialize options

  @options=options

end

Class Method Details

.create_with_args(cmd_line_arguments) ⇒ Object



17
18
19
20
21
22
# File 'lib/ios_dev_tools/commands/help.rb', line 17

def self.create_with_args cmd_line_arguments

  options=parse_options cmd_line_arguments
  return Help.new options

end

.display_bannerObject



81
82
83
84
85
# File 'lib/ios_dev_tools/commands/help.rb', line 81

def self.display_banner
  puts "iOS Development Tools v.#{VERSION}

"
end

.parse_options(args) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/ios_dev_tools/commands/help.rb', line 27

def self.parse_options(args)

  options={}
  options[:help_option]=args[0]

  return options
end

Instance Method Details

#display_available_commandsObject



90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/ios_dev_tools/commands/help.rb', line 90

def display_available_commands
  puts "
  Available commands:

sign    - sign application bundle/archive
verify  - verify application bundle/archive
pack    - pack application bundle into archive

  Execute following command to see command specific help

ios_tool help [COMMAND NAME]
       "

end

#display_command_specific_help(command_name) ⇒ Object



125
126
127
128
# File 'lib/ios_dev_tools/commands/help.rb', line 125

def display_command_specific_help command_name
  command_class=Tool.command_name_to_class command_name
  command_class.display_help
end

#display_generic_helpObject



108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/ios_dev_tools/commands/help.rb', line 108

def display_generic_help
  puts "

  TODO: ios_tool help


help commands       - displays available commands
help [COMMAND NAME] - displays command specific help


       "

end

#display_unknown_command(command_name) ⇒ Object



71
72
73
74
75
76
# File 'lib/ios_dev_tools/commands/help.rb', line 71

def display_unknown_command command_name
  puts "
ERROR: Unknown command: #{command_name}
"
  display_generic_help
end

#executeObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ios_dev_tools/commands/help.rb', line 47

def execute

  Help.display_banner

  if not @options[:help_option]
    # no option give, display generic help
    display_generic_help
  elsif @options[:help_option]=="commands"
    # list of commands requested
    display_available_commands
  else
    # command specific help requested
    command_name=@options[:help_option]
    if not Tool.valid_command_name? command_name
        display_unknown_command command_name
    else
      display_command_specific_help command_name
    end
  end
end