Skip to content

Commit

Permalink
Add guard-tap to automate testing
Browse files Browse the repository at this point in the history
  • Loading branch information
naoya committed Jun 30, 2013
1 parent 1f53607 commit b20133b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'guard-tap'
37 changes: 37 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,37 @@
GEM
remote: https://rubygems.org/
specs:
coderay (1.0.9)
ffi (1.9.0)
formatador (0.2.4)
guard (1.8.1)
formatador (>= 0.2.4)
listen (>= 1.0.0)
lumberjack (>= 1.0.2)
pry (>= 0.9.10)
thor (>= 0.14.6)
guard-tap (1.2.0)
guard (>= 1.8)
listen (1.2.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
rb-kqueue (>= 0.2)
lumberjack (1.0.4)
method_source (0.8.1)
pry (0.9.12.2)
coderay (~> 1.0.5)
method_source (~> 0.8)
slop (~> 3.4)
rb-fsevent (0.9.3)
rb-inotify (0.9.0)
ffi (>= 0.5.0)
rb-kqueue (0.2.0)
ffi (>= 0.5.0)
slop (3.4.5)
thor (0.18.1)

PLATFORMS
ruby

DEPENDENCIES
guard-tap
21 changes: 21 additions & 0 deletions Guardfile
@@ -0,0 +1,21 @@
# A sample Guardfile
# More info at https://github.com/guard/guard#readme

guard :tap, command: 'carton exec -Ilib -- perl' do
watch %r{^t/.*\.t$}
watch %r{^(lib/.*\.pm)$} do |m|
modified_file = m[0]

all_test_files = Dir.glob('t/**/**.t')

all_test_files.sort_by{ |test_file|
# sort by similarity of path
a = test_file
b = modified_file
delimiter = %r{[/_\-\.]}
a_fragments = a.split(delimiter)
b_fragments = b.split(delimiter)
(a_fragments + b_fragments).uniq.length.to_f / (a_fragments + b_fragments).length.to_f
}.first
end
end

0 comments on commit b20133b

Please sign in to comment.