Sha256: 5c190de994a7c70523eefef0a8c353f8b712ea759d85790a89d94a4844973d42

Contents?: true

Size: 1.01 KB

Versions: 11

Compression:

Stored size: 1.01 KB

Contents

namespace :server do
  
  desc "Starts the webserver."
  task :start do |t|
    
    require 'rubygems'
    require 'optparse'
    require 'optparse/time'
    require 'ostruct'
    require 'fileutils'

    d_handler = "WEBrick"
    begin
      require 'mongrel'
      d_handler = "mongrel"
    rescue Exception => e
    end
    begin
      require 'thin'
      d_handler = "thin"
    rescue Exception => e
    end

    MACK_ROOT = FileUtils.pwd unless Object.const_defined?("MACK_ROOT")

    options = OpenStruct.new
    options.port = (ENV["PORT"] ||= "3000") # Does NOT work with Thin!! You must edit the thin.yml file!
    options.handler = (ENV["HANDLER"] ||= d_handler)


    require File.join(MACK_ROOT, "config", "boot.rb")

    if options.handler == "thin"
      # thin_opts = ["start", "-r", "config/thin.ru"]
      thin_opts = ["start", "-C", "config/thin.yml"]
      Thin::Runner.new(thin_opts.flatten).run!
    else
      Mack::SimpleServer.run(options)
    end
  end
  
end

alias_task :server, "log:clear", "server:start"

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
mack-0.0.3 tasks/script_tasks.rake
mack-0.0.5 tasks/script_tasks.rake
mack-0.0.6.2 tasks/script_tasks.rake
mack-0.0.6.1 tasks/script_tasks.rake
mack-0.0.4 tasks/script_tasks.rake
mack-0.2.0 lib/tasks/script_tasks.rake
mack-0.2.0.1 lib/tasks/script_tasks.rake
mack-0.0.6 tasks/script_tasks.rake
mack-0.0.7.0 lib/tasks/script_tasks.rake
mack-0.1.0 lib/tasks/script_tasks.rake
mack-0.3.0 lib/tasks/script_tasks.rake