Class: Webtask::CLI

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/webtask/cli.rb

Constant Summary collapse

DEFAULT_PORT =
4567.freeze
DEFAULT_BIND =
"127.0.0.1".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCLI

Returns a new instance of CLI.



13
14
15
16
# File 'lib/webtask/cli.rb', line 13

def initialize
  @port = DEFAULT_PORT
  @bind = DEFAULT_BIND
end

Instance Attribute Details

#bindObject

Returns the value of attribute bind.



11
12
13
# File 'lib/webtask/cli.rb', line 11

def bind
  @bind
end

#portObject

Returns the value of attribute port.



10
11
12
# File 'lib/webtask/cli.rb', line 10

def port
  @port
end

Instance Method Details

#show_helpObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/webtask/cli.rb', line 18

def show_help
  puts <<~HELP_TEXT
    webtask – A web GUI for your Rake tasks

    Options:

      -b   bind to a different address (default: #{DEFAULT_BIND})
      -p   bind to a different port (default: #{DEFAULT_PORT})
  HELP_TEXT
  exit
end