Module: Minitestify::CLI

Defined in:
lib/minitestify/cli.rb

Class Method Summary collapse

Class Method Details

.runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/minitestify/cli.rb', line 9

module_function def run
  options = {}
  OptionParser
    .new do |parser|
      parser.banner = "Usage: minitestify [options] <spec_files>"

      parser.on("-v", "--version", "Print version") do |v|
        puts(Minitestify::VERSION)
        exit
      end

      parser.on("-h", "--help", "Prints this help") do
        puts(parser)
        exit
      end
    end
    .parse!

  ARGV.each do |file|
    spec = Minitestify::Spec.new(file: file)
    puts("# #{spec.to_test_filepath}")
    puts(spec.to_test_code)
    puts
  end
end