Browse Source

Add custom find functions for graph and metadata

Change-Id: Iffd19e284f526c597facaa6813f2c837746aff15
Dmitry Ilyin 2 years ago
parent
commit
e99a094b98
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      lib/noop/manager/library.rb

+ 7
- 2
lib/noop/manager/library.rb View File

@@ -78,13 +78,16 @@ module Noop
78 78
     # Read them all to a Hash by their ids.
79 79
     # Find all 'groups' records and resolve their 'tasks' reference
80 80
     # by pointing referenced tasks to this group instead.
81
+    # Using the SPEC_NO_GRAPH_METADATA environment variable
82
+    # disable the task graph processing.
81 83
     # @return [Hash<String => Hash>]
82 84
     def task_graph_metadata
85
+      return {} if ENV['SPEC_NO_GRAPH_METADATA']
83 86
       return @task_graph_metadata if @task_graph_metadata
84 87
       @task_graph_metadata = {}
85 88
       Noop::Config.list_path_modules.each do |path|
86 89
         next unless path.directory?
87
-        path.find do |task_file|
90
+        find_files(path) do |task_file|
88 91
           next unless task_file.file?
89 92
           next unless task_file.to_s.end_with? 'tasks.yaml'
90 93
           begin
@@ -96,6 +99,7 @@ module Noop
96 99
             id = task['id']
97 100
             @task_graph_metadata[id] = task
98 101
           end
102
+          false
99 103
         end
100 104
       end
101 105
 
@@ -185,12 +189,13 @@ module Noop
185 189
     def spec_run_metadata
186 190
       return @spec_run_metadata if @spec_run_metadata
187 191
       @spec_run_metadata = {}
188
-      Noop::Config.dir_path_task_spec.find do |spec_file|
192
+      find_files(Noop::Config.dir_path_task_spec) do |spec_file|
189 193
         next unless spec_file.file?
190 194
         next unless spec_file.to_s.end_with? '_spec.rb'
191 195
         spec_name = spec_file.relative_path_from(Noop::Config.dir_path_task_spec)
192 196
         spec_data = parse_spec_file spec_file
193 197
         @spec_run_metadata[spec_name] = spec_data if spec_data.any?
198
+        false
194 199
       end
195 200
       @spec_run_metadata
196 201
     end

Loading…
Cancel
Save