Class: Artserve

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/artserve.rb,
lib/artserve/service.rb

Overview

todo/check: find a better name?

Class Method Summary collapse

Class Method Details

.main(argv = ARGV) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/artserve.rb', line 14

def self.main( argv=ARGV )
   puts 'hello from main with args:'
   pp argv

   path = argv[0] || './artbase.db'

   ## if passed in a directory, auto-add /artbase.db for now - why? why not
   path += "/artbase.db"  if Dir.exist?( path )


   puts "  using database: >#{path}<"

   ## note: let's you use  latter settings.artbase (resulting in path)
   set( :artbase, path )


#####
# fix/todo:
##   use differnt port ??
##
##  use --local  for host e.g. 127.0.0.1  insteaod of 0.0.0.0 ???

 #   puts 'before Puma.run app'
 #   require 'rack/handler/puma'
 #   Rack::Handler::Puma.run ProfilepicService, :Port => 3000, :Host => '0.0.0.0'
 #   puts 'after Puma.run app'

 # use webrick for now - why? why not?
   puts 'before WEBrick.run service'
   Rack::Handler::WEBrick.run Artserve, :Port => 3000, :Host => '127.0.0.1'
   puts 'after WEBrick.run service'

  puts 'bye'
end