Class: HighFive::Thor::Tasks::Development

Inherits:
HighFive::Thor::Task show all
Includes:
Thor::Actions
Defined in:
lib/high_five/thor/tasks/development.rb

Instance Method Summary collapse

Methods inherited from HighFive::Thor::Task

inherited

Instance Method Details

#server(platform = "web") ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/high_five/thor/tasks/development.rb', line 11

def server(platform="web")
  root = nil
  if options[:platform_path]
    [File.join(options[:platform_path], 'www'), File.join(options[:platform_path], 'assets', 'www')].each do |path|
      if File.exist? path
        root = path
        break
      end
    end
  else
    root = base_config.build_platform_config(platform).destination
  end

  puts "Starting server with root=#{root}"

  server = WEBrick::HTTPServer.new(:Port => 3000, :DocumentRoot => root)
  trap 'INT' do server.shutdown end
  server.start
end