Sha256: 3c726e95bfa9004963bc0b01a5e39d26044dbdfb8d386f5077a7d1bbadead845
Contents?: true
Size: 1.93 KB
Versions: 3
Compression:
Stored size: 1.93 KB
Contents
#!/usr/bin/env ruby require 'optparse' require 'frank' options = {:server => {}} OptionParser.new do |opts| opts.banner = "Usage: frankup [OPTIONS]\n", "Starts the frank development server using settings.yml\n", "If settings.yml isn\'t found, a webserver will be started and serve up files from the current directory\n\n" opts.separator 'Options:' opts.on('--server [HANDLER]', 'Set the server handler') do |handler| options[:server]['handler'] = handler unless handler.nil? end opts.on('--hostname [HOSTNAME]', 'Set the server hostname') do |hostname| options[:server]['hostname'] = hostname unless hostname.nil? end opts.on('--port [PORT]', 'Set the server port') do |port| options[:server]['port'] = port unless port.nil? end opts.on('--dynamic_folder [FOLDER]', 'Set the dynamic folder') do |folder| options[:dynamic_folder] = folder unless folder.nil? end opts.on('--static_folder [FOLDER]', 'Set the static folder') do |folder| options[:static_folder] = folder unless folder.nil? end opts.on( '-h', '--help', 'Display this help' ) do puts opts exit end end.parse! if File.exist? 'settings.yml' settings = YAML.load_file('settings.yml') else settings = { :server => { 'handler' => 'mongrel', 'hostname' => '127.0.0.1', 'port' => 3601 }, :static_folder => '.', :dynamic_folder => '.', :environment => :serving } end options.each do |opt, val| if opt == :server server = settings['server'] ? settings['server'] : settings[:server] val.each { |sopt, sval| server[sopt] = sval } else settings[opt] = val end end if settings[:environment] == :serving puts "Could not find \"settings.yml\", serving up files from the this directory at http://#{settings[:server]['hostname']}:#{settings[:server]['port']}" end Frank.new do settings.each do |name, value| set name.to_s, value end set :proj_dir, Dir.pwd end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
frank-0.3.0.beta | bin/frankup |
frank-0.2.6 | bin/frankup |
frank-0.2.5 | bin/frankup |