Sha256: f1c9d26004ded3ec7756ee72d10fe986e5bf6423cad1a8dd4c07d6776ae61424

Contents?: true

Size: 1.28 KB

Versions: 1

Compression:

Stored size: 1.28 KB

Contents

%w[ fsevent growl ].each do |autotest_ext|
  begin
    require "autotest/#{autotest_ext}"
  rescue LoadError
    # do nothing
  end
end

MATCH_ALL_SPECS = %r{\Aspec/.+_spec\.rb\z}.freeze

Autotest.add_hook :initialize do |at|
  at.clear_mappings

  # run the spec if it is modified
  at.add_mapping(MATCH_ALL_SPECS) { |filename, _| filename }

  # run specs if core_ext patches are modified
  at.add_mapping(%r{\Alib/veritas/core_ext/(.+)\.rb\z}) do |_, match|
    at.files_matching %r{\Aspec/unit/#{Regexp.quote(match[1])}/.*_spec\.rb\z}
  end

  # run specs if support libs are modified
  at.add_mapping(%r{\Alib/veritas/support/(.+)\.rb\z}) do |_, match|
    at.files_matching %r{\Aspec/unit/veritas/#{Regexp.quote(match[1])}/.*_spec\.rb\z}
  end

  # run specs if the main libs are modified
  at.add_mapping(%r{\Alib/(.+)\.rb\z}) do |_, match|
    at.files_matching %r{\Aspec/unit/#{Regexp.quote(match[1])}/.*_spec\.rb\z}
  end

  # run all specs if the spec_helper or spec support lib are modified
  at.add_mapping(%r{\Aspec/(?:spec_helper\.rb|(?:support|shared)/.+)\z}) do
    at.files_matching MATCH_ALL_SPECS
  end

  at.add_exception('.git')

  File.foreach('.gitignore') do |line|
    line.strip!
    next if line.empty? || line[0, 1] == '#'
    at.add_exception(File.expand_path(line))
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
veritas-0.0.2 .autotest