From 926664147e6152706039cbc724010ecc23502055 Mon Sep 17 00:00:00 2001 From: "Pascal J. Bourguignon" Date: Tue, 1 Aug 2023 18:23:06 +0200 Subject: [PATCH] Added messages. --- lib/cmock.rb | 8 ++------ lib/cmock_generator.rb | 12 ++++++++---- lib/cmock_header_parser.rb | 1 + 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/cmock.rb b/lib/cmock.rb index 3afae70a..c79d6db6 100644 --- a/lib/cmock.rb +++ b/lib/cmock.rb @@ -29,14 +29,12 @@ def initialize(options = nil) def setup_mocks(files, folder = nil) [files].flatten.each do |src| - $stderr.puts "Creating mock for #{src}..." unless @silent generate_mock(src, folder) end end def setup_skeletons(files) [files].flatten.each do |src| - $stderr.puts "Creating skeleton for #{src}..." unless @silent generate_skeleton src end end @@ -46,14 +44,12 @@ def setup_skeletons(files) def generate_mock(src, folder) name = File.basename(src, '.*') ext = File.extname(src) - puts "Creating mock for #{name}..." unless @silent - @cm_generator.create_mock(name, @cm_parser.parse(src, name, File.read(src)), ext, folder,src) + @cm_generator.create_mock(name, @cm_parser.parse(src, name, File.read(src)), ext, folder, src) end def generate_skeleton(src) name = File.basename(src, '.*') - puts "Creating skeleton for #{name}..." unless @silent - @cm_generator.create_skeleton(name, @cm_parser.parse(src, name, File.read(src))) + @cm_generator.create_skeleton(name, @cm_parser.parse(src, name, File.read(src)), src) end end diff --git a/lib/cmock_generator.rb b/lib/cmock_generator.rb index aec391cd..a1c2f28c 100644 --- a/lib/cmock_generator.rb +++ b/lib/cmock_generator.rb @@ -21,7 +21,7 @@ def initialize(config, file_writer, utils, plugins) @fail_on_unexpected_calls = @config.fail_on_unexpected_calls @exclude_setjmp_h = @config.exclude_setjmp_h @subdir = @config.subdir - + @silent = (@config.verbosity < 2) @includes_h_pre_orig_header = ((@config.includes || []) + (@config.includes_h_pre_orig_header || [])).uniq.map { |h| h =~ / module_name, :module_ext => '.h', @@ -130,7 +134,7 @@ def create_mock_header_file(mock_project) end @file_writer.create_file(mock_project[:mock_name] + mock_project[:module_ext], mock_project[:folder]) do |file, filename| - file << "/* Source File: #{mock_project[:source]} */\n" # if mock_project[:source] + file << "/* Source File: #{mock_project[:source]} */\n" create_mock_header_header(file, filename, mock_project) create_mock_header_service_call_declarations(file, mock_project) create_typedefs(file, mock_project) @@ -144,7 +148,7 @@ def create_mock_header_file(mock_project) def create_mock_source_file(mock_project) @file_writer.create_file(mock_project[:mock_name] + '.c', mock_project[:folder]) do |file, filename| - file << "/* Source File: #{mock_project[:source]} */\n" # if mock_project[:source] + file << "/* Source File: #{mock_project[:source]} */\n" create_source_header_section(file, filename, mock_project) create_instance_structure(file, mock_project) create_extern_declarations(file) diff --git a/lib/cmock_header_parser.rb b/lib/cmock_header_parser.rb index 6a4a17c6..3fd5cddc 100644 --- a/lib/cmock_header_parser.rb +++ b/lib/cmock_header_parser.rb @@ -47,6 +47,7 @@ def raise_parse_error(message) end def parse(src_path, name, source) + $stderr.puts "Parsing #{src_path}" if @verbosity >= 1 @parse_project = { :source_path => src_path, :module_name => name.gsub(/\W/, ''),