From 85fa6550232472e4d86d3c58e8a0d3b5503293b3 Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Wed, 21 May 2014 15:26:43 -0400 Subject: [PATCH] - cmock now accepts any combo of yaml and command line options, applying them in the order they appear on the command line (thanks kylebhamilton for the suggestion!) --- lib/cmock.rb | 2 +- lib/cmock_config.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/cmock.rb b/lib/cmock.rb index 848cbd5..2b49896 100644 --- a/lib/cmock.rb +++ b/lib/cmock.rb @@ -77,7 +77,7 @@ if ($0 == __FILE__) filelist = [] ARGV.each do |arg| if (arg =~ /^-o\"?([a-zA-Z0-9._\\\/:\s]+)\"?/) - options = arg.gsub(/^-o/,'') + options.merge CMockConfig.load_config_file_from_yaml( arg.gsub(/^-o/,'') ) elsif (arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)=\"?([a-zA-Z0-9._\\\/:\s\;]+)\"?/) options = option_maker(options, $1, $2) else diff --git a/lib/cmock_config.rb b/lib/cmock_config.rb index 782ad48..2f29be6 100644 --- a/lib/cmock_config.rb +++ b/lib/cmock_config.rb @@ -67,6 +67,10 @@ class CMockConfig end def load_config_file_from_yaml yaml_filename + self.class.load_config_file_from_yaml yaml_filename + end + + def self.load_config_file_from_yaml yaml_filename require 'yaml' require 'fileutils' YAML.load_file(yaml_filename)[:cmock]