Module: RakefileComponentResolver
- Defined in:
- lib/ceedling/rake_app/rakefile_component_resolver.rb
Overview
Resolves the ordered list of .rake files Ceedling will load for a given project configuration. Callable from both bin/ (early, before do_setup) and lib/ (within ConfiguratorPlugins). Config must be in structured (pre-flatten) format.
Constant Summary collapse
- STOCK_RAKE_FILES =
%w[ tasks_base.rake tasks_filesystem.rake tasks_tests.rake rules_tests.rake ].freeze
- RELEASE_RAKE_FILES =
%w[ rules_release.rake tasks_release.rake ].freeze
Class Method Summary collapse
-
.plugin_rake_files(config, load_paths) ⇒ Object
Returns ordered list of .rake file paths for enabled plugins only.
-
.prepare_plugin_load_paths(config, ceedling_plugins_path) ⇒ Object
Returns ordered plugin search paths: user-configured paths first, built-in Ceedling plugins path last.
-
.resolve(config, ceedling_lib_path, ceedling_plugins_path) ⇒ Object
Returns ordered list of all .rake file paths for the given config: - Stock files (always) - Conditional stock files (rules_release, tasks_release if release_build is enabled) - Plugin .rake files (first matching
/ / .rake across load_paths).
Class Method Details
.plugin_rake_files(config, load_paths) ⇒ Object
Returns ordered list of .rake file paths for enabled plugins only.
Searches each root in load_paths for
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/ceedling/rake_app/rakefile_component_resolver.rb', line 60 def plugin_rake_files(config, load_paths) enabled = Array( config.dig(:plugins, :enabled) ) results = [] enabled.each do |plugin| load_paths.each do |load_path| candidate = File.join(load_path, plugin, "#{plugin}.rake") if File.exist?(candidate) results << candidate break end end end results end |
.prepare_plugin_load_paths(config, ceedling_plugins_path) ⇒ Object
Returns ordered plugin search paths: user-configured paths first, built-in Ceedling plugins path last. This ordering lets user plugins shadow built-in plugins of the same name. Used by both resolve() (bin/ CLI scope) and Configurator#prepare_plugins_load_paths (application scope) so both scopes search plugins in the same priority order.
30 31 32 33 34 35 36 |
# File 'lib/ceedling/rake_app/rakefile_component_resolver.rb', line 30 def prepare_plugin_load_paths(config, ceedling_plugins_path) load_paths = Array( config.dig(:plugins, :load_paths) ).dup load_paths << ceedling_plugins_path load_paths.compact! load_paths.uniq! load_paths end |
.resolve(config, ceedling_lib_path, ceedling_plugins_path) ⇒ Object
Returns ordered list of all .rake file paths for the given config:
- Stock files (always)
- Conditional stock files (rules_release, tasks_release if release_build is enabled)
- Plugin .rake files (first matching <root>/<plugin>/<plugin>.rake across load_paths)
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ceedling/rake_app/rakefile_component_resolver.rb', line 42 def resolve(config, ceedling_lib_path, ceedling_plugins_path) paths = STOCK_RAKE_FILES.map { |f| File.join(ceedling_lib_path, f) } if config.dig(:project, :release_build) RELEASE_RAKE_FILES.each { |f| paths << File.join(ceedling_lib_path, f) } end paths.concat( plugin_rake_files( config, prepare_plugin_load_paths(config, ceedling_plugins_path) ) ) return paths end |