class DTK::Client::ServiceAndComponentInfo::TransformTo::Info
Public Class Methods
create(info_type, content_dir, dtk_dsl_parse_helper, parsed_common_module)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 35 def self.create(info_type, content_dir, dtk_dsl_parse_helper, parsed_common_module) case info_type when :service_info then Service.new(content_dir, dtk_dsl_parse_helper, parsed_common_module) when :component_info then Component.new(content_dir, dtk_dsl_parse_helper, parsed_common_module) else fail Error, "Unexpected info_type '#{info_type}'" end end
new(content_dir, dtk_dsl_parse_helper, parsed_common_module)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 25 def initialize(content_dir, dtk_dsl_parse_helper, parsed_common_module) @content_dir = content_dir @dtk_dsl_info_processor = dtk_dsl_parse_helper.info_processor(info_type) @parsed_common_module = parsed_common_module # dynamically computed @directory_file_paths = nil end
Public Instance Methods
file_path__content_array()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 44 def file_path__content_array files_array = @dtk_dsl_info_processor.output_path_text_pairs.inject([]) { |a, (path, content)| a + [{ path: path, content: content }] } if info_type == :component_info cmp_files_array = component_info_related_files.inject([]) { |a, (path, content)| a + [{ path: path, content: content, full_path: true }] } files_array.concat(cmp_files_array) end files_array end
legacy_assemblies?()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 64 def legacy_assemblies? matches = directory_file_paths.select { |path| legacy_assemblies_input_files_processor.match?(path) } !matches.empty? end
Private Instance Methods
add_content!(input_files_processor, path)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 71 def add_content!(input_files_processor, path) input_files_processor.add_canonical_hash_content!(path, @parsed_common_module) end
assemblies_input_files_processor()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 89 def assemblies_input_files_processor @assemblies_input_files_processor = input_files_processor(:assemblies) end
directory_file_paths()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 97 def directory_file_paths @directory_file_paths ||= Dir.glob("#{@content_dir}/**/*") end
get_raw_content?(file_path)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 101 def get_raw_content?(file_path) File.open(file_path).read if file_path and File.exists?(file_path) end
input_files_processor(type)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 75 def input_files_processor(type) @dtk_dsl_info_processor.indexed_input_files[type] || raise_missing_type_error(type) end
legacy_assemblies_input_files_processor()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 93 def legacy_assemblies_input_files_processor @legacy_assemblies_input_files_processor = input_files_processor(:legacy_assemblies) end
module_ref_input_files_processor()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 85 def module_ref_input_files_processor @module_ref_input_files_processor = input_files_processor(:module_refs) end
module_refs_path()
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 79 def module_refs_path matches = directory_file_paths.select { |path| module_ref_input_files_processor.match?(path) } raise Error, "Unexpected that multiple module ref files" if matches.size > 1 matches.first end
raise_missing_type_error(type)
click to toggle source
# File lib/client/service_and_component_info/transform_to/info.rb, line 105 def raise_missing_type_error(type) raise Error, "Unexpected that no indexed_input_files of type '#{type}'" end