Class: RakeInvocationTracker

Inherits:
Object
  • Object
show all
Defined in:
lib/ceedling/rake_app/rake_invocation_tracker.rb

Overview

=========================================================================

Ceedling - Test-Centered Build System for C ThrowTheSwitch.org Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams SPDX-License-Identifier: MIT

Instance Method Summary collapse

Instance Method Details

#invoked?(regex) ⇒ Boolean

Post-execution lookup: returns true if the matching the given regex was invoked.

Returns:

  • (Boolean)


35
36
37
# File 'lib/ceedling/rake_app/rake_invocation_tracker.rb', line 35

def invoked?(regex)
  return @rake_utils.task_invoked?(regex)
end

#release_build_invoked?Boolean

Post-execution lookup: returns true if any registered release namespace was invoked.

Returns:

  • (Boolean)


27
28
29
30
31
32
# File 'lib/ceedling/rake_app/rake_invocation_tracker.rb', line 27

def release_build_invoked?
  namespaces = @rake_task_registry.namespaces_for_tag( RakeTaskRegistry::TAG_RELEASE )
  return false if namespaces.empty?
  pattern = /^(#{namespaces.map { |ns| Regexp.escape(ns) }.join('|')})(:|$)/
  @rake_utils.task_invoked?( pattern )
end

#test_build_invoked?Boolean

Post-execution lookup: returns true if any registered test namespace was invoked.

Returns:

  • (Boolean)


13
14
15
16
17
18
# File 'lib/ceedling/rake_app/rake_invocation_tracker.rb', line 13

def test_build_invoked?
  namespaces = @rake_task_registry.namespaces_for_tag( RakeTaskRegistry::TAG_TEST )
  return false if namespaces.empty?
  pattern = /^(#{namespaces.map { |ns| Regexp.escape(ns) }.join('|')})(:|$)/
  @rake_utils.task_invoked?( pattern )
end

#test_task_invoked?Boolean

Post-execution lookup: returns true if a test task was invoked. Note: This can include tasks that, in turn, invoke test tasks.

Returns:

  • (Boolean)


22
23
24
# File 'lib/ceedling/rake_app/rake_invocation_tracker.rb', line 22

def test_task_invoked?
  @rake_utils.task_invoked?( /^test(:|$)/ )
end