Sha256: e8313f562460a67b5ac820ac163e0b9879d0848f06377b7a9d9b514261df4635

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

require 'guard'
require 'guard/guard'

module Guard
  class LiveReload < Guard
    attr_accessor :reactor
    autoload :Reactor, 'guard/livereload/reactor'

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

    def initialize(watchers = [], options = {})
      super
      @options = {
        :api_version => '1.6',
        :host => '0.0.0.0',
        :port => '35729',
        :apply_js_live => true,
        :apply_css_live => true,
        :grace_period => 0
      }.update(options)
    end

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

    def stop
      reactor.stop
    end

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

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
guard-livereload-0.4.2 lib/guard/livereload.rb
guard-livereload-0.4.1 lib/guard/livereload.rb
guard-livereload-0.4.0 lib/guard/livereload.rb