Class: Recot::Commands::GuardServer

Inherits:
Object
  • Object
show all
Defined in:
lib/recot/commands/guard_server.rb

Instance Method Summary collapse

Constructor Details

#initializeGuardServer



8
9
10
11
12
13
14
# File 'lib/recot/commands/guard_server.rb', line 8

def initialize
  path = File.expand_path('../../../../', __FILE__)
  @guardfile = "#{path}/Guardfile"
  # setup guard ui options
  Guard::UI.options[:level] = :error
  Guard::UI.options[:template] = "guard error!! > :message"
end

Instance Method Details

#runObject



16
17
18
19
20
21
22
23
24
# File 'lib/recot/commands/guard_server.rb', line 16

def run
  @thread = start_guard
  Thread.new do
    loop do
      sleep 1
      @thread.wakeup
    end
  end
end

#start_guardObject



26
27
28
29
30
31
32
# File 'lib/recot/commands/guard_server.rb', line 26

def start_guard
  Thread.new do
    Guard.start(
      guardfile: @guardfile,
      no_interactions: true)
  end
end