Sha256: 582b50c7492da13e9b56d17269fce29d60037170b9e42b7ff126ae9014a5200b

Contents?: true

Size: 772 Bytes

Versions: 5

Compression:

Stored size: 772 Bytes

Contents

#!/usr/bin/env ruby
$LOAD_PATH.unshift(File.dirname(__FILE__) + "/../lib") unless $LOAD_PATH.include?(File.dirname(__FILE__) + "/../lib")

require "devloop"

begin
  require "spring/env"
rescue LoadError
  # Spring not available
end

begin
  diff = `git diff HEAD -U0 spec/`
  if diff == ""
    diff = `git diff HEAD~1 -U0 spec/`
  end

  tests = Devloop::DiffParser.call(diff)
  puts "Devloop running tests:"
  if tests.length == 0
    puts "No tests to run"
    return
  end
  puts tests
  command = if defined?(Spring) && Spring::Env.new.server_running?
      "spring rspec"
    else
      "rspec"
    end
  system("bundle exec #{command} #{tests.join(" ")}")
rescue Interrupt # user pressed CTRL+C
  STDERR.puts "\nDevloop: exiting due to user request"
  exit 130
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devloop-0.1.5 bin/devloop_run
devloop-0.1.4 bin/devloop_run
devloop-0.1.3 bin/devloop_run
devloop-0.1.2 bin/devloop_run
devloop-0.1.1 bin/devloop_run