Sha256: 1ea2932c13edbc4a3ba9bb23b4da950b590140336b45d0e74a9b2384a8cb2cca

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require 'guard'
require 'guard/guard'

module Guard
  class LiveReload < Guard
    require 'guard/livereload/websocket'
    require 'guard/livereload/reactor'

    attr_accessor :reactor, :options

    # =================
    # = Guard methods =
    # =================

    def initialize(watchers = [], options = {})
      super
      @options = {
        :host => '0.0.0.0',
        :apply_css_live => true,
        :override_url => false,
        :grace_period => 0
      }.update(options)
    end

    def start
      @reactor = Reactor.new(options)
    end

    def stop
      reactor.stop
    end

    def run_on_changes(paths)
      sleep options[:grace_period]
      reactor.reload_browser(paths)
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guard-livereload-1.2.1 lib/guard/livereload.rb
guard-livereload-1.2.0 lib/guard/livereload.rb