Sha256: 4d101a73b5766a773c9de39614902526093c7479675c17621d97e2c7487b4f21

Contents?: true

Size: 920 Bytes

Versions: 3

Compression:

Stored size: 920 Bytes

Contents

#!/usr/bin/env ruby

if $0 == __FILE__
  puts "Watchr started!"
  system("watchr #{__FILE__}") 
else
  # --------------------------------------------------
  # Convenience Methods
  # --------------------------------------------------
  
  def run(files_to_run)
    command = "bundle exec rspec #{files_to_run}"
    puts "Running: #{command}"
    system command
  end
  
  def run_spec_matching(matchdata)
    run "spec/#{matchdata[1]}_spec.rb"
  end
  
  def run_all_specs
    run 'spec'
  end
  
  # --------------------------------------------------
  # Watchr Rules
  # --------------------------------------------------
  
  watch '^lib/(.*)\.rb' do |matchdata|
    run_spec_matching(matchdata)
  end
  
  watch '^spec/(.*)_spec\.rb'  do |matchdata|
    run_spec_matching(matchdata)
  end
  
  watch '^spec/spec_helper\.rb' do
    run_all_specs
  end
  
  watch '^spec/support/.*\.rb' do
    run_all_specs
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mm_to_view_model-0.1.2 bin/watchr
mm_to_view_model-0.1.1 bin/watchr
mm_to_view_model-0.1.0 bin/watchr