Sha256: ed2da13a64675d701e130550aa231e977b2a86257f44c30e40baf2eb3afd145e

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby
require 'rack'
require 'optparse'
require 'ap'
require './lib/hydroponics'
require './config/hydro_app'
include Hydroponics::Setup

@options = {}
optparse = OptionParser.new do |opts|
  opts.banner = "Usage: hydro [options]..."

  @options[:verbose] = false
  opts.on( '-v', '--verbose', 'Output more information' ) do
    @options[:verbose] = true
  end
  @options[:rails] = false
  opts.on( '-r', '--rails PROJ_DIR', 'Look for a rails project in PROJ_DIR' ) do |dir|
    @options[:rails] = dir
  end
  @options[:overdrive] = false
  opts.on( '-o', '--overdrive', 'Raise the max_allowed_packet variable in MySQL' ) do
    @options[:overdrive] = true
  end
end
optparse.parse!

def vp(x); puts x if @options[:verbose]; end
def vap(x); ap x if @options[:verbose]; end

raise "Aborting: must use a rails project" unless @options[:rails]
result = get_db_from_local_rails_project(@options[:rails])

vp "Your database configuration has been loaded:"
vap result

if @options[:overdrive]
  raise_max_packet_size
  vp "Overdrive mode selected." # there's no going back!
end

vp "Starting on port 9294..."
Rack::Handler::Mongrel.run(HydroApp.new, :Port => 9294)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hydroponics-0.3.1 bin/hydro
hydroponics-0.3.0 bin/hydro