Class: Dugway::Cli::Server

Inherits:
Thor::Group
  • Object
show all
Defined in:
lib/dugway/cli/server.rb

Instance Method Summary collapse

Instance Method Details

#startObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/dugway/cli/server.rb', line 31

def start
  if options[:suppress_warnings]
    $VERBOSE = nil
  end

  listener = Listen.to('.', only: /\.(css|html|jpg|js|json|png|sass|svg)$/) do |modified|
    puts "Theme files changed, restarting server..."
    exec "dugway server"
  end

  Thread.new { listener.start }

  Rack::Server.start({
    :config => File.join(Dir.pwd, 'config.ru'),
    :environment => 'none',
    :Host => options[:host],
    :Port => options[:port],
    :server => options[:server]
  })
end