ceedling 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +55 -6
- data/examples/temp_sensor/project.yml +2 -2
- data/lib/ceedling/version.rb +3 -3
- data/lib/ceedling/version.rb.erb +1 -1
- data/new_project_template/project.yml +1 -1
- data/new_project_template/vendor/ceedling/{vendor/c_exception/docs → docs}/CExceptionSummary.pdf +0 -0
- data/new_project_template/vendor/ceedling/vendor/cmock/docs/CMock Summary.pdf b/data/new_project_template/vendor/ceedling/docs/CMock → Summary.pdf +0 -0
- data/new_project_template/vendor/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf b/data/new_project_template/vendor/ceedling/docs/Unity → Summary.pdf +0 -0
- data/new_project_template/vendor/ceedling/lib/configurator.rb +65 -16
- data/new_project_template/vendor/ceedling/lib/configurator_builder.rb +1 -8
- data/new_project_template/vendor/ceedling/lib/configurator_plugins.rb +8 -1
- data/new_project_template/vendor/ceedling/lib/configurator_setup.rb +30 -34
- data/new_project_template/vendor/ceedling/lib/configurator_validator.rb +32 -5
- data/new_project_template/vendor/ceedling/lib/constants.rb +17 -4
- data/new_project_template/vendor/ceedling/lib/defaults.rb +120 -106
- data/new_project_template/vendor/ceedling/lib/file_path_utils.rb +1 -1
- data/new_project_template/vendor/ceedling/lib/generator.rb +14 -6
- data/new_project_template/vendor/ceedling/lib/objects.yml +5 -0
- data/new_project_template/vendor/ceedling/lib/plugin.rb +2 -1
- data/new_project_template/vendor/ceedling/lib/plugin_manager.rb +6 -1
- data/new_project_template/vendor/ceedling/lib/preprocessinator_file_handler.rb +2 -2
- data/new_project_template/vendor/ceedling/lib/preprocessinator_includes_handler.rb +2 -2
- data/new_project_template/vendor/ceedling/lib/rules_cmock.rake +1 -1
- data/new_project_template/vendor/ceedling/lib/rules_preprocess.rake +2 -2
- data/new_project_template/vendor/ceedling/lib/rules_release.rake +4 -4
- data/new_project_template/vendor/ceedling/lib/rules_release_aux_dependencies.rake +1 -1
- data/new_project_template/vendor/ceedling/lib/rules_tests.rake +5 -5
- data/new_project_template/vendor/ceedling/lib/rules_tests_aux_dependencies.rake +1 -1
- data/new_project_template/vendor/ceedling/lib/setupinator.rb +10 -3
- data/new_project_template/vendor/ceedling/lib/system_utils.rb +32 -0
- data/new_project_template/vendor/ceedling/lib/system_wrapper.rb +13 -5
- data/new_project_template/vendor/ceedling/lib/tasks_base.rake +2 -2
- data/new_project_template/vendor/ceedling/lib/tasks_release.rake +1 -1
- data/new_project_template/vendor/ceedling/lib/tasks_tests.rake +1 -1
- data/new_project_template/vendor/ceedling/lib/tool_executor.rb +38 -10
- data/new_project_template/vendor/ceedling/lib/tool_executor_helper.rb +68 -10
- data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rake +142 -0
- data/new_project_template/vendor/ceedling/plugins/bullseye/bullseye.rb +145 -0
- data/new_project_template/vendor/ceedling/plugins/bullseye/defaults.yml +49 -0
- data/new_project_template/vendor/ceedling/plugins/bullseye/template.erb +15 -0
- data/new_project_template/vendor/ceedling/plugins/gcov/defaults.yml +34 -0
- data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rake +136 -0
- data/new_project_template/vendor/ceedling/plugins/gcov/gcov.rb +115 -0
- data/new_project_template/vendor/ceedling/plugins/gcov/template.erb +15 -0
- data/new_project_template/vendor/ceedling/plugins/stdout_ide_tests_report/stdout_ide_tests_report.rb +1 -1
- data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/stdout_pretty_tests_report.rb +3 -63
- data/new_project_template/vendor/ceedling/plugins/stdout_pretty_tests_report/template.erb +59 -0
- data/new_project_template/vendor/ceedling/plugins/warnings_report/warnings_report.rb +71 -0
- data/new_project_template/vendor/ceedling/release/build.info +1 -1
- data/new_project_template/vendor/ceedling/vendor/c_exception/release/version.info +1 -1
- data/new_project_template/vendor/ceedling/vendor/unity/src/unity.c +30 -21
- metadata +18 -27
- data/new_project_template/vendor/ceedling/docs/Ceedling Packet.odt +0 -0
- data/new_project_template/vendor/ceedling/docs/CeedlingLogo.png +0 -0
- data/new_project_template/vendor/ceedling/rakefile.rb +0 -59
- data/new_project_template/vendor/ceedling/rakefile_helper.rb +0 -23
- data/new_project_template/vendor/ceedling/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/new_project_template/vendor/ceedling/vendor/c_exception/docs/license.txt +0 -30
- data/new_project_template/vendor/ceedling/vendor/c_exception/docs/readme.txt +0 -236
- data/new_project_template/vendor/ceedling/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -217
- data/new_project_template/vendor/ceedling/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/new_project_template/vendor/ceedling/vendor/cmock/docs/license.txt +0 -31
- data/new_project_template/vendor/ceedling/vendor/deep_merge/MIT-LICENSE +0 -20
- data/new_project_template/vendor/ceedling/vendor/deep_merge/README +0 -94
- data/new_project_template/vendor/ceedling/vendor/deep_merge/Rakefile +0 -28
- data/new_project_template/vendor/ceedling/vendor/deep_merge/test/test_deep_merge.rb +0 -553
- data/new_project_template/vendor/ceedling/vendor/diy/History.txt +0 -28
- data/new_project_template/vendor/ceedling/vendor/diy/README.rdoc +0 -233
- data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.odt +0 -0
- data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/new_project_template/vendor/ceedling/vendor/unity/docs/Unity Summary.txt +0 -217
- data/new_project_template/vendor/ceedling/vendor/unity/docs/license.txt +0 -31
@@ -8,8 +8,8 @@ class PreprocessinatorFileHandler
|
|
8
8
|
def preprocess_file(filepath, includes)
|
9
9
|
preprocessed_filepath = @file_path_utils.form_preprocessed_file_filepath(filepath)
|
10
10
|
|
11
|
-
|
12
|
-
@tool_executor.exec(
|
11
|
+
command = @tool_executor.build_command_line(@configurator.tools_test_file_preprocessor, filepath, preprocessed_filepath)
|
12
|
+
@tool_executor.exec(command[:line], command[:options])
|
13
13
|
|
14
14
|
contents = @preprocessinator_extractor.extract_base_file_from_preprocessed_expansion(preprocessed_filepath)
|
15
15
|
|
@@ -24,8 +24,8 @@ class PreprocessinatorIncludesHandler
|
|
24
24
|
|
25
25
|
# extract the make-style dependency rule telling the preprocessor to
|
26
26
|
# ignore the fact that it can't find the included files
|
27
|
-
|
28
|
-
shell_result = @tool_executor.exec(
|
27
|
+
command = @tool_executor.build_command_line(@configurator.tools_test_includes_preprocessor, temp_filepath)
|
28
|
+
shell_result = @tool_executor.exec(command[:line], command[:options])
|
29
29
|
|
30
30
|
return shell_result[:output]
|
31
31
|
end
|
@@ -5,5 +5,5 @@ rule(/#{CMOCK_MOCK_PREFIX}.+#{'\\'+EXTENSION_SOURCE}$/ => [
|
|
5
5
|
@ceedling[:file_finder].find_header_input_for_mock_file(task_name)
|
6
6
|
end
|
7
7
|
]) do |mock|
|
8
|
-
@ceedling[:generator].generate_mock(
|
8
|
+
@ceedling[:generator].generate_mock(TEST_SYM, mock.source)
|
9
9
|
end
|
@@ -11,7 +11,7 @@ rule(/#{PROJECT_TEST_PREPROCESS_FILES_PATH}\/.+/ => [
|
|
11
11
|
if (not @ceedling[:configurator].project_use_auxiliary_dependencies)
|
12
12
|
raise 'ERROR: Ceedling preprocessing rule invoked though neccessary auxiliary dependency support not enabled.'
|
13
13
|
end
|
14
|
-
@ceedling[:generator].generate_preprocessed_file(
|
14
|
+
@ceedling[:generator].generate_preprocessed_file(TEST_SYM, file.source)
|
15
15
|
end
|
16
16
|
|
17
17
|
|
@@ -21,6 +21,6 @@ rule(/#{PROJECT_TEST_PREPROCESS_INCLUDES_PATH}\/.+/ => [
|
|
21
21
|
@ceedling[:file_finder].find_test_or_source_or_header_file(task_name)
|
22
22
|
end
|
23
23
|
]) do |file|
|
24
|
-
@ceedling[:generator].generate_shallow_includes_list(
|
24
|
+
@ceedling[:generator].generate_shallow_includes_list(TEST_SYM, file.source)
|
25
25
|
end
|
26
26
|
|
@@ -9,7 +9,7 @@ rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_ASM_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ =>
|
|
9
9
|
@ceedling[:file_finder].find_assembly_file(task_name)
|
10
10
|
end
|
11
11
|
]) do |object|
|
12
|
-
@ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER,
|
12
|
+
@ceedling[:generator].generate_object_file(TOOLS_RELEASE_ASSEMBLER, RELEASE_SYM, object.source, object.name)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
@@ -19,16 +19,16 @@ rule(/#{PROJECT_RELEASE_BUILD_OUTPUT_C_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [
|
|
19
19
|
@ceedling[:file_finder].find_compilation_input_file(task_name)
|
20
20
|
end
|
21
21
|
]) do |object|
|
22
|
-
@ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER,
|
22
|
+
@ceedling[:generator].generate_object_file(TOOLS_RELEASE_COMPILER, RELEASE_SYM, object.source, object.name)
|
23
23
|
end
|
24
24
|
|
25
25
|
|
26
26
|
rule(/#{PROJECT_RELEASE_BUILD_TARGET}/) do |bin_file|
|
27
|
-
@ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER,
|
27
|
+
@ceedling[:generator].generate_executable_file(TOOLS_RELEASE_LINKER, RELEASE_SYM, bin_file.prerequisites, bin_file.name)
|
28
28
|
end
|
29
29
|
|
30
30
|
|
31
|
-
namespace
|
31
|
+
namespace RELEASE_SYM do
|
32
32
|
# use rules to increase efficiency for large projects (instead of iterating through all sources and creating defined tasks)
|
33
33
|
|
34
34
|
namespace :compile do
|
@@ -7,7 +7,7 @@ rule(/#{PROJECT_RELEASE_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ =
|
|
7
7
|
]) do |dep|
|
8
8
|
@ceedling[:generator].generate_dependencies_file(
|
9
9
|
TOOLS_RELEASE_DEPENDENCIES_GENERATOR,
|
10
|
-
|
10
|
+
RELEASE_SYM,
|
11
11
|
dep.source,
|
12
12
|
@ceedling[:file_path_utils].form_release_build_c_object_filepath(dep.source),
|
13
13
|
dep.name)
|
@@ -5,7 +5,7 @@ rule(/#{PROJECT_TEST_FILE_PREFIX}#{'.+'+TEST_RUNNER_FILE_SUFFIX}#{'\\'+EXTENSION
|
|
5
5
|
@ceedling[:file_finder].find_test_input_for_runner_file(task_name)
|
6
6
|
end
|
7
7
|
]) do |runner|
|
8
|
-
@ceedling[:generator].generate_test_runner(
|
8
|
+
@ceedling[:generator].generate_test_runner(TEST_SYM, runner.source, runner.name)
|
9
9
|
end
|
10
10
|
|
11
11
|
|
@@ -14,12 +14,12 @@ rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_OBJECT}$/ => [
|
|
14
14
|
@ceedling[:file_finder].find_compilation_input_file(task_name)
|
15
15
|
end
|
16
16
|
]) do |object|
|
17
|
-
@ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER,
|
17
|
+
@ceedling[:generator].generate_object_file(TOOLS_TEST_COMPILER, TEST_SYM, object.source, object.name)
|
18
18
|
end
|
19
19
|
|
20
20
|
|
21
21
|
rule(/#{PROJECT_TEST_BUILD_OUTPUT_PATH}\/#{'.+\\'+EXTENSION_EXECUTABLE}$/) do |bin_file|
|
22
|
-
@ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER,
|
22
|
+
@ceedling[:generator].generate_executable_file(TOOLS_TEST_LINKER, TEST_SYM, bin_file.prerequisites, bin_file.name)
|
23
23
|
end
|
24
24
|
|
25
25
|
|
@@ -28,11 +28,11 @@ rule(/#{PROJECT_TEST_RESULTS_PATH}\/#{'.+\\'+EXTENSION_TESTPASS}$/ => [
|
|
28
28
|
@ceedling[:file_path_utils].form_test_executable_filepath(task_name)
|
29
29
|
end
|
30
30
|
]) do |test_result|
|
31
|
-
@ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE,
|
31
|
+
@ceedling[:generator].generate_test_results(TOOLS_TEST_FIXTURE, TEST_SYM, test_result.source, test_result.name)
|
32
32
|
end
|
33
33
|
|
34
34
|
|
35
|
-
namespace
|
35
|
+
namespace TEST_SYM do
|
36
36
|
# use rules to increase efficiency for large projects (instead of iterating through all sources and creating defined tasks)
|
37
37
|
|
38
38
|
rule(/^#{TEST_TASK_ROOT}\S+$/ => [ # test task names by regex
|
@@ -7,7 +7,7 @@ rule(/#{PROJECT_TEST_DEPENDENCIES_PATH}\/#{'.+\\'+EXTENSION_DEPENDENCIES}$/ => [
|
|
7
7
|
]) do |dep|
|
8
8
|
@ceedling[:generator].generate_dependencies_file(
|
9
9
|
TOOLS_TEST_DEPENDENCIES_GENERATOR,
|
10
|
-
|
10
|
+
TEST_SYM,
|
11
11
|
dep.source,
|
12
12
|
@ceedling[:file_path_utils].form_test_build_object_filepath(dep.source),
|
13
13
|
dep.name)
|
@@ -24,15 +24,22 @@ class Setupinator
|
|
24
24
|
@ceedling[:configurator].populate_unity_defines( config_hash )
|
25
25
|
@ceedling[:configurator].populate_cmock_defaults( config_hash )
|
26
26
|
@ceedling[:configurator].find_and_merge_plugins( config_hash )
|
27
|
-
@ceedling[:configurator].
|
27
|
+
@ceedling[:configurator].tools_setup( config_hash )
|
28
28
|
@ceedling[:configurator].eval_environment_variables( config_hash )
|
29
29
|
@ceedling[:configurator].eval_paths( config_hash )
|
30
30
|
@ceedling[:configurator].standardize_paths( config_hash )
|
31
31
|
@ceedling[:configurator].validate( config_hash )
|
32
|
-
@ceedling[:configurator].build( config_hash )
|
32
|
+
@ceedling[:configurator].build( config_hash, :environment )
|
33
|
+
|
33
34
|
@ceedling[:configurator].insert_rake_plugins( @ceedling[:configurator].rake_plugins )
|
35
|
+
@ceedling[:configurator].tools_supplement_arguments( config_hash )
|
36
|
+
|
37
|
+
# merge in any environment variables plugins specify, after the main build
|
38
|
+
@ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling ) do |env|
|
39
|
+
@ceedling[:configurator].eval_environment_variables( env )
|
40
|
+
@ceedling[:configurator].build_supplement( config_hash, env )
|
41
|
+
end
|
34
42
|
|
35
|
-
@ceedling[:plugin_manager].load_plugin_scripts( @ceedling[:configurator].script_plugins, @ceedling )
|
36
43
|
@ceedling[:plugin_reportinator].set_system_objects( @ceedling )
|
37
44
|
@ceedling[:file_finder].prepare_search_sources
|
38
45
|
@ceedling[:loginator].setup_log_filepath
|
@@ -0,0 +1,32 @@
|
|
1
|
+
|
2
|
+
class Object
|
3
|
+
def deep_clone
|
4
|
+
Marshal::load(Marshal.dump(self))
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
|
9
|
+
class SystemUtils
|
10
|
+
|
11
|
+
constructor :system_wrapper
|
12
|
+
|
13
|
+
def setup
|
14
|
+
@tcsh_shell = nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def tcsh_shell?
|
18
|
+
# once run a single time, return state determined at that execution
|
19
|
+
return @tcsh_shell if not @tcsh_shell.nil?
|
20
|
+
|
21
|
+
result = @system_wrapper.shell_backticks('echo $version')
|
22
|
+
|
23
|
+
if ((result[:exit_code] == 0) and (result[:output].strip =~ /^tcsh/))
|
24
|
+
@tcsh_shell = true
|
25
|
+
else
|
26
|
+
@tcsh_shell = false
|
27
|
+
end
|
28
|
+
|
29
|
+
return @tcsh_shell
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
@@ -3,13 +3,13 @@ require 'rbconfig'
|
|
3
3
|
class SystemWrapper
|
4
4
|
|
5
5
|
# static method for use in defaults
|
6
|
-
def self.
|
6
|
+
def self.windows?
|
7
7
|
return ((Config::CONFIG['host_os'] =~ /mswin|mingw/) ? true : false)
|
8
8
|
end
|
9
9
|
|
10
10
|
# class method so as to be mockable for tests
|
11
|
-
def
|
12
|
-
return SystemWrapper.
|
11
|
+
def windows?
|
12
|
+
return SystemWrapper.windows?
|
13
13
|
end
|
14
14
|
|
15
15
|
def module_eval(string)
|
@@ -40,9 +40,17 @@ class SystemWrapper
|
|
40
40
|
return Time.now.asctime
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
43
|
+
def shell_backticks(command)
|
44
44
|
return {
|
45
|
-
:output
|
45
|
+
:output => `#{command}`,
|
46
|
+
:exit_code => ($?.exitstatus)
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
def shell_system(command)
|
51
|
+
system( command )
|
52
|
+
return {
|
53
|
+
:output => '',
|
46
54
|
:exit_code => ($?.exitstatus)
|
47
55
|
}
|
48
56
|
end
|
@@ -64,10 +64,10 @@ end
|
|
64
64
|
|
65
65
|
|
66
66
|
# list expanded environment variables
|
67
|
-
if (not
|
67
|
+
if (not ENVIRONMENT.empty?)
|
68
68
|
desc "List all configured environment variables."
|
69
69
|
task :environment do
|
70
|
-
|
70
|
+
ENVIRONMENT.each do |env|
|
71
71
|
env.each_key do |key|
|
72
72
|
name = key.to_s.upcase
|
73
73
|
puts " - #{name}: \"#{env[key]}\""
|
@@ -3,7 +3,7 @@ require 'file_path_utils'
|
|
3
3
|
|
4
4
|
|
5
5
|
desc "Build release target."
|
6
|
-
task
|
6
|
+
task RELEASE_SYM => [:directories] do
|
7
7
|
header = "Release build '#{File.basename(PROJECT_RELEASE_BUILD_TARGET)}'"
|
8
8
|
@ceedling[:streaminator].stdout_puts("\n\n#{header}\n#{'-' * header.length}")
|
9
9
|
|
@@ -15,27 +15,55 @@ class ToolExecutor
|
|
15
15
|
@tool_name = tool_config[:name]
|
16
16
|
@executable = tool_config[:executable]
|
17
17
|
|
18
|
+
command = {}
|
19
|
+
|
18
20
|
# basic premise is to iterate top to bottom through arguments using '$' as
|
19
21
|
# a string replacement indicator to expand globals or inline yaml arrays
|
20
22
|
# into command line arguments via substitution strings
|
21
|
-
|
23
|
+
command[:line] = [
|
22
24
|
@tool_executor_helper.osify_path_separators( expandify_element(@executable, *args) ),
|
23
25
|
build_arguments(tool_config[:arguments], *args),
|
24
|
-
|
26
|
+
].join(' ').strip
|
27
|
+
|
28
|
+
command[:options] = {
|
29
|
+
:stderr_redirect => @tool_executor_helper.stderr_redirection(tool_config, @configurator.project_logging),
|
30
|
+
:background_exec => tool_config[:background_exec]
|
31
|
+
}
|
32
|
+
|
33
|
+
return command
|
25
34
|
end
|
26
35
|
|
27
36
|
|
28
37
|
# shell out, execute command, and return response
|
29
|
-
def exec(command, args=[]
|
30
|
-
|
38
|
+
def exec(command, options={}, args=[])
|
39
|
+
options[:boom] = true if (options[:boom].nil?)
|
40
|
+
options[:stderr_redirect] = StdErrRedirect::NONE if (options[:stderr_redirect].nil?)
|
41
|
+
options[:background_exec] = BackgroundExec::NONE if (options[:background_exec].nil?)
|
31
42
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
43
|
+
# build command line
|
44
|
+
command_line = [
|
45
|
+
@tool_executor_helper.background_exec_cmdline_prepend( options ),
|
46
|
+
command.strip,
|
47
|
+
args,
|
48
|
+
@tool_executor_helper.stderr_redirect_cmdline_append( options ),
|
49
|
+
@tool_executor_helper.background_exec_cmdline_append( options ),
|
50
|
+
].flatten.compact.join(' ')
|
51
|
+
|
52
|
+
shell_result = {}
|
53
|
+
|
54
|
+
# depending on background exec option, we shell out differently
|
55
|
+
if (options[:background_exec] != BackgroundExec::NONE)
|
56
|
+
shell_result = @system_wrapper.shell_system( command_line )
|
57
|
+
else
|
58
|
+
shell_result = @system_wrapper.shell_backticks( command_line )
|
59
|
+
end
|
60
|
+
|
61
|
+
@tool_executor_helper.print_happy_results( command_line, shell_result, options[:boom] )
|
62
|
+
@tool_executor_helper.print_error_results( command_line, shell_result, options[:boom] )
|
63
|
+
|
64
|
+
# go boom if exit code isn't 0 (but in some cases we don't want a non-0 exit code to raise)
|
37
65
|
raise if ((shell_result[:exit_code] != 0) and options[:boom])
|
38
|
-
|
66
|
+
|
39
67
|
return shell_result
|
40
68
|
end
|
41
69
|
|
@@ -2,22 +2,61 @@ require 'constants' # for Verbosity enumeration & $stderr redirect enumeration
|
|
2
2
|
|
3
3
|
class ToolExecutorHelper
|
4
4
|
|
5
|
-
constructor :streaminator, :system_wrapper
|
5
|
+
constructor :streaminator, :system_utils, :system_wrapper
|
6
|
+
|
7
|
+
def stderr_redirection(tool_config, logging)
|
8
|
+
# if there's no logging enabled, return :stderr_redirect unmodified
|
9
|
+
return tool_config[:stderr_redirect] if (not logging)
|
10
|
+
|
11
|
+
# if there is logging enabled but the redirect is a custom value (not enum), return the custom string
|
12
|
+
return tool_config[:stderr_redirect] if (tool_config[:stderr_redirect].class == String)
|
13
|
+
|
14
|
+
# if logging is enabled but there's no custom string, return the AUTO enumeration so $stderr goes into the log
|
15
|
+
return StdErrRedirect::AUTO
|
16
|
+
end
|
17
|
+
|
18
|
+
def background_exec_cmdline_prepend(tool_config)
|
19
|
+
return nil if (tool_config[:background_exec].nil?)
|
20
|
+
|
21
|
+
config_exec = tool_config[:background_exec]
|
22
|
+
|
23
|
+
if ((config_exec == BackgroundExec::AUTO) and (@system_wrapper.windows?))
|
24
|
+
return 'start'
|
25
|
+
end
|
26
|
+
|
27
|
+
if (config_exec == BackgroundExec::WIN)
|
28
|
+
return 'start'
|
29
|
+
end
|
30
|
+
|
31
|
+
return nil
|
32
|
+
end
|
6
33
|
|
7
34
|
def osify_path_separators(executable)
|
8
|
-
return executable.gsub(/\//, '\\') if (@system_wrapper.
|
35
|
+
return executable.gsub(/\//, '\\') if (@system_wrapper.windows?)
|
9
36
|
return executable
|
10
37
|
end
|
11
38
|
|
12
|
-
def
|
39
|
+
def stderr_redirect_cmdline_append(tool_config)
|
13
40
|
return nil if (tool_config[:stderr_redirect].nil?)
|
14
41
|
|
15
|
-
|
42
|
+
config_redirect = tool_config[:stderr_redirect]
|
43
|
+
redirect = StdErrRedirect::NONE
|
16
44
|
|
45
|
+
if (config_redirect == StdErrRedirect::AUTO)
|
46
|
+
if (@system_wrapper.windows?)
|
47
|
+
redirect = StdErrRedirect::WIN
|
48
|
+
else
|
49
|
+
if (@system_utils.tcsh_shell?)
|
50
|
+
redirect = StdErrRedirect::TCSH
|
51
|
+
else
|
52
|
+
redirect = StdErrRedirect::UNIX
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
17
57
|
case redirect
|
18
58
|
# we may need more complicated processing after some learning with various environments
|
19
59
|
when StdErrRedirect::NONE then nil
|
20
|
-
when StdErrRedirect::AUTO then '2>&1'
|
21
60
|
when StdErrRedirect::WIN then '2>&1'
|
22
61
|
when StdErrRedirect::UNIX then '2>&1'
|
23
62
|
when StdErrRedirect::TCSH then '|&'
|
@@ -25,22 +64,41 @@ class ToolExecutorHelper
|
|
25
64
|
end
|
26
65
|
end
|
27
66
|
|
67
|
+
def background_exec_cmdline_append(tool_config)
|
68
|
+
return nil if (tool_config[:background_exec].nil?)
|
69
|
+
|
70
|
+
config_exec = tool_config[:background_exec]
|
71
|
+
|
72
|
+
# if :auto & windows, then we already prepended 'start' and should append nothing
|
73
|
+
return nil if ((config_exec == BackgroundExec::AUTO) and (@system_wrapper.windows?))
|
74
|
+
|
75
|
+
# if :auto & not windows, then we append standard '&'
|
76
|
+
return '&' if ((config_exec == BackgroundExec::AUTO) and (not @system_wrapper.windows?))
|
77
|
+
|
78
|
+
# if explicitly Unix, then append '&'
|
79
|
+
return '&' if (config_exec == BackgroundExec::UNIX)
|
80
|
+
|
81
|
+
# all other cases, including :none, :win, & anything unrecognized, append nothing
|
82
|
+
return nil
|
83
|
+
end
|
84
|
+
|
28
85
|
# if command succeeded and we have verbosity cranked up, spill our guts
|
29
|
-
def print_happy_results(command_str, shell_result)
|
30
|
-
if (shell_result[:exit_code] == 0)
|
86
|
+
def print_happy_results(command_str, shell_result, boom)
|
87
|
+
if ((shell_result[:exit_code] == 0) or ((shell_result[:exit_code] != 0) and not boom))
|
31
88
|
output = "> Shell executed command:\n"
|
32
89
|
output += "#{command_str}\n"
|
33
90
|
output += "> Produced response:\n" if (not shell_result[:output].empty?)
|
34
91
|
output += "#{shell_result[:output].strip}\n" if (not shell_result[:output].empty?)
|
92
|
+
output += "> And exited with status: [#{shell_result[:exit_code]}].\n" if (shell_result[:exit_code] != 0)
|
35
93
|
output += "\n"
|
36
|
-
|
94
|
+
|
37
95
|
@streaminator.stdout_puts(output, Verbosity::OBNOXIOUS)
|
38
96
|
end
|
39
97
|
end
|
40
98
|
|
41
99
|
# if command failed and we have verbosity set to minimum error level, spill our guts
|
42
|
-
def print_error_results(command_str, shell_result)
|
43
|
-
if (shell_result[:exit_code] != 0)
|
100
|
+
def print_error_results(command_str, shell_result, boom)
|
101
|
+
if ((shell_result[:exit_code] != 0) and boom)
|
44
102
|
output = "ERROR: Shell command failed.\n"
|
45
103
|
output += "> Shell executed command:\n"
|
46
104
|
output += "'#{command_str}'\n"
|