Sha256: bbe5eb1cf5edadd400da399a5e627ea1a6b9eb47f75b48f3e96d035d26fd4863

Contents?: true

Size: 1019 Bytes

Versions: 2

Compression:

Stored size: 1019 Bytes

Contents

require 'guard'
require 'guard/guard'

module Guard
  class Spork < Guard

    autoload :Runner, 'guard/spork/runner'
    autoload :SporkInstance, 'guard/spork/spork_instance'
    attr_accessor :runner

    def initialize(watchers=[], options={})
      super
      @runner = Runner.new(options)

      # This class will be reinitialized by Guard when the Guardfile
      # is reevaluated, so we must always begin by trying to clean
      # up after any hypothetical predecessor
      runner.reevaluate
    end

    def start
      runner.kill_global_sporks
      runner.launch_sporks("start")
    end

    def reload
      runner.kill_sporks
      runner.launch_sporks("reload")
    end

    def run_on_change(paths_or_symbol)
      if paths_or_symbol.is_a?(Symbol)
        runner.kill_sporks(paths_or_symbol)
        runner.launch_sporks("reload", paths_or_symbol)
      else
        runner.kill_sporks
        runner.launch_sporks("reload")
      end
    end

    def stop
      runner.kill_sporks
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
guard-spork-0.4.1 lib/guard/spork.rb
guard-spork-0.4.0 lib/guard/spork.rb