Sha256: 947bde3da44879cc866a680bb567ef4de408caba2b4ddee520117f926820b6d4

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

require 'guard/compat/plugin'
require 'childprocess'

module Guard
  class Spork < Plugin

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

    def initialize(options={})
      super
      @runner = Runner.new(options)
    end

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

    def reload
      relaunch_sporks
    end

    def run_on_additions(paths)
      relaunch_sporks
    end

    def run_on_modifications(paths)
      relaunch_sporks
    end

    def stop
      runner.kill_sporks
    end

    private

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-spork-2.1.0 lib/guard/spork.rb