Sha256: 36760daf49f096d50c59de9c9c23dcd5a44f3dd841a432145b02aa28ccc9fbc2

Contents?: true

Size: 1.11 KB

Versions: 5

Compression:

Stored size: 1.11 KB

Contents

#!/usr/bin/env ruby

ENV['RACK_ENV'] ||= 'test'

if ARGV.empty?
  puts "usage: cutest [-r lib] [-v] file [-b (backtrace) [-p (pry rescue)]]"
  exit
end

require "clap"
require_relative "../lib/cutest"

files = Clap.run ARGV,
  "-r"      => lambda { |file| require file },
  "-t"      => lambda { |name| cutest[:only] = name },
  "-s"      => lambda { |name| cutest[:scope] = name },
  "-w"      => lambda { |name| cutest[:warnings] = true },
  "-b"      => lambda { cutest[:backtrace] = true },
  "-p"      => lambda {
    ENV['PRY_RESCUE'] = 'true'; cutest[:pry_rescue] = true
  },
  "-d"      => lambda {
    require 'pry'
    require 'awesome_print'
    ENV['PRY_RESCUE']   = 'true'
    cutest[:pry_rescue] = true
  },
  "-v"      => lambda { puts Cutest::VERSION }

if files.any?
  begin
    env      = '.env'
    rack_env = "#{env}.#{ENV['RACK_ENV']}"

    if File.file? rack_env
      Cutest.load_envs rack_env
    elsif File.file? env
      Cutest.load_envs env
    end

    success = Cutest.run(Dir[*files])

    exit(1) unless success
  rescue ThreadError
    # Ignore this as it's caused by Process.waitall when using -p
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cutest-cj-1.3.6 bin/cutest
cutest-cj-1.3.5 bin/cutest
cutest-cj-1.3.4 bin/cutest
cutest-cj-1.3.3 bin/cutest
cutest-cj-1.3.2 bin/cutest