fix trailing space and new line

temporarily disable codespell
This commit is contained in:
hathach
2023-03-17 16:12:49 +07:00
parent 2faad42cb1
commit 3623ba1884
581 changed files with 2553 additions and 2694 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* The MIT License (MIT)
*
* Copyright (c) 2019, hathach (tinyusb.org)

View File

@@ -1,4 +1,4 @@
/*
/*
* The MIT License (MIT)
*
* Copyright (c) 2019, Ha Thach (tinyusb.org)

View File

@@ -1,4 +1,4 @@
/*
/*
* The MIT License (MIT)
*
* Copyright (c) 2019 Ha Thach (tinyusb.org)

View File

@@ -96,4 +96,3 @@ module Ceedling
DEFAULT_CEEDLING_CONFIG[:plugins][:load_paths] << gem_dir
end
end

View File

@@ -5,7 +5,7 @@ require 'ceedling/constants'
class BuildInvokerUtils
constructor :configurator, :streaminator
##
# Processes exceptions and tries to display a useful message for the user.
#
@@ -13,27 +13,27 @@ class BuildInvokerUtils
#
# * _exception_: The exception given by a rescue statement.
# * _context_: A symbol representing where in the build the exception
# occurs.
# occurs.
# * _test_build_: A bool to signify if the exception occurred while building
# from test or source.
#
def process_exception(exception, context, test_build=true)
if (exception.message =~ /Don't know how to build task '(.+)'/i)
error_header = "ERROR: Rake could not find file referenced in source"
error_header += " or test" if (test_build)
error_header += " or test" if (test_build)
error_header += ": '#{$1}'. Possible stale dependency."
@streaminator.stderr_puts( error_header )
if (@configurator.project_use_deep_dependencies)
help_message = "Try fixing #include statements or adding missing file. Then run '#{REFRESH_TASK_ROOT}#{context.to_s}' task and try again."
help_message = "Try fixing #include statements or adding missing file. Then run '#{REFRESH_TASK_ROOT}#{context.to_s}' task and try again."
@streaminator.stderr_puts( help_message )
end
raise ''
else
raise exception
end
end
end

View File

@@ -2,7 +2,7 @@
class Cacheinator
constructor :cacheinator_helper, :file_path_utils, :file_wrapper, :yaml_wrapper
def cache_test_config(hash)
@yaml_wrapper.dump( @file_path_utils.form_test_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE), hash )
end
@@ -11,15 +11,15 @@ class Cacheinator
@yaml_wrapper.dump( @file_path_utils.form_release_build_cache_path( INPUT_CONFIGURATION_CACHE_FILE ), hash )
end
def diff_cached_test_file( filepath )
cached_filepath = @file_path_utils.form_test_build_cache_path( filepath )
if (@file_wrapper.exist?( cached_filepath ) and (!@file_wrapper.compare( filepath, cached_filepath )))
@file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
return filepath
elsif (!@file_wrapper.exist?( cached_filepath ))
@file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
@file_wrapper.cp(filepath, cached_filepath, {:preserve => false})
return filepath
end
@@ -43,5 +43,5 @@ class Cacheinator
return @cacheinator_helper.diff_cached_config?( cached_filepath, hash )
end
end

View File

@@ -2,7 +2,7 @@
class CacheinatorHelper
constructor :file_wrapper, :yaml_wrapper
def diff_cached_config?(cached_filepath, hash)
return false if ( not @file_wrapper.exist?(cached_filepath) )
return true if (@yaml_wrapper.load(cached_filepath) != hash)

View File

@@ -1,13 +1,13 @@
require 'cmock'
class CmockBuilder
attr_accessor :cmock
def setup
def setup
@cmock = nil
end
def manufacture(cmock_config)
@cmock = CMock.new(cmock_config)
end

View File

@@ -379,4 +379,3 @@ class Configurator
end

View File

@@ -109,7 +109,7 @@ class ConfiguratorPlugins
return defaults_with_path
end
# gather up and return
# gather up and return
def find_plugin_hash_defaults(config, plugin_paths)
defaults_hash= []

View File

@@ -79,7 +79,7 @@ class ConfiguratorSetup
if config[:cmock][:unity_helper]
config[:cmock][:unity_helper].each do |path|
validation << @configurator_validator.validate_filepath_simple( path, :cmock, :unity_helper )
validation << @configurator_validator.validate_filepath_simple( path, :cmock, :unity_helper )
end
end

View File

@@ -6,7 +6,7 @@ require 'ceedling/file_path_utils' # for glob handling class methods
class ConfiguratorValidator
constructor :file_wrapper, :stream_wrapper, :system_wrapper
# walk into config hash verify existence of data at key depth
@@ -16,9 +16,9 @@ class ConfiguratorValidator
if (not exist)
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.")
@stream_wrapper.stderr_puts("ERROR: Required config file entry #{format_key_sequence(keys, hash[:depth])} does not exist.")
end
return exist
end
@@ -33,39 +33,39 @@ class ConfiguratorValidator
path_list = []
exist = true
case list
when String then path_list << list
when Array then path_list = list
end
path_list.each do |path|
base_path = FilePathUtils::extract_path(path) # lop off add/subtract notation & glob specifiers
if (not @file_wrapper.exist?(base_path))
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.")
@stream_wrapper.stderr_puts("ERROR: Config path #{format_key_sequence(keys, hash[:depth])}['#{base_path}'] does not exist on disk.")
exist = false
end
end
end
return exist
end
# simple path verification
def validate_filepath_simple(path, *keys)
validate_path = path
if (not @file_wrapper.exist?(validate_path))
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.")
@stream_wrapper.stderr_puts("ERROR: Config path '#{validate_path}' associated with #{format_key_sequence(keys, keys.size)} does not exist on disk.")
return false
end
end
return true
end
# walk into config hash. verify specified file exists.
def validate_filepath(config, *keys)
hash = retrieve_value(config, keys)
@@ -76,21 +76,21 @@ class ConfiguratorValidator
# skip everything if we've got an argument replacement pattern
return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN)
if (not @file_wrapper.exist?(filepath))
# See if we can deal with it internally.
if GENERATED_DIR_PATH.include?(filepath)
if GENERATED_DIR_PATH.include?(filepath)
# we already made this directory before let's make it again.
FileUtils.mkdir_p File.join(File.dirname(__FILE__), filepath)
@stream_wrapper.stderr_puts("WARNING: Generated filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk. Recreating")
@stream_wrapper.stderr_puts("WARNING: Generated filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk. Recreating")
else
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.")
return false
end
end
end
return true
end
@@ -106,17 +106,17 @@ class ConfiguratorValidator
# skip everything if we've got an argument replacement pattern
return true if (filepath =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN)
# if there's no path included, verify file exists somewhere in system search paths
if (not filepath.include?('/'))
exists = false
@system_wrapper.search_paths.each do |path|
if (@file_wrapper.exist?( File.join(path, filepath)) )
exists = true
break
end
if (@file_wrapper.exist?( (File.join(path, filepath)).ext( exe_extension ) ))
exists = true
break
@@ -125,25 +125,25 @@ class ConfiguratorValidator
break
end
end
if (not exists)
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.")
return false
@stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist in system search paths.")
return false
end
# if there is a path included, check that explicit filepath exists
else
if (not @file_wrapper.exist?(filepath))
# no verbosity checking since this is lowest level anyhow & verbosity checking depends on configurator
@stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.")
@stream_wrapper.stderr_puts("ERROR: Config filepath #{format_key_sequence(keys, hash[:depth])}['#{filepath}'] does not exist on disk.")
return false
end
end
end
return true
end
def validate_tool_stderr_redirect(config, tools, tool)
redirect = config[tools][tool][:stderr_redirect]
if (redirect.class == Symbol)
@@ -151,17 +151,17 @@ class ConfiguratorValidator
if (not StdErrRedirect.constants.map{|constant| constant.to_s}.include?(redirect.to_s.upcase))
error = "ERROR: [:#{tools}][:#{tool}][:stderr_redirect][:#{redirect}] is not a recognized option " +
"{#{StdErrRedirect.constants.map{|constant| ':' + constant.to_s.downcase}.join(', ')}}."
@stream_wrapper.stderr_puts(error)
return false
@stream_wrapper.stderr_puts(error)
return false
end
end
return true
end
private #########################################
def retrieve_value(config, keys)
value = nil
hash = config
@@ -178,7 +178,7 @@ class ConfiguratorValidator
break
end
end
return {:value => value, :depth => depth}
end
@@ -186,8 +186,8 @@ class ConfiguratorValidator
def format_key_sequence(keys, depth)
walked_keys = keys.slice(0, depth)
formatted_keys = walked_keys.map{|key| "[:#{key.to_s}]"}
return formatted_keys.join
end
end

View File

@@ -6,4 +6,4 @@ class ErbWrapper
f << ERB.new(template, 0, "<>").result(binding)
end
end
end
end

View File

@@ -146,4 +146,3 @@ class FileFinder
return @file_finder_helper.find_file_in_collection(file_path, file_list, complain)
end
end

View File

@@ -4,11 +4,11 @@ require 'ceedling/constants' # for Verbosity enumeration
class FileFinderHelper
constructor :streaminator
def find_file_in_collection(file_name, file_list, complain, extra_message="")
file_to_find = nil
file_list.each do |item|
base_file = File.basename(item)
@@ -22,29 +22,29 @@ class FileFinderHelper
blow_up(file_name, "However, a filename having different capitalization was found: '#{item}'.")
end
end
end
if file_to_find.nil?
case (complain)
when :error then blow_up(file_name, extra_message)
when :error then blow_up(file_name, extra_message)
when :warn then gripe(file_name, extra_message)
#when :ignore then
#when :ignore then
end
end
return file_to_find
end
private
def blow_up(file_name, extra_message="")
error = "ERROR: Found no file '#{file_name}' in search paths."
error += ' ' if (extra_message.length > 0)
@streaminator.stderr_puts(error + extra_message, Verbosity::ERRORS)
raise
end
def gripe(file_name, extra_message="")
warning = "WARNING: Found no file '#{file_name}' in search paths."
warning += ' ' if (extra_message.length > 0)
@@ -52,5 +52,3 @@ class FileFinderHelper
end
end

View File

@@ -6,7 +6,7 @@ require 'ceedling/file_path_utils'
class FileSystemUtils
constructor :file_wrapper
# build up path list from input of one or more strings or arrays of (+/-) paths & globs
@@ -14,7 +14,7 @@ class FileSystemUtils
raw = [] # all paths and globs
plus = Set.new # all paths to expand and add
minus = Set.new # all paths to remove from plus set
# assemble all globs and simple paths, reforming our glob notation to ruby globs
paths.each do |paths_container|
case (paths_container)
@@ -26,29 +26,29 @@ class FileSystemUtils
# iterate through each path and glob
raw.each do |path|
dirs = [] # container for only (expanded) paths
# if a glob, expand it and slurp up all non-file paths
if path.include?('*')
# grab base directory only if globs are snug up to final path separator
if (path =~ /\/\*+$/)
dirs << FilePathUtils.extract_path(path)
end
# grab expanded sub-directory globs
expanded = @file_wrapper.directory_listing( FilePathUtils.extract_path_no_aggregation_operators(path) )
expanded.each do |entry|
dirs << entry if @file_wrapper.directory?(entry)
end
# else just grab simple path
# note: we could just run this through glob expansion but such an
# approach doesn't handle a path not yet on disk)
else
dirs << FilePathUtils.extract_path_no_aggregation_operators(path)
end
# add dirs to the appropriate set based on path aggregation modifier if present
FilePathUtils.add_path?(path) ? plus.merge(dirs) : minus.merge(dirs)
end

View File

@@ -7,4 +7,4 @@ class FileSystemWrapper
end
end
end
end

View File

@@ -29,25 +29,25 @@ class Flaginator
def get_flag(hash, file_name)
file_key = file_name.to_sym
# 1. try literals
literals, magic = partition(hash) { |k, v| k.to_s =~ /^\w+$/ }
literals, magic = partition(hash) { |k, v| k.to_s =~ /^\w+$/ }
return literals[file_key] if literals.include?(file_key)
any, regex = partition(magic) { |k, v| (k == :'*') || (k == :'.*') } # glob or regex wild card
# 2. try regexes
find_res = regex.find { |k, v| file_name =~ /^#{k.to_s}$/ }
return find_res[1] if find_res
# 3. try anything
find_res = any.find { |k, v| file_name =~ /.*/ }
return find_res[1] if find_res
# 4. well, we've tried
return []
end
def flag_down( operation, context, file )
# create configurator accessor method
accessor = ('flags_' + context.to_s).to_sym

View File

@@ -9,7 +9,7 @@ class GeneratorHelper
def test_results_error_handler(executable, shell_result)
notice = ''
error = false
if (shell_result[:output].nil? or shell_result[:output].strip.empty?)
error = true
# mirror style of generic tool_executor failure output
@@ -24,7 +24,7 @@ class GeneratorHelper
"> Produced no final test result counts in $stdout:\n" +
"#{shell_result[:output].strip}\n"
end
if (error)
# since we told the tool executor to ignore the exit code, handle it explicitly here
notice += "> And exited with status: [#{shell_result[:exit_code]}] (count of failed tests).\n" if (shell_result[:exit_code] != nil)
@@ -33,8 +33,8 @@ class GeneratorHelper
notice += "> This is often a symptom of a bad memory access in source or test code.\n\n"
@streaminator.stderr_puts(notice, Verbosity::COMPLAIN)
raise
raise
end
end
end

View File

@@ -77,7 +77,7 @@ class GeneratorTestResults
# handle anything preceding filename in line as extra output to be collected
stdout = nil
stdout_regex = /(.+)#{Regexp.escape(filename)}.+/i
unity_test_time = 0
unity_test_time = 0
if (line =~ stdout_regex)
stdout = $1.clone

View File

@@ -6,34 +6,34 @@ require 'ceedling/constants'
class GeneratorTestResultsSanityChecker
constructor :configurator, :streaminator
def verify(results, unity_exit_code)
# do no sanity checking if it's disabled
return if (@configurator.sanity_checks == TestResultsSanityChecks::NONE)
raise "results nil or empty" if results.nil? || results.empty?
ceedling_ignores_count = results[:ignores].size
ceedling_ignores_count = results[:ignores].size
ceedling_failures_count = results[:failures].size
ceedling_tests_summation = (ceedling_ignores_count + ceedling_failures_count + results[:successes].size)
# Exit code handling is not a sanity check that can always be performed because
# Exit code handling is not a sanity check that can always be performed because
# command line simulators may or may not pass through Unity's exit code
if (@configurator.sanity_checks >= TestResultsSanityChecks::THOROUGH)
# many platforms limit exit codes to a maximum of 255
if ((ceedling_failures_count != unity_exit_code) and (unity_exit_code < 255))
sanity_check_warning(results[:source][:file], "Unity's exit code (#{unity_exit_code}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).")
end
if ((ceedling_failures_count < 255) and (unity_exit_code == 255))
sanity_check_warning(results[:source][:file], "Ceedling's summation of failed test cases (#{ceedling_failures_count}) is less than Unity's exit code (255 or more).")
end
end
if (ceedling_ignores_count != results[:counts][:ignored])
sanity_check_warning(results[:source][:file], "Unity's final ignore count (#{results[:counts][:ignored]}) does not match Ceedling's summation of ignored test cases (#{ceedling_ignores_count}).")
end
if (ceedling_failures_count != results[:counts][:failed])
sanity_check_warning(results[:source][:file], "Unity's final fail count (#{results[:counts][:failed]}) does not match Ceedling's summation of failed test cases (#{ceedling_failures_count}).")
end
@@ -41,14 +41,14 @@ class GeneratorTestResultsSanityChecker
if (ceedling_tests_summation != results[:counts][:total])
sanity_check_warning(results[:source][:file], "Unity's final test count (#{results[:counts][:total]}) does not match Ceedling's summation of all test cases (#{ceedling_tests_summation}).")
end
end
private
def sanity_check_warning(file, message)
unless defined?(CEEDLING_IGNORE_SANITY_CHECK)
notice = "\n" +
notice = "\n" +
"ERROR: Internal sanity check for test fixture '#{file.ext(@configurator.extension_executable)}' finds that #{message}\n" +
" Possible causes:\n" +
" 1. Your test + source dereferenced a null pointer.\n" +
@@ -56,7 +56,7 @@ class GeneratorTestResultsSanityChecker
" 3. Your test + source committed a memory access violation.\n" +
" 4. Your test fixture produced an exit code of 0 despite execution ending prematurely.\n" +
" Sanity check failures of test results are usually a symptom of interrupted test execution.\n\n"
@streaminator.stderr_puts( notice )
raise
end

View File

@@ -11,7 +11,7 @@ class Loginator
config_files.concat( @project_config_manager.options_files )
config_files.compact!
config_files.map! { |file| file.ext('') }
log_name = config_files.join( '_' )
@project_log_filepath = File.join( @configurator.project_log_path, log_name.ext('.log') )
@@ -20,12 +20,12 @@ class Loginator
def log(string, heading=nil)
return if (not @configurator.project_logging)
output = "\n[#{@system_wrapper.time_now}]"
output += " :: #{heading}" if (not heading.nil?)
output += "\n#{string.strip}\n"
@file_wrapper.write(@project_log_filepath, output, 'a')
end
end

View File

@@ -1,6 +1,6 @@
# modified version of Rake's provided make-style dependency loader
# customizations:
# customizations:
# (1) handles windows drives in paths -- colons don't confuse task demarcation
# (2) handles spaces in directory paths
@@ -29,7 +29,7 @@ module Rake
file_tasks, args = line.split(/:\s/)
return if args.nil?
# split at non-escaped space boundary between files (i.e. escaped spaces in paths are left alone)
dependents = args.split(/\b\s+/)
# replace escaped spaces and clean up any extra whitespace

View File

@@ -223,7 +223,7 @@ dependinator:
- configurator
- project_config_manager
- test_includes_extractor
- file_path_utils
- file_path_utils
- rake_wrapper
- file_wrapper

View File

@@ -16,4 +16,3 @@ def par_map(n, things, &block)
end
threads.each { |t| t.join }
end

View File

@@ -5,7 +5,7 @@ class String
def left_margin(margin=0)
non_whitespace_column = 0
new_lines = []
# find first line with non-whitespace and count left columns of whitespace
self.each_line do |line|
if (line =~ /^\s*\S/)
@@ -13,7 +13,7 @@ class String
break
end
end
# iterate through each line, chopping off leftmost whitespace columns and add back the desired whitespace margin
self.each_line do |line|
columns = []
@@ -25,7 +25,7 @@ class String
new_lines << "\n"
end
end
return new_lines.join
end
end
@@ -74,7 +74,7 @@ class Plugin
# whole shebang (any use of Ceedling)
def pre_build; end
def post_build; end
def summary; end
end

View File

@@ -23,7 +23,7 @@ class PluginBuilder
end
private
def camelize(underscored_name)
return underscored_name.gsub(/(_|^)([a-z0-9])/) {$2.upcase}
end
@@ -50,4 +50,4 @@ class PluginBuilder
end
end
end
end

View File

@@ -2,46 +2,46 @@ require 'ceedling/constants'
require 'ceedling/defaults'
class PluginReportinator
constructor :plugin_reportinator_helper, :plugin_manager, :reportinator
def setup
@test_results_template = nil
end
def set_system_objects(system_objects)
@plugin_reportinator_helper.ceedling = system_objects
end
def fetch_results(results_path, test, options={:boom => false})
return @plugin_reportinator_helper.fetch_results( File.join(results_path, test), options )
end
def generate_banner(message)
return @reportinator.generate_banner(message)
end
def assemble_test_results(results_list, options={:boom => false})
aggregated_results = get_results_structure
results_list.each do |result_path|
results_list.each do |result_path|
results = @plugin_reportinator_helper.fetch_results( result_path, options )
@plugin_reportinator_helper.process_results(aggregated_results, results)
end
return aggregated_results
end
def register_test_results_template(template)
@test_results_template = template if (@test_results_template.nil?)
end
def run_test_results_report(hash, verbosity=Verbosity::NORMAL, &block)
run_report( $stdout,
((@test_results_template.nil?) ? DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE : @test_results_template),
@@ -49,19 +49,19 @@ class PluginReportinator
verbosity,
&block )
end
def run_report(stream, template, hash=nil, verbosity=Verbosity::NORMAL)
failure = nil
failure = yield() if block_given?
@plugin_manager.register_build_failure( failure )
@plugin_reportinator_helper.run_report( stream, template, hash, verbosity )
end
private ###############################
def get_results_structure
return {
:successes => [],
@@ -72,5 +72,5 @@ class PluginReportinator
:time => 0.0
}
end
end

View File

@@ -4,11 +4,11 @@ require 'rake' # for ext()
require 'ceedling/constants'
class PluginReportinatorHelper
attr_writer :ceedling
constructor :configurator, :streaminator, :yaml_wrapper, :file_wrapper
def fetch_results(results_path, options)
pass_path = File.join(results_path.ext( @configurator.extension_testpass ))
fail_path = File.join(results_path.ext( @configurator.extension_testfail ))
@@ -23,7 +23,7 @@ class PluginReportinatorHelper
raise
end
end
return {}
end
@@ -47,5 +47,5 @@ class PluginReportinatorHelper
output = ERB.new(template, 0, "%<>")
@streaminator.stream_puts(stream, output.result(binding()), verbosity)
end
end

View File

@@ -94,7 +94,7 @@ class PreprocessinatorIncludesHandler
target_file = make_rule.split[0].gsub(':', '').gsub('\\','/')
base = File.basename(target_file, File.extname(target_file))
make_rule_dependencies = make_rule.gsub(/.*\b#{Regexp.escape(base)}\S*/, '').gsub(/\\$/, '')
# Extract the headers dependencies from the make rule
hdr_ext = @configurator.extension_header
headers_dependencies = make_rule_dependencies.split.find_all {|path| path.end_with?(hdr_ext) }.uniq

View File

@@ -20,7 +20,7 @@ class ProjectConfigManager
def merge_options(config_hash, option_filepath)
@options_files << File.basename( option_filepath )
config_hash.deep_merge!( @yaml_wrapper.load( option_filepath ) )
end
end
def filter_internal_sources(sources)

View File

@@ -1,6 +1,6 @@
class RakeUtils
constructor :rake_wrapper
def task_invoked?(task_regex)

View File

@@ -14,8 +14,8 @@ class Reportinator
# ==== Examples
#
# rp = Reportinator.new
# rp.generate_banner("Hello world!") => "------------\nHello world!\n------------\n"
# rp.generate_banner("Hello world!", 3) => "---\nHello world!\n---\n"
# rp.generate_banner("Hello world!") => "------------\nHello world!\n------------\n"
# rp.generate_banner("Hello world!", 3) => "---\nHello world!\n---\n"
#
#
def generate_banner(message, width=nil)

View File

@@ -3,7 +3,7 @@
rule(/#{CMOCK_MOCK_PREFIX}[^\/\\]+#{'\\'+EXTENSION_SOURCE}$/ => [
proc do |task_name|
@ceedling[:file_finder].find_header_input_for_mock_file(task_name)
end
end
]) do |mock|
@ceedling[:generator].generate_mock(TEST_SYM, mock.source)
end

View File

@@ -6,7 +6,7 @@
rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [
proc do |task_name|
@ceedling[:file_finder].find_test_or_source_or_header_file(task_name)
end
end
]) do |file|
if (not @ceedling[:configurator].project_use_deep_dependencies)
raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.'
@@ -19,8 +19,7 @@ end
rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [
proc do |task_name|
@ceedling[:file_finder].find_test_or_source_or_header_file(task_name)
end
end
]) do |file|
@ceedling[:generator].generate_shallow_includes_list(TEST_SYM, file.source)
end

View File

@@ -96,4 +96,3 @@ namespace RELEASE_SYM do
end
end

View File

@@ -3,7 +3,7 @@
rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
proc do |task_name|
@ceedling[:file_finder].find_compilation_input_file(task_name, :error, true)
end
end
]) do |dep|
@ceedling[:generator].generate_dependencies_file(
TOOLS_RELEASE_DEPENDENCIES_GENERATOR,
@@ -12,4 +12,3 @@ rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ =
@ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source),
dep.name)
end

View File

@@ -70,4 +70,3 @@ namespace TEST_SYM do
@ceedling[:test_invoker].setup_and_invoke([test.source])
end
end

View File

@@ -12,4 +12,3 @@ rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
@ceedling[:file_path_utils].form_test_build_c_object_filepath(dep.source),
dep.name)
end

View File

@@ -18,7 +18,7 @@ class Setupinator
@config_hash = config_hash
# load up all the constants and accessors our rake files, objects, & external scripts will need;
# note: configurator modifies the cmock section of the hash with a couple defaults to tie
# note: configurator modifies the cmock section of the hash with a couple defaults to tie
# project together - the modified hash is used to build cmock object
@ceedling[:configurator].populate_defaults( config_hash )
@ceedling[:configurator].populate_unity_defaults( config_hash )
@@ -31,16 +31,16 @@ class Setupinator
@ceedling[:configurator].standardize_paths( config_hash )
@ceedling[:configurator].validate( config_hash )
@ceedling[:configurator].build( config_hash, :environment )
@ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins )
@ceedling[:configurator].tools_supplement_arguments( config_hash )
# merge in any environment variables plugins specify, after the main build
@ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) do |env|
@ceedling[:configurator].eval_environment_variables( env )
@ceedling[:configurator].build_supplement( config_hash, env )
end
@ceedling[:plugin_reportinator].set_system_objects( @ceedling )
@ceedling[:file_finder].prepare_search_sources
@ceedling[:loginator].setup_log_filepath

View File

@@ -16,7 +16,7 @@ class StreamWrapper
def stdout_flush
$stdout.flush
end
def stderr_puts(string)
$stderr.puts(string)
end

View File

@@ -12,7 +12,7 @@ class Streaminator
@stream_wrapper.stdout_puts(string)
@stream_wrapper.stdout_flush
end
# write to log as though Verbosity::OBNOXIOUS
@loginator.log( string, @streaminator_helper.extract_name($stdout) )
end

View File

@@ -8,7 +8,7 @@ class StreaminatorHelper
when 2 then '#<IO:$stderr>'
else stream.inspect
end
return name
end

View File

@@ -13,7 +13,7 @@ class SystemUtils
constructor :system_wrapper
##
# Sets up the class.
# Sets up the class.
def setup
@tcsh_shell = nil
end
@@ -23,7 +23,7 @@ class SystemUtils
def tcsh_shell?
# once run a single time, return state determined at that execution
return @tcsh_shell if not @tcsh_shell.nil?
result = @system_wrapper.shell_backticks('echo $version')
if ((result[:exit_code] == 0) and (result[:output].strip =~ /^tcsh/))
@@ -31,7 +31,7 @@ class SystemUtils
else
@tcsh_shell = false
end
return @tcsh_shell
end
end

View File

@@ -11,7 +11,7 @@ class TaskInvoker
@release_regexs = [/^#{RELEASE_ROOT_NAME}(:|$)/]
@first_run = true
end
def add_test_task_regex(regex)
@test_regexs << regex
end
@@ -19,26 +19,26 @@ class TaskInvoker
def add_release_task_regex(regex)
@release_regexs << regex
end
def test_invoked?
invoked = false
@test_regexs.each do |regex|
invoked = true if (@rake_utils.task_invoked?(regex))
break if invoked
end
return invoked
end
def release_invoked?
invoked = false
@release_regexs.each do |regex|
invoked = true if (@rake_utils.task_invoked?(regex))
break if invoked
end
return invoked
end
@@ -60,7 +60,7 @@ class TaskInvoker
@rake_wrapper[mock].invoke
}
end
def invoke_test_runner(runner)
@dependinator.enhance_runner_dependencies( runner )
reset_rake_task_for_changed_defines( runner )
@@ -112,11 +112,11 @@ class TaskInvoker
@rake_wrapper[file].invoke
end
end
def invoke_release_objects(objects)
par_map(PROJECT_COMPILE_THREADS, objects) do |object|
@rake_wrapper[object].invoke
end
end
end

View File

@@ -113,4 +113,3 @@ task :summary do
puts "\nNOTE: Summaries may be out of date with project sources.\n\n"
end
end

View File

@@ -109,5 +109,3 @@ namespace :files do
end
end

View File

@@ -5,8 +5,8 @@ require 'ceedling/file_path_utils'
desc "Build release target."
task RELEASE_SYM => [:directories] do
header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'"
@ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}")
@ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}")
begin
@ceedling[:plugin_manager].pre_release
@@ -15,16 +15,15 @@ task RELEASE_SYM => [:directories] do
@ceedling[:project_config_manager].process_release_config_change
core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_c_objects( COLLECTION_ALL_SOURCE ) )
# if assembler use isn't enabled, COLLECTION_ALL_ASSEMBLY is empty array & nothing happens
core_objects.concat( @ceedling[:release_invoker].setup_and_invoke_asm_objects( COLLECTION_ALL_ASSEMBLY ) )
# if we're using libraries, we need to add those to our collection as well
library_objects = (defined? LIBRARIES_RELEASE && !LIBRARIES_RELEASE.empty?) ? LIBRARIES_RELEASE.flatten.compact : []
file( PROJECT_RELEASE_BUILD_TARGET => (core_objects + extra_objects + library_objects) )
Rake::Task[PROJECT_RELEASE_BUILD_TARGET].invoke
ensure
@ceedling[:plugin_manager].post_release
@ceedling[:plugin_manager].post_release
end
end

View File

@@ -59,4 +59,3 @@ namespace TEST_SYM do
end
end

View File

@@ -19,14 +19,14 @@ class TestInvokerHelper
yield( dependencies_list ) if block_given?
end
def extract_sources(test)
sources = []
includes = @test_includes_extractor.lookup_includes_list(test)
includes.each { |include| sources << @file_finder.find_compilation_input_file(include, :ignore) }
return sources.compact
end
end

View File

@@ -37,4 +37,3 @@ class Beep < Plugin
end
end
end

View File

@@ -5,7 +5,7 @@ ceedling-bullseye
Plugin for integrating Bullseye code coverage tool into Ceedling projects.
This plugin requires a working license to Bullseye code coverage tools. The tools
must be within the path or the path should be added to the environment in the
must be within the path or the path should be added to the environment in the
`project.yml file`.
## Configuration

View File

@@ -12,4 +12,3 @@ BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>%
% else
BRANCHES: none
% end

View File

@@ -38,7 +38,7 @@ class Bullseye < Plugin
@ceedling[:plugin_manager].pre_compile_execute(arg_hash)
@ceedling[:streaminator].stdout_puts("Compiling #{File.basename(source)} with coverage...")
compile_command =
compile_command =
@ceedling[:tool_executor].build_command_line(
TOOLS_BULLSEYE_COMPILER,
@ceedling[:flaginator].flag_down( OPERATION_COMPILE_SYM, BULLSEYE_SYM, source ),
@@ -48,14 +48,14 @@ class Bullseye < Plugin
coverage_command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_INSTRUMENTATION, [], compile_command[:line] )
shell_result = @ceedling[:tool_executor].exec( coverage_command[:line], coverage_command[:options] )
arg_hash[:shell_result] = shell_result
@ceedling[:plugin_manager].post_compile_execute(arg_hash)
end
def post_test_fixture_execute(arg_hash)
result_file = arg_hash[:result_file]
if ((result_file =~ /#{BULLSEYE_RESULTS_PATH}/) and (not @result_list.include?(result_file)))
@result_list << arg_hash[:result_file]
end
@@ -70,13 +70,13 @@ class Bullseye < Plugin
:header => BULLSEYE_ROOT_NAME.upcase,
:results => results
}
@ceedling[:plugin_reportinator].run_test_results_report(hash) do
message = ''
message = 'Unit test failures.' if (results[:counts][:failed] > 0)
message
end
# coverage results
return if (verify_coverage_file() == false)
if (@ceedling[:task_invoker].invoked?(/^#{BULLSEYE_TASK_ROOT}(all|delta)/))
@@ -100,13 +100,13 @@ class Bullseye < Plugin
}
@ceedling[:plugin_reportinator].run_test_results_report(hash)
# coverage results
command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_REPORT_COVSRC)
shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])
report_coverage_results_all(shell_result[:output])
end
def enableBullseye(enable)
if BULLSEYE_AUTO_LICENSE
if (enable)
@@ -117,14 +117,14 @@ class Bullseye < Plugin
@ceedling[:streaminator].stdout_puts("Reverting Bullseye to previous state")
end
args.each do |arg|
args.each do |arg|
command = @ceedling[:tool_executor].build_command_line(TOOLS_BULLSEYE_BUILD_ENABLE_DISABLE, [], arg)
shell_result = @ceedling[:tool_executor].exec(command[:line], command[:options])
end
end
end
private ###################################
def report_coverage_results_all(coverage)
@@ -139,7 +139,7 @@ class Bullseye < Plugin
if (coverage =~ /^Total.*?=\s+([0-9]+)\%/)
results[:coverage][:functions] = $1.to_i
end
if (coverage =~ /^Total.*=\s+([0-9]+)\%\s*$/)
results[:coverage][:branches] = $1.to_i
end
@@ -177,10 +177,10 @@ class Bullseye < Plugin
banner = @ceedling[:plugin_reportinator].generate_banner( "#{BULLSEYE_ROOT_NAME.upcase}: CODE COVERAGE SUMMARY" )
@ceedling[:streaminator].stdout_puts "\n" + banner + "\nNo coverage file.\n\n"
end
return exist
end
end
@@ -188,7 +188,7 @@ end
END {
# cache our input configurations to use in comparison upon next execution
if (@ceedling[:task_invoker].invoked?(/^#{BULLSEYE_TASK_ROOT}/))
@ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash )
@ceedling[:cacheinator].cache_test_config( @ceedling[:setupinator].config_hash )
@ceedling[BULLSEYE_SYM].enableBullseye(false)
end
}

View File

@@ -3,7 +3,7 @@ ceedling-colour-report
## Overview
The colour_report replaces the normal ceedling "pretty" output with
The colour_report replaces the normal ceedling "pretty" output with
a colorized variant, in order to make the results easier to read from
a standard command line. This is very useful on developer machines, but
can occasionally cause problems with parsing on CI servers.

View File

@@ -89,4 +89,3 @@ class CommandHooks < Plugin
end
end
end

View File

@@ -9,7 +9,7 @@ In June of 2016, Microsoft with Red Hat and Codenvy got together to create a sta
For C and C++ projects, many people use the `clangd` backend. So that it can do things like "go to definition", `clangd` needs to know how to build the project so that it can figure out all the pieces to the puzzle. There are manual tools such as `bear` which can be run with `gcc` or `clang` to extract this information it has a big limitation in that if run with `ceedling release` you won't get any auto completion for Unity and you'll also get error messages reported by your IDE because of what it perceives as missing headers. If you do the same with `ceedling test` now you get Unity but you might miss things that are only seen in the release build.
This plugin resolves that issue. As it is run by Ceedling, it has access to all the build information it needs to create the perfect `compile_commands.json`. Once enabled, this plugin will generate that file and place it in `./build/artifacts/compile_commands.json`. `clangd` will search your project for this file, but it is easier to symlink it into the root directory (for example `ln -s ./build/artifacts/compile_commands.json`.
This plugin resolves that issue. As it is run by Ceedling, it has access to all the build information it needs to create the perfect `compile_commands.json`. Once enabled, this plugin will generate that file and place it in `./build/artifacts/compile_commands.json`. `clangd` will search your project for this file, but it is easier to symlink it into the root directory (for example `ln -s ./build/artifacts/compile_commands.json`.
For more information on LSP and to find out if your editor supports it, check out https://langserver.org/

View File

@@ -16,4 +16,4 @@ task :integration_test do
end
end
task :default => [:spec, :integration_test]
task :default => [:spec, :integration_test]

View File

@@ -28,7 +28,7 @@
:source:
- src/**
:support:
:defines:
# in order to add common defines:
# 1) remove the trailing [] from the :common: section

View File

@@ -4,4 +4,4 @@
void display_turnOffStatusLed(void)
{
printf("Display: Status LED off");
}
}

View File

@@ -90,7 +90,7 @@ class FffMockGenerator
# In the init function, reset the FFF globals. These are used for things
# like the call history.
output.puts " FFF_RESET_HISTORY();"
# Also, reset all of the fakes.
if parsed_header[:functions]
parsed_header[:functions].each do |function|

View File

@@ -254,7 +254,7 @@ describe "FffMockGenerator.create_mock_header" do
)
end
end
context "when there is a function that returns a const int" do
let(:mock_header){
parsed_header = {}

View File

@@ -146,4 +146,4 @@ describe "FffMockGenerator.create_mock_source" do
)
end
end
end
end

View File

@@ -48,4 +48,4 @@ def create_cmock_style_parsed_header(functions, typedefs = nil)
end
end
parsed_header
end
end

View File

@@ -30,4 +30,4 @@
fff.call_history[order_], \
"Function " #function_ " not called in order " #order_ )
#endif
#endif

View File

@@ -12,4 +12,3 @@ BRANCHES: <%=sprintf(format_string, hash[:coverage][:branches])%>%
% else
BRANCHES: none
% end

View File

@@ -5,7 +5,7 @@ class ReportinatorHelper
def print_shell_result(shell_result)
if !(shell_result.nil?)
puts "Done in %.3f seconds." % shell_result[:time]
if !(shell_result[:output].nil?) && (shell_result[:output].length > 0)
puts shell_result[:output]
end

View File

@@ -3,8 +3,8 @@ json_tests_report
## Overview
The json_tests_report plugin creates a JSON file of test results, which is
handy for Continuous Integration build servers or as input into other
The json_tests_report plugin creates a JSON file of test results, which is
handy for Continuous Integration build servers or as input into other
reporting tools. The JSON file is output to the appropriate
`<build_root>/artifacts/` directory (e.g. `artifacts/test/` for test tasks,
`artifacts/gcov/` for gcov, or `artifacts/bullseye/` for bullseye runs).

View File

@@ -33,7 +33,7 @@ class JsonTestsReport < Plugin
"IgnoredTests" => write_tests(results[:ignores]),
"Summary" => write_statistics(results[:counts])
}
f << JSON.pretty_generate(json)
end
end
@@ -62,7 +62,7 @@ class JsonTestsReport < Plugin
results.each do |result|
result[:collection].each do |item|
@test_counter += 1
retval << {
retval << {
"file" => File.join(result[:source][:path], result[:source][:file]),
"test" => item[:test]
}

View File

@@ -96,7 +96,7 @@ put that corporate copyright notice (or maybe a copyleft notice, if that's your
### Test Defines
You can specify the "#ifdef TEST" at the top of the test files with a custom define.
This example will put a "#ifdef CEEDLING_TEST" at the top of the test files.
This example will put a "#ifdef CEEDLING_TEST" at the top of the test files.
```
:module_generator:
@@ -115,5 +115,3 @@ Your options are as follows:
- `:camel` - camelFilesAreSimilarButStartLow
- `:snake` - snake_case_is_all_lower_and_uses_underscores
- `:caps` - CAPS_FEELS_LIKE_YOU_ARE_SCREAMING

View File

@@ -1,4 +1,4 @@
:module_generator:
:project_root: ./
:source_root: src/
:test_root: test/
:test_root: test/

View File

@@ -3,8 +3,8 @@ ceedling-stdout-gtestlike-tests-report
## Overview
The stdout_gtestlike_tests_report replaces the normal ceedling "pretty" output with
a variant that resembles the output of gtest. This is most helpful when trying to
The stdout_gtestlike_tests_report replaces the normal ceedling "pretty" output with
a variant that resembles the output of gtest. This is most helpful when trying to
integrate into an IDE or CI that is meant to work with google test.
## Setup

View File

@@ -3,7 +3,7 @@ ceedling-stdout-ide-tests-report
## Overview
The stdout_ide_tests_report replaces the normal ceedling "pretty" output with
The stdout_ide_tests_report replaces the normal ceedling "pretty" output with
a simplified variant intended to be easily parseable.
## Setup

View File

@@ -5,7 +5,7 @@ ceedling-pretty-tests-report
The stdout_pretty_tests_report is the default output of ceedling. Instead of
showing most of the raw output of CMock, Ceedling, etc., it shows a simplified
view. It also creates a nice summary at the end of execution which groups the
view. It also creates a nice summary at the end of execution which groups the
results into ignored and failed tests.
## Setup

View File

@@ -56,4 +56,3 @@ IGNORED: <%=sprintf(format_string, ignored)%>
No tests executed.
% end

View File

@@ -2,20 +2,20 @@ require 'ceedling/plugin'
require 'ceedling/defaults'
class StdoutPrettyTestsReport < Plugin
def setup
@result_list = []
@plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
template = @ceedling[:file_wrapper].read(File.join(@plugin_root, 'assets/template.erb'))
@ceedling[:plugin_reportinator].register_test_results_template( template )
end
def post_test_fixture_execute(arg_hash)
return if not (arg_hash[:context] == TEST_SYM)
@result_list << arg_hash[:result_file]
end
def post_build
return if not (@ceedling[:task_invoker].test_invoked?)

View File

@@ -1,9 +1,9 @@
ceedling-subprojects
====================
Plugin for supporting subprojects that are built as static libraries. It continues to support
dependency tracking, without getting confused between your main project files and your
subproject files. It accepts different compiler flags and linker flags, allowing you to
Plugin for supporting subprojects that are built as static libraries. It continues to support
dependency tracking, without getting confused between your main project files and your
subproject files. It accepts different compiler flags and linker flags, allowing you to
optimize for your situation.
First, you're going to want to add the extension to your list of known extensions:
@@ -13,12 +13,12 @@ First, you're going to want to add the extension to your list of known extension
:subprojects: '.a'
```
Define a new section called :subprojects. There, you can list as many subprojects
as you may need under the :paths key. For each, you specify a unique place to build
Define a new section called :subprojects. There, you can list as many subprojects
as you may need under the :paths key. For each, you specify a unique place to build
and a unique name.
```
:subprojects:
:subprojects:
:paths:
- :name: libprojectA
:source:
@@ -27,7 +27,7 @@ and a unique name.
:include:
- ./subprojectA/include/dir
:build_root: ./subprojectA/build/dir
:defines:
:defines:
- DEFINE_JUST_FOR_THIS_FILE
- AND_ANOTHER
- :name: libprojectB

View File

@@ -73,6 +73,5 @@ SUBPROJECTS_PATHS.each do |subproj|
task :directories => subproj_directories.clone
# Finally, add the static library to our RELEASE build dependency list
task RELEASE_SYM => ["#{subproj_build_root}/#{subproj_name}#{EXTENSION_SUBPROJECTS}"]
task RELEASE_SYM => ["#{subproj_build_root}/#{subproj_name}#{EXTENSION_SUBPROJECTS}"]
end

View File

@@ -3,7 +3,7 @@ ceedling-teamcity-tests-report
## Overview
The teamcity_tests_report replaces the normal ceedling "pretty" output with
The teamcity_tests_report replaces the normal ceedling "pretty" output with
a version that has results tagged to be consumed with the teamcity CI server.
## Setup

View File

@@ -43,4 +43,3 @@ void Throw(CEXCEPTION_T ExceptionID)
} <- finish off that local scope we created to have our own variables
if (CExceptionFrames[CEXCEPTION_GET_ID].Exception != CEXCEPTION_NONE) <- start the actual 'catch' processing if we have an exception id saved away
*/

View File

@@ -6,6 +6,6 @@
#
cexception_dir = include_directories('.')
cexception_lib = static_library(meson.project_name(),
cexception_lib = static_library(meson.project_name(),
files('CException.c'),
include_directories : cexception_dir)

View File

@@ -213,4 +213,3 @@ void CMock_Guts_MemFreeFinal(void)
}
#endif
}

View File

@@ -6,7 +6,7 @@
#
cmock_dir = include_directories('.')
cmock_lib = static_library(meson.project_name(),
cmock_lib = static_library(meson.project_name(),
files('cmock.c'),
dependencies: [unity_dep],
include_directories: cmock_dir)

View File

@@ -18,8 +18,8 @@ module DIY #:nodoc:#
raise "Nil context hash" unless context_hash
raise "Need a hash" unless context_hash.kind_of?(Hash)
[ "[]", "keys" ].each do |mname|
unless extra_inputs.respond_to?(mname)
raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each"
unless extra_inputs.respond_to?(mname)
raise "Extra inputs must respond to hash-like [] operator and methods #keys and #each"
end
end
@@ -37,7 +37,7 @@ module DIY #:nodoc:#
@cache = {}
@cache['this_context'] = self
end
# Convenience: create a new DIY::Context by loading from a String (or open file handle.)
def self.from_yaml(io_or_string, extra_inputs={})
@@ -51,7 +51,7 @@ module DIY #:nodoc:#
self.from_yaml(File.read(fname), extra_inputs)
end
# Return a reference to the object named. If necessary, the object will
# Return a reference to the object named. If necessary, the object will
# be instantiated on first use. If the object is non-singleton, a new
# object will be produced each time.
def get_object(obj_name)
@@ -77,7 +77,7 @@ module DIY #:nodoc:#
end
alias :[] :get_object
# Inject a named object into the Context. This must be done before the Context has instantiated the
# Inject a named object into the Context. This must be done before the Context has instantiated the
# object in question.
def set_object(obj_name,obj)
key = obj_name.to_s
@@ -108,9 +108,9 @@ module DIY #:nodoc:#
@defs.keys.member?(key) or extra_inputs_has(key)
end
# Every top level object in the Context is instantiated. This is especially useful for
# Every top level object in the Context is instantiated. This is especially useful for
# systems that have "floating observers"... objects that are never directly accessed, who
# would thus never be instantiated by coincedence. This does not build any subcontexts
# would thus never be instantiated by coincedence. This does not build any subcontexts
# that may exist.
def build_everything
@defs.keys.each { |k| self[k] }
@@ -131,7 +131,7 @@ module DIY #:nodoc:#
# we modify the info hash below so it's important to have a new
# instance to play with
info = info.dup if info
# see if we are building a factory
if info and info.has_key?('builds')
unless info.has_key?('auto_require')
@@ -150,21 +150,21 @@ module DIY #:nodoc:#
name = name.to_s
case name
when /^\+/
when /^\+/
# subcontext
@sub_context_defs[name.gsub(/^\+/,'')] = info
when /^using_namespace/
# namespace: use a module(s) prefix for the classname of contained object defs
# NOTE: namespacing is NOT scope... it's just a convenient way to setup class names for a group of objects.
get_defs_from info, parse_namespace(name)
when /^method\s/
key_name = name.gsub(/^method\s/, "")
@defs[key_name] = MethodDef.new(:name => key_name,
:object => info['object'],
@defs[key_name] = MethodDef.new(:name => key_name,
:object => info['object'],
:method => info['method'],
:attach => info['attach'])
else
else
# Normal object def
info ||= {}
if extra_inputs_has(name)
@@ -173,14 +173,14 @@ module DIY #:nodoc:#
unless info.has_key?('auto_require')
info['auto_require'] = self.class.auto_require
end
if namespace
if namespace
if info['class']
info['class'] = namespace.build_classname(info['class'])
else
info['class'] = namespace.build_classname(name)
end
end
@defs[name] = ObjectDef.new(:name => name, :info => info)
end
@@ -191,10 +191,10 @@ module DIY #:nodoc:#
method_definition = @defs[key]
object = get_object(method_definition.object)
method = object.method(method_definition.method)
unless method_definition.attach.nil?
instance_var_name = "@__diy_#{method_definition.object}"
method_definition.attach.each do |object_key|
get_object(object_key).instance_eval do
instance_variable_set(instance_var_name, object)
@@ -202,14 +202,14 @@ module DIY #:nodoc:#
#{instance_var_name}.#{method_definition.method}(*args)
end|
end
end
end
end
return method
rescue Exception => oops
build_and_raise_construction_error(key, oops)
end
def construct_object(key)
# Find the object definition
obj_def = @defs[key]
@@ -242,13 +242,13 @@ module DIY #:nodoc:#
rescue Exception => oops
build_and_raise_construction_error(key, oops)
end
def build_and_raise_construction_error(key, oops)
cerr = ConstructionError.new(key,oops)
cerr.set_backtrace(oops.backtrace)
raise cerr
end
def get_class_for_name_with_module_delimeters(class_name)
class_name.split(/::/).inject(Object) do |mod,const_name| mod.const_get(const_name) end
end
@@ -264,7 +264,7 @@ module DIY #:nodoc:#
Namespace.new(str)
end
end
class Namespace #:nodoc:#
def initialize(str)
# 'using_namespace Animal Reptile'
@@ -292,15 +292,15 @@ module DIY #:nodoc:#
@name = obj_name
end
end
class MethodDef #:nodoc:
attr_accessor :name, :object, :method, :attach
def initialize(opts)
@name, @object, @method, @attach = opts[:name], opts[:object], opts[:method], opts[:attach]
end
end
class ObjectDef #:nodoc:
attr_accessor :name, :class_name, :library, :components
def initialize(opts)
@@ -330,7 +330,7 @@ module DIY #:nodoc:#
# Use Class Directly
@use_class_directly = info.delete 'use_class_directly'
# Auto-compose
compose = info.delete 'compose'
if compose
@@ -380,7 +380,7 @@ module DIY #:nodoc:#
object_name = object_name
cause = cause
m = "Failed to construct '#{object_name}'"
if cause
if cause
m << "\n ...caused by:\n >>> #{cause}"
end
super m
@@ -388,11 +388,11 @@ module DIY #:nodoc:#
end
class NamespaceError < RuntimeError #:nodoc:#
end
end
module Infl #:nodoc:#
# Ganked this from Inflector:
def self.camelize(lower_case_and_underscored_word)
def self.camelize(lower_case_and_underscored_word)
lower_case_and_underscored_word.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
end
# Ganked this from Inflector:

View File

@@ -1,7 +1,7 @@
module DIY #:nodoc:#
class FactoryDef #:nodoc:
attr_accessor :name, :target, :class_name, :library
def initialize(opts)
@name, @target, @library, @auto_require =
opts[:name], opts[:target], opts[:library], opts[:auto_require]
@@ -10,7 +10,7 @@ module DIY #:nodoc:#
@library ||= Infl.underscore(@class_name) if @auto_require
end
end
class Context
def construct_factory(key)
factory_def = @defs[key]
@@ -33,4 +33,3 @@ module DIY #:nodoc:#
end
end
end

View File

@@ -18,7 +18,7 @@
- Defs.h
- Board.h
- Exception.h
:boilerplates:
:boilerplates:
#these are inserted at the top of generated files.
#just comment out or remove if not desired.
#use %1$s where you would like the file name to appear (path/extension not included)

View File

@@ -6,6 +6,6 @@
#
unity_dir = include_directories('.')
unity_lib = static_library(meson.project_name(),
unity_lib = static_library(meson.project_name(),
files('unity.c'),
include_directories: unity_dir)