Class: Iated::Application

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

Instance Method Summary collapse

Constructor Details

#initializeApplication

:nocov:



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
# File 'lib/iated.rb', line 26

def initialize
  @mcp = nil
  @optparse = OptionParser.new do |opts|
    opts.banner =    "Usage: #{opts.program_name} [OPTIONS]"

    opts.on('-p', '--port PORT', Integer,
            "The port number to run the server on (default: #{Iated.mcp.prefs.port}).") do |p|
      Iated.mcp.prefs.port = p
    end

    opts.on('-e', '--editor EDITOR', "Set editor (default #{Iated.mcp.prefs.editor}).") do |editor|
      Iated.mcp.prefs.editor = editor
    end

    opts.on('-u', '--ui UI', "Set the UI to be 'gui' or 'text' (default #{Iated.mcp.ui}).") do |ui|
      Iated.mcp.ui = ui.to_sym
    end

    opts.on('-d', '--debug', "Turn on debugging mode.") do
      Iated.mcp.debug = true
    end

    opts.on_tail('-h', '--help', 'Show this help.') do
      puts opts
      exit
    end
  end

end

Instance Method Details

#runObject

:nocov:



58
59
60
61
# File 'lib/iated.rb', line 58

def run
  @optparse.parse!
  Iated.mcp.begin!
end