Module: Ghoul::Server

Defined in:
lib/server.rb

Class Method Summary collapse

Class Method Details

.startObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/server.rb', line 7

def self.start
    begin
      config_path = File.join(File.dirname(__FILE__), "..", "config.ru")
      
      message = <<-start_message.gsub(/^ {8}/, '')
      
      ###########################################################
      #
      #   Using Ghoul via the "ghoul server" command is
      #   insecure by default. It is only intended for a secure
      #   local environment e.g. behind a firewall where only you
      #   or people you trust can access your machine on a lan.
      #
      #############################################################
      
      Starting service on http://0.0.0.0:3003

      start_message
      
      puts message
      
      ENV['RACK_ENV'] = "production"
      Rack::Server.new(:config => config_path, :Port => 3003).start
      
      # Open the users browser to our new server
      # system("open http://0.0.0.0:3003")
    rescue
      puts "  --> The ghoul shut down."
    end

end