Class: Pasu::Application

Inherits:
Cuba
  • Object
show all
Defined in:
lib/pasu/application.rb

Class Method Summary collapse

Class Method Details

.default_settingsObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pasu/application.rb', line 16

def default_settings
  {
    directory: Pathname.pwd,
    recursive: true,
    upload: false,
    basic_auth: {},
    host: '0.0.0.0',
    port: 8080,
    handler: 'Puma'
  }
end

.runObject



28
29
30
31
32
33
34
35
36
# File 'lib/pasu/application.rb', line 28

def run
  rack_handler = Rack::Handler.get(settings[:handler])
  rack_handler.run(
    self,
    Host: settings[:host],
    Port: settings[:port],
    Verbose: true
  )
end

.setup(options = {}) ⇒ Object



10
11
12
13
14
# File 'lib/pasu/application.rb', line 10

def setup(options = {})
  settings.merge!(default_settings)
  settings.merge!(options)
  setup_basic_auth
end