Sha256: 2dcc152767c7f3105b1f3078bfa1d505b9105bf1d9363180f27a56a6d1364756

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
module DeepCover
  require "bundler/setup"

  $LOAD_PATH.unshift('../covered_deep_cover') if ENV["CC"]
  require "deep_cover"
  require_relative "../spec/specs_tools"
  require 'deep_cover/cli/debugger'

  example = ARGV[0] || 'simple_if'
  fn = "./spec/samples/#{example}.rb"
  fn = "./spec/char_cover/#{example}.rb" unless File.exist?(fn)
  if File.exist?(fn)
    fn = File.absolute_path(fn)
    source = File.read(fn)
  else
    fn = "<passed_from_command_line>"
    source = ARGV[0].gsub(';;', "\n")
  end

  groups = Specs::AnnotatedExamplesParser.process(source)
  if groups.size == 1 && groups.first.last.size == 1
    lines, lineno = groups.values.first.values.first
  else
    menu = []
    item = -1
    examples = groups.flat_map do |title, examples|
      menu << Term::ANSIColor.green(title) if title
      menu.concat(examples.keys.map {|ex| "  #{item+=1}: #{ex || '(General)'}"})
      examples.values
    end
    if ARGV[1]
      answer = ARGV[1].to_i
    else
      require 'highline'
      puts menu
      answer = HighLine.new.ask(Term::ANSIColor.blue("Which?  "), Integer) { |q| q.in = 0...examples.size }
    end
    lines, lineno = examples[answer]
  end

  CLI::Debugger.new(lines.join, filename: fn, lineno: lineno, debug: true).show
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
deep-cover-0.1.14 bin/cov
deep-cover-0.1.13 bin/cov
deep-cover-0.1.12 bin/cov
deep-cover-0.1.11 bin/cov
deep-cover-0.1.10 bin/cov
deep-cover-0.1.9 bin/cov