class Object
Constants
- CEEDLING_LIB
- CEEDLING_PLUGINS
- CEEDLING_RELEASE
- CEEDLING_ROOT
get directory containing this here file, back up one directory, and expand to full path
- CEEDLING_VENDOR
this should be defined already, but not always during system specs
- CEXCEPTION_C_FILE
- CEXCEPTION_H_FILE
- CEXCEPTION_LIB_PATH
- CEXCEPTION_ROOT_PATH
- CMOCK_C_FILE
- CMOCK_H_FILE
- CMOCK_LIB_PATH
- CMOCK_ROOT_PATH
- DEFAULT_CEEDLING_CONFIG
- DEFAULT_CEEDLING_MAIN_PROJECT_FILE
- DEFAULT_CEEDLING_USER_PROJECT_FILE
- DEFAULT_RELEASE_ASSEMBLER_TOOL
- DEFAULT_RELEASE_COMPILER_TOOL
- DEFAULT_RELEASE_DEPENDENCIES_GENERATOR_TOOL
- DEFAULT_RELEASE_LINKER_TOOL
- DEFAULT_RELEASE_TARGET_NAME
- DEFAULT_TESTS_RESULTS_REPORT_TEMPLATE
- DEFAULT_TEST_COMPILER_TOOL
- DEFAULT_TEST_DEPENDENCIES_GENERATOR_TOOL
- DEFAULT_TEST_FILE_PREPROCESSOR_DIRECTIVES_TOOL
- DEFAULT_TEST_FILE_PREPROCESSOR_TOOL
- DEFAULT_TEST_FIXTURE_TOOL
- DEFAULT_TEST_INCLUDES_PREPROCESSOR_TOOL
- DEFAULT_TEST_LINKER_TOOL
- DEFAULT_TOOLS_RELEASE
- DEFAULT_TOOLS_RELEASE_ASSEMBLER
- DEFAULT_TOOLS_RELEASE_DEPENDENCIES
- DEFAULT_TOOLS_TEST
- DEFAULT_TOOLS_TEST_DEPENDENCIES
- DEFAULT_TOOLS_TEST_PREPROCESSORS
- DEFINES_DEPENDENCY_CACHE_FILE
- EXTENSION_NONWIN_EXE
- EXTENSION_WIN_EXE
- GENERATED_DIR_PATH
- INPUT_CONFIGURATION_CACHE_FILE
- MD_FLAG
- NULL_FILE_PATH
- OPERATION_ASSEMBLE_SYM
- OPERATION_COMPILE_SYM
- OPERATION_LINK_SYM
- PROJECT_ROOT
- REFRESH_ROOT_NAME
- REFRESH_SYM
- REFRESH_TASK_ROOT
- RELEASE_BASE_PATH
- RELEASE_ROOT_NAME
- RELEASE_SYM
- RELEASE_TASK_ROOT
- RUBY_EVAL_REPLACEMENT_PATTERN
- RUBY_STRING_REPLACEMENT_PATTERN
- TESTS_BASE_PATH
- TEST_ROOT_NAME
- TEST_STDOUT_STATISTICS_PATTERN
- TEST_SYM
- TEST_TASK_ROOT
- TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN
- UNITY_C_FILE
- UNITY_H_FILE
- UNITY_INTERNALS_H_FILE
- UNITY_LIB_PATH
- UNITY_ROOT_PATH
- UTILS_ROOT_NAME
- UTILS_SYM
- UTILS_TASK_ROOT
- VENDORS_FILES
Public Instance Methods
ceedling_form_filepath(destination_path, original_filepath, new_extension=nil)
click to toggle source
global utility methods (for plugins, project files, etc.)
# File lib/ceedling/file_path_utils.rb, line 7 def ceedling_form_filepath(destination_path, original_filepath, new_extension=nil) filename = File.basename(original_filepath) filename.replace(filename.ext(new_extension)) if (!new_extension.nil?) return File.join( destination_path.gsub(/\\/, '/'), filename ) end
deep_clone()
click to toggle source
# File lib/ceedling/system_utils.rb, line 3 def deep_clone Marshal::load(Marshal.dump(self)) end
dehashify_argument_elements(hash)
click to toggle source
handle argument hash: keys are substitution strings, values are data to be expanded within substitution strings
# File lib/ceedling/tool_executor.rb, line 174 def dehashify_argument_elements(hash) build_string = '' elements = [] # grab the substitution string (hash key) substitution = hash.keys[0].to_s # grab the string(s) to squirt into the substitution string (hash value) expand = hash[hash.keys[0]] if (expand.nil?) @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' could not expand nil elements for substitution string '#{substitution}'.", Verbosity::ERRORS) raise end # array-ify expansion input if only a single string expansion = ((expand.class == String) ? [expand] : expand) expansion.each do |item| # code eval substitution if (item =~ RUBY_EVAL_REPLACEMENT_PATTERN) elements << eval($1) # string eval substitution elsif (item =~ RUBY_STRING_REPLACEMENT_PATTERN) elements << @system_wrapper.module_eval(item) # global constants elsif (@system_wrapper.constants_include?(item)) const = Object.const_get(item) if (const.nil?) @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' found constant '#{item}' to be nil.", Verbosity::ERRORS) raise else elements << const end elsif (item.class == Array) elements << item elsif (item.class == String) @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand nonexistent value '#{item}' for substitution string '#{substitution}'.", Verbosity::ERRORS) raise else @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' cannot expand value having type '#{item.class}' for substitution string '#{substitution}'.", Verbosity::ERRORS) raise end end # expand elements (whether string or array) into substitution string & replace escaped '\$' elements.flatten! elements.each do |element| build_string.concat( substitution.sub(/([^\\]*)\$/, "\\1#{element}") ) # don't replace escaped '\$' but allow us to replace just a lonesome '$' build_string.gsub!(/\\\$/, '$') build_string.concat(' ') end return build_string.strip end
execute_plugins(method, *args)
click to toggle source
# File lib/ceedling/plugin_manager.rb, line 96 def execute_plugins(method, *args) @plugin_objects.each do |plugin| begin plugin.send(method, *args) if plugin.respond_to?(method) rescue puts "Exception raised in plugin: #{plugin.name}, in method #{method}" raise end end end
expandify_element(element, *args)
click to toggle source
handle simple text string argument & argument array string replacement operators
# File lib/ceedling/tool_executor.rb, line 129 def expandify_element(element, *args) match = // to_process = nil args_index = 0 # handle ${#} input replacement if (element =~ TOOL_EXECUTOR_ARGUMENT_REPLACEMENT_PATTERN) args_index = ($2.to_i - 1) if (args.nil? or args[args_index].nil?) @streaminator.stderr_puts("ERROR: Tool '#{@tool_name}' expected valid argument data to accompany replacement operator #{$1}.", Verbosity::ERRORS) raise end match = /#{Regexp.escape($1)}/ to_process = args[args_index] end # simple string argument: replace escaped '\$' and strip element.sub!(/\\\$/, '$') element.strip! # handle inline ruby execution if (element =~ RUBY_EVAL_REPLACEMENT_PATTERN) element.replace(eval($1)) end build_string = '' # handle array or anything else passed into method to be expanded in place of replacement operators case (to_process) when Array then to_process.each {|value| build_string.concat( "#{element.sub(match, value.to_s)} " ) } if (to_process.size > 0) else build_string.concat( element.sub(match, to_process.to_s) ) end # handle inline ruby string substitution if (build_string =~ RUBY_STRING_REPLACEMENT_PATTERN) build_string.replace(@system_wrapper.module_eval(build_string)) end return build_string.strip end
extract_from_file(file)
click to toggle source
# File lib/ceedling/test_includes_extractor.rb, line 47 def extract_from_file(file) includes = [] header_extension = @configurator.extension_header contents = @file_wrapper.read(file) # remove line comments contents = contents.gsub(/\/\/.*$/, '') # remove block comments contents = contents.gsub(/\/\*.*?\*\//m, '') contents.split("\n").each do |line| # look for include statement scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+header_extension})\s*\"/) includes << scan_results[0][0] if (scan_results.size > 0) # look for TEST_FILE statement scan_results = line.scan(/TEST_FILE\(\s*\"\s*(.+\.\w+)\s*\"\s*\)/) includes << scan_results[0][0] if (scan_results.size > 0) end return includes.uniq end
extract_source_include_from_file(file)
click to toggle source
# File lib/ceedling/test_includes_extractor.rb, line 73 def extract_source_include_from_file(file) source_includes = [] source_extension = @configurator.extension_source contents = @file_wrapper.read(file) # remove line comments contents = contents.gsub(/\/\/.*$/, '') # remove block comments contents = contents.gsub(/\/\*.*?\*\//m, '') contents.split("\n").each do |line| # look for include statement scan_results = line.scan(/#include\s+\"\s*(.+#{'\\'+source_extension})\s*\"/) source_includes << scan_results[0][0] if (scan_results.size > 0) end return source_includes.uniq end
format_key_sequence(keys, depth)
click to toggle source
# File lib/ceedling/configurator_validator.rb, line 186 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
gather_and_store_includes(file, includes)
click to toggle source
# File lib/ceedling/test_includes_extractor.rb, line 94 def gather_and_store_includes(file, includes) mock_prefix = @configurator.cmock_mock_prefix header_extension = @configurator.extension_header file_key = form_file_key(file) @mocks[file_key] = [] # add includes to lookup hash @includes[file_key] = includes includes.each do |include_file| # check if include is a mock scan_results = include_file.scan(/(#{mock_prefix}.+)#{'\\'+header_extension}/) # add mock to lookup hash @mocks[file_key] << scan_results[0][0] if (scan_results.size > 0) end end
generate_skeleton(src)
click to toggle source
# File vendor/cmock/lib/cmock.rb, line 51 def generate_skeleton(src) name = File.basename(src, '.*') puts "Creating skeleton for #{name}..." unless @silent @cm_generator.create_skeleton(name, @cm_parser.parse(name, File.read(src))) end
import_source()
click to toggle source
# File vendor/cmock/lib/cmock_unityhelper_parser.rb, line 49 def import_source source = @config.load_unity_helper return {} if source.nil? c_types = {} source = source.gsub(/\/\/.*$/, '') # remove line comments source = source.gsub(/\/\*.*?\*\//m, '') # remove block comments # scan for comparison helpers match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+))\s*\(' + Array.new(4, '\s*\w+\s*').join(',') + '\)') pairs = source.scan(match_regex).flatten.compact (pairs.size / 2).times do |i| expect = pairs[i * 2] ctype = pairs[(i * 2) + 1] c_types[ctype] = expect unless expect.include?('_ARRAY') end # scan for array variants of those helpers match_regex = Regexp.new('^\s*#define\s+(UNITY_TEST_ASSERT_EQUAL_(\w+_ARRAY))\s*\(' + Array.new(5, '\s*\w+\s*').join(',') + '\)') pairs = source.scan(match_regex).flatten.compact (pairs.size / 2).times do |i| expect = pairs[i * 2] ctype = pairs[(i * 2) + 1] c_types[ctype.gsub('_ARRAY', '*')] = expect end c_types end
par_map(n, things) { |pop| ... }
click to toggle source
# File lib/ceedling/par_map.rb, line 3 def par_map(n, things, &block) queue = Queue.new things.each { |thing| queue << thing } threads = (1..n).collect do Thread.new do begin while true yield queue.pop(true) end rescue ThreadError end end end threads.each { |t| t.join } end
partition(hash, &predicate)
click to toggle source
:flags:
:release: :compile: :'test_.+' - -pedantic # add '-pedantic' to every test file :*: # add '-foo' to compilation of all files not main.c - -foo - -Wall :test: :link: :test_main: # add '--bar --baz' to linking of test_main.exe - --bar - --baz
# File lib/ceedling/flaginator.rb, line 22 def partition(hash, &predicate) hash.partition(&predicate).map(&:to_h) end