diff options
| author | hathach <[email protected]> | 2019-11-01 17:48:59 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2019-11-01 17:48:59 +0700 |
| commit | b25faa97c2881f6f759188a8e104f1d9f5c18999 (patch) | |
| tree | 2d15f4ddd835ab1c992f4a71ff62d3ea20d134bb /test/vendor/ceedling/plugins/command_hooks/lib | |
| parent | 774a9f63ab1c41b589fffa13b56e78bdfe121d96 (diff) | |
update ceedling to 0.29.0
Diffstat (limited to 'test/vendor/ceedling/plugins/command_hooks/lib')
| -rw-r--r-- | test/vendor/ceedling/plugins/command_hooks/lib/command_hooks.rb | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/test/vendor/ceedling/plugins/command_hooks/lib/command_hooks.rb b/test/vendor/ceedling/plugins/command_hooks/lib/command_hooks.rb index d8525b037..4bf8b5312 100644 --- a/test/vendor/ceedling/plugins/command_hooks/lib/command_hooks.rb +++ b/test/vendor/ceedling/plugins/command_hooks/lib/command_hooks.rb @@ -1,6 +1,5 @@ require 'ceedling/plugin' require 'ceedling/constants' - class CommandHooks < Plugin attr_reader :config @@ -23,7 +22,6 @@ class CommandHooks < Plugin :post_release => ((defined? TOOLS_POST_RELEASE) ? TOOLS_POST_RELEASE : nil ), :pre_build => ((defined? TOOLS_PRE_BUILD) ? TOOLS_PRE_BUILD : nil ), :post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ), - :post_build => ((defined? TOOLS_POST_BUILD) ? TOOLS_POST_BUILD : nil ), :post_error => ((defined? TOOLS_POST_ERROR) ? TOOLS_POST_ERROR : nil ), } @plugin_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) @@ -49,14 +47,33 @@ class CommandHooks < Plugin private + ## + # Run a hook if its available. + # + # :args: + # - hook: Name of the hook to run + # - name: Name of file (default: "") + # + # :return: + # shell_result. + # def run_hook_step(hook, name="") if (hook[:executable]) - args = ( (hook[:args].is_a? Array) ? hook[:args] : [] ) - cmd = @ceedling[:tool_executor].build_command_line( hook, args, name ) - shell_result = @ceedling[:tool_executor].exec( cmd[:line], cmd[:options] ) + # Handle argument replacemant ({$1}), and get commandline + cmd = @ceedling[:tool_executor].build_command_line( hook, [], name ) + shell_result = @ceedling[:tool_executor].exec(cmd[:line], cmd[:options]) end end + ## + # Run a hook if its available. + # + # If __which_hook__ is an array, run each of them sequentially. + # + # :args: + # - which_hook: Name of the hook to run + # - name: Name of file + # def run_hook(which_hook, name="") if (@config[which_hook]) @ceedling[:streaminator].stdout_puts("Running Hook #{which_hook}...", Verbosity::NORMAL) |
