Sha256: 3568d82b486999bb62a2b8ccc09627889ab5a96a2f07fc348790d93abc27f140
Contents?: true
Size: 1.04 KB
Versions: 1
Compression:
Stored size: 1.04 KB
Contents
# frozen_string_literal: true require 'fileutils' module DangerUndercover # module for undercover-report module CLI class << self # Runs the undercover command with provided arguments # and writes the output to a file # @return [String] # def run(args = nil) undercover_output = `undercover #{args&.join(' ')}` File.open(output_file, 'w') do |f| f.write(undercover_output) end undercover_output end private # Returns the file to write report to # @return [String] # def output_file create_directory! File.join(output_directory, 'undercover.txt') end # Creates directory if doesn't exists # @return [String] # def create_directory! return if Dir.exist?(output_directory) FileUtils.mkdir_p(output_directory) end # Output directory # @return [String] # def output_directory File.join(Dir.getwd, 'coverage') end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
danger-undercover-1.1.0 | lib/undercover/cli.rb |