Sha256: d8fe2eb4a53801da0995d39b08c60001d73c709d527036c29b0ae5fd35c7309d

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

namespace :mack do
  
  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::Configuration.set(:root, FileUtils.pwd) if Mack::Configuration.root.nil?

      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::Configuration.root, "config", "boot.rb")
      require 'mack'

      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 # start

  end # server
  
end # mack

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mack-0.5.5.2 lib/tasks/mack_server_tasks.rake
mack-0.5.0 lib/tasks/mack_server_tasks.rake
mack-0.5.5.1 lib/tasks/mack_server_tasks.rake
mack-0.5.5.3 lib/tasks/mack_server_tasks.rake
mack-0.5.5 lib/tasks/mack_server_tasks.rake