Sha256: 0214ac2c7b49670ef7cb4b081f7dbda0413c4608f8f4fca7facbfd0117b13e76

Contents?: true

Size: 1.41 KB

Versions: 1

Compression:

Stored size: 1.41 KB

Contents

module Guard
  class Guard
    include Hook

    attr_accessor :watchers, :options, :group

    def initialize(watchers = [], options = {})
      @group = options.delete(:group) || :default
      @watchers, @options = watchers, options
    end

    # Guardfile template needed inside guard gem
    def self.init(name)
      if ::Guard::Dsl.guardfile_include?(name)
        ::Guard::UI.info "Guardfile already includes #{name} guard"
      else
        content = File.read('Guardfile')
        guard   = File.read("#{::Guard.locate_guard(name)}/lib/guard/#{name}/templates/Guardfile")
        File.open('Guardfile', 'wb') do |f|
          f.puts(content)
          f.puts("")
          f.puts(guard)
        end
        ::Guard::UI.info "#{name} guard added to Guardfile, feel free to edit it"
      end
    end

    # ================
    # = Guard method =
    # ================

    # Call once when guard starts
    # Please override initialize method to init stuff
    def start
      true
    end

    # Call once when guard quit
    def stop
      true
    end

    # Should be mainly used for "reload" (really!) actions like reloading passenger/spork/bundler/...
    def reload
      true
    end

    # Should be principally used for long action like running all specs/tests/...
    def run_all
      true
    end

    def run_on_change(paths)
      true
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
guard-0.7.0 lib/guard/guard.rb