bin/ferver in ferver-1.1.0 vs bin/ferver in ferver-1.2.0

- old
+ new

@@ -1,13 +1,28 @@ #!/usr/bin/env ruby +require 'optparse' require 'sinatra' require 'ferver' +options = {} +OptionParser.new do |opts| + opts.banner = 'Ferver: A simple web app to serve files over HTTP. Version: ' + Ferver::VERSION + opts.separator '' -# use the first argument as the file path to serve from -ferver_path = (ARGV.length == 1 && ARGV[0]) || nil -Ferver::App.set :ferver_path, ferver_path + opts.on('-d', '--directory [DIRECTORY]', 'Specify the path to the directory to serve files from [optional]') do |directory| + options[:directory] = directory + end + + opts.on("-h", "--help", "Displays help") do + puts opts + exit + end +end.parse! + +Ferver.configure do |config| + config.directory_path = options[:directory] +end Ferver::App.set :environment, :production # run! -Ferver::App.run! \ No newline at end of file +Ferver::App.run!