Class: Servel::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



2
3
4
# File 'lib/servel/cli.rb', line 2

def initialize(argv)
  @argv = argv
end

Instance Method Details

#path_mapObject



10
11
12
13
14
15
16
17
# File 'lib/servel/cli.rb', line 10

def path_map
  @argv.map do |arg|
    root, url_root = arg.split(":" , 2)
    root = Pathname.new(root).realpath

    [root, url_root || "/"]
  end.to_h
end

#startObject



6
7
8
# File 'lib/servel/cli.rb', line 6

def start
  Rack::Handler::Puma.run(Servel.build_app(path_map))
end