Sha256: d5ba9731cbc33c1eb59c18f1f3e40fb9ed688d1910a8b9d6a01e004202fe9913

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
require 'optparse'
require 'pty'
require 'soundcheck'

options = {}
option_parser = OptionParser.new do |opts|
  opts.banner = "Usage: soundcheck [options] [file or path]"

  opts.on("--fast", "Run fast specs only") do
    options[:fast] = true
  end

  opts.on("--trace", "Shows backtrace") do
    options[:trace] = true
  end

  opts.on("-v", "--verbose", "Shows debug information about language/test-framework detection") do
    options[:verbose] = true
  end

  opts.on("--help", "Show this info") do
    puts opts
    exit
  end
end

# Option Parser will eat elements of ARGV that it recognizes
option_parser.parse!(ARGV)

# Assume that the rest of ARGV are filenames
soundcheck = Soundcheck.new(ARGV, options)

begin
  soundcheck.commands_to_run.each do |cmd|
    puts "Executing #{cmd}\n\n"

    PTY.spawn(cmd) do |read_stream, write_stream, pid|
      begin
        while chars = read_stream.read(1)
          print chars
        end
      rescue Errno::EIO
      end
    end

    puts "\n\n\n"
  end
rescue Project::UnknownLanguage
  puts "Error: Cannot detect the programming language for this project."
  exit 1
rescue Project::UnknownFramework
  puts "Error: Cannot detect the test framework for this project."
  exit 1
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
soundcheck-0.2.3 bin/soundcheck