Sha256: a65af49ce4f0e3826b77811bfcc3bb792180aed16db3c5b43e10f1416cbee684
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "optparse" $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "/../lib") require "ferver" options = {} OptionParser.new do |opts| opts.banner = "Ferver: A simple web app to serve files over HTTP. Version: " + Ferver::VERSION opts.separator "" opts.on("-a", "--all", "Serve hidden files. False by default [optional]") do |a| options[:hidden] = a end opts.on("-d", "--directory [DIRECTORY]", "Specify the path to the directory to serve files from [optional]") do |directory| options[:directory] = directory end opts.on("-b", "--bind [IP or hostname]", "Set the hostname or IP address of the interface to listen on when running. Defaults to '0.0.0.0' [optional]") do |bind_address| options[:bind_address] = bind_address end opts.on("-p", "--port [PORT]", "Set the port used by Ferver server. Defaults to 4567 [optional]") do |port| options[:port] = port end opts.on("-h", "--help", "Displays help") do puts opts exit end end.parse! Ferver.configure do |config| config.serve_hidden = options[:hidden] if options[:hidden] config.directory_path = options[:directory] if options[:directory] end Ferver::App.set :environment, :production Ferver::App.set :bind, options[:bind_address] if options[:bind_address] Ferver::App.set :port, options[:port] if options[:port] # run! Ferver::App.run!
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ferver-1.4.0 | bin/ferver |
ferver-1.3.1 | bin/ferver |