Class: Guard::Webpack::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/webpack/runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Runner

Returns a new instance of Runner.



4
5
6
# File 'lib/guard/webpack/runner.rb', line 4

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



2
3
4
# File 'lib/guard/webpack/runner.rb', line 2

def options
  @options
end

#threadObject

Returns the value of attribute thread.



2
3
4
# File 'lib/guard/webpack/runner.rb', line 2

def thread
  @thread
end

Instance Method Details

#restartObject



8
# File 'lib/guard/webpack/runner.rb', line 8

def restart; stop; start; end

#startObject



10
11
12
13
14
15
# File 'lib/guard/webpack/runner.rb', line 10

def start
  unless_running do
    @thread = Thread.new { run_webpack }
    ::Guard::UI.info "Webpack watcher started."
  end
end

#stopObject



17
18
19
20
21
22
# File 'lib/guard/webpack/runner.rb', line 17

def stop
  if_running do
    @thread.kill
    ::Guard::UI.info "Webpack watcher stopped."
  end
end