Class: XcodeArchiveCache::BuildSettings::Loader

Inherits:
Object
  • Object
show all
Defined in:
lib/build_settings/loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(executor) ⇒ Loader

Returns a new instance of Loader.

Parameters:



44
45
46
47
48
# File 'lib/build_settings/loader.rb', line 44

def initialize(executor)
  @executor = executor
  @extractor = Extractor.new
  @settings = Hash.new
end

Instance Method Details

#get_settings(project_path, target_name) ⇒ Hash{String => String}

Returns build settings for target or nil.

Parameters:

  • project_path (String)
  • target_name (String)

Returns:

  • (Hash{String => String})

    build settings for target or nil



73
74
75
76
77
# File 'lib/build_settings/loader.rb', line 73

def get_settings(project_path, target_name)
  return nil unless settings[project_path]

  settings[project_path][target_name]
end

#load_settings(project_paths) ⇒ Object

Parameters:

  • project_paths (Array<String>)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/build_settings/loader.rb', line 52

def load_settings(project_paths)
  paths_without_settings = project_paths.select {|path| settings[path] == nil}

  threads = paths_without_settings.map do |path|
    Thread.new(path) do |project_path|
      Thread.current.abort_on_exception = true
      [project_path, executor.load_build_settings(project_path)]
    end
  end

  threads.each do |thread|
    project_path, all_targets_settings = thread.value
    settings[project_path] = extractor.extract_per_target(all_targets_settings)
  end
end