Sha256: 5b2c3f0cf265fa5804f7a79edc3ddaeab9beeb4c0aebd3e6349a169a5a189192
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require 'bundler/setup' require 'rack/contrib' require 'webrick' require 'diver_down' require 'diver_down-web' require 'optparse' options = {} option_parser = OptionParser.new do |opts| opts.banner = <<~BANNER Usage: diver_down_web [options] Example: diver_down_web --definition-dir /path/to/definitions --metadata /path/to/metadata.yml Options: BANNER opts.on('--definition-dir PATH', 'Path to the definition directory') do |path| options[:definition_dir] = path end opts.on('--metadata PATH', 'Path to the metadata.yml') do |path| options[:metadata] = path end end option_parser.parse!(ARGV) unless options[:definition_dir] puts 'Missing --definition-dir' puts puts option_parser.help exit 1 end app = Rack::JSONBodyParser.new( DiverDown::Web.new( definition_dir: options.fetch(:definition_dir), metadata: DiverDown::Web::Metadata.new(options[:metadata] || Tempfile.new(['metadata', '.yaml']).path) ) ) begin # Rack 2.0 require 'rack' require 'rack/server' Rack::Server.new(app:, server: :webrick).start rescue LoadError # Rack 3.0 require 'rackup' Rackup::Server.new(app:, server: :webrick).start end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
diver_down-0.0.1.alpha14 | exe/diver_down_web |