Class: Sem4rSinatra::CliServer

Inherits:
Object
  • Object
show all
Defined in:
lib/sem4r_sinatra/cli_server.rb

Overview

Build a catalogue starting from a directory

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.runObject



8
9
10
# File 'lib/sem4r_sinatra/cli_server.rb', line 8

def self.run
  return self.new.parse_args( ARGV )
end

Instance Method Details

#parse_args(argv) ⇒ Object



12
13
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
# File 'lib/sem4r_sinatra/cli_server.rb', line 12

def parse_args( argv )
  options = { :verbose => true, :force => false }
  opts = OptionParser.new
  opts.banner << " <catalog name>\n"
  opts.banner << "launch a webs server to browse the content of <catalog name>\n";
  opts.banner << "\n"

  opts.on("-h", "--help", "Print this message") do
    puts opts
    return 0
  end

  opts.on("--version", "show the simple catalog version") do
    puts "simple catalog version #{SimpleCatalog::version}"
    return 0
  end

  opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
    options[:verbose] = v
  end

  rest = opts.parse(argv)
  #
  # main
  #

  # catalog = Catalog.new(catalog_name)
  WebServer.run! :host => 'localhost', :port => 9091 #, :catalog => catalog

  0
end