Sha256: a6ba684116756cadf152b2ccf55333958e7b51fa4df7663575d0816ae2c9dd57

Contents?: true

Size: 743 Bytes

Versions: 8

Compression:

Stored size: 743 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_changes(paths)
      sleep @options[:grace_period]
      reactor.reload_browser(paths)
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
guard-livereload-1.1.3 lib/guard/livereload.rb
guard-livereload-1.1.2 lib/guard/livereload.rb
guard-livereload-1.1.1 lib/guard/livereload.rb
guard-livereload-1.1.0 lib/guard/livereload.rb
guard-livereload-1.0.3 lib/guard/livereload.rb
guard-livereload-1.0.2 lib/guard/livereload.rb
guard-livereload-1.0.1 lib/guard/livereload.rb
guard-livereload-1.0.0 lib/guard/livereload.rb