Sha256: 80a6c3b7063d6b2470d286015bd85d4e53b53161d1a99cb3054258b5aa84df4c

Contents?: true

Size: 1.25 KB

Versions: 8

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, pry: true).show
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
deep-cover-0.1.8 bin/cov
deep-cover-0.1.7 bin/cov
deep-cover-0.1.6 bin/cov
deep-cover-0.1.5 bin/cov
deep-cover-0.1.4 bin/cov
deep-cover-0.1.3 bin/cov
deep-cover-0.1.2 bin/cov
deep-cover-0.1.1 bin/cov