Sha256: 6b929af8b58df4060b474e269766f68b98161b7278ad5ddc2c09ee38c5a7d317

Contents?: true

Size: 660 Bytes

Versions: 8

Compression:

Stored size: 660 Bytes

Contents

# A simple alternative to autotest that isnt as painful

options = {
  :options => "--require '#{File.expand_path(File.dirname(__FILE__)) + "/spec_helper"}' --format nested --color",
  :binary => "spec"
}

watch("(lib|spec)/(.*)\.rb") do |match|
  puts %x[ clear ]
  
  file   = match[match.size - 1]
  opts   = options[:options]
  binary = options[:binary]
  
  files = []
  
  ["spec/lib/*.rb", "spec/lib/*/*.rb"].each do |glob|
    Dir.glob(glob).each { |f| files << f }
  end
  
  puts "Found:"
  files.each { |f| puts "+ #{f}" }
  puts ""
  command = "#{binary} #{files.collect! { |f| File.expand_path(f) }.join(" ")} #{opts}"
  
  system(command)
  
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
project-1.3.0 spec/watch.rb
project-1.2.0 spec/watch.rb
project-1.1.0 spec/watch.rb
project-1.0.0 spec/watch.rb
project-0.9.3 spec/watch.rb
project-0.9.2 spec/watch.rb
project-0.9.0 spec/watch.rb
project-0.8.0 spec/watch.rb