Sha256: 0861ee515e9e75ddf0242d766b697abcd82f6245ba517319a3247aa68b0667d2
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' => '0.0.0.0', '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.1 | bin/frankup |
frank-0.3.0 | bin/frankup |
frank-0.3.0.beta2 | bin/frankup |