Class: Pasu::Application

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

Class Method Summary collapse

Class Method Details

.default_settingsObject



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

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

.runObject



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

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



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

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