add --output-dir option and begin on Gcovinator.run()
This commit is contained in:
1 parent
d363948e73
commit
7a34aa2c65
2 files changed
+24
-7
No files matched your search
+10
-1
@@ -1,5 +1,14 @@
|
||||
require_relative "gcovinator/version"
|
||||
|
||||
module Gcovinator
|
||||
# Your code goes here...
|
||||
|
||||
class << self
|
||||
|
||||
def run(build_dir, source_dirs, files, output_dir)
|
||||
source_dirs = ["."] if source_dirs.empty?
|
||||
files = Dir["#{build_dir}/**/*.gcda"] if files.empty?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
+14
-6
@@ -5,10 +5,12 @@ module Gcovinator
|
||||
module Cli
|
||||
|
||||
class << self
|
||||
|
||||
def run(argv)
|
||||
argv = argv.dup
|
||||
build_dir = "."
|
||||
source_dirs = []
|
||||
output_dir = "coverage"
|
||||
|
||||
OptionParser.new do |opts|
|
||||
|
||||
@@ -16,7 +18,7 @@ module Gcovinator
|
||||
|
||||
opts.separator ""
|
||||
opts.separator "Pass paths to .gcda files as FILES."
|
||||
opts.separator "If no FILES are specified, gcovinator looks for all .gcda files recursively under the build directory"
|
||||
opts.separator "If no FILES are specified, gcovinator looks for all .gcda files recursively under the build directory."
|
||||
opts.separator ""
|
||||
opts.separator "Options:"
|
||||
|
||||
@@ -24,6 +26,15 @@ module Gcovinator
|
||||
build_dir = b
|
||||
end
|
||||
|
||||
opts.on_tail("-h", "--help", "Show this help.") do
|
||||
puts opts
|
||||
exit 0
|
||||
end
|
||||
|
||||
opts.on("-o OUTPUTDIR", "--output-dir OUTPUTDIR", "Specify output directory. HTML reports will be written to this directory. Defaults to 'coverage' if not specified.") do |o|
|
||||
output_dir = o
|
||||
end
|
||||
|
||||
opts.on("-s SRCDIR", "--source-dir SRCDIR", "Specify a source directory. Reports will only be generated for sources under a specified source directory. Multiple source directories may be specified. Defaults to '.' if not specified.") do |s|
|
||||
source_dirs << s
|
||||
end
|
||||
@@ -33,14 +44,11 @@ module Gcovinator
|
||||
exit 0
|
||||
end
|
||||
|
||||
opts.on_tail("-h", "--help", "Show this help.") do
|
||||
puts opts
|
||||
exit 0
|
||||
end
|
||||
|
||||
end.parse!(argv)
|
||||
|
||||
Gcovinator.run(build_dir, source_dirs, argv)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user