Class: CarthageCache::BuildCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/carthage_cache/build_collector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(terminal, build_directory, required_frameworks) ⇒ BuildCollector

Returns a new instance of BuildCollector.



11
12
13
14
15
# File 'lib/carthage_cache/build_collector.rb', line 11

def initialize(terminal, build_directory, required_frameworks)
  @terminal = terminal
  @build_directory = build_directory
  @required_frameworks = Set.new(required_frameworks)
end

Instance Attribute Details

#build_directoryObject (readonly)

Returns the value of attribute build_directory.



8
9
10
# File 'lib/carthage_cache/build_collector.rb', line 8

def build_directory
  @build_directory
end

#required_frameworksObject (readonly)

Returns the value of attribute required_frameworks.



9
10
11
# File 'lib/carthage_cache/build_collector.rb', line 9

def required_frameworks
  @required_frameworks
end

#terminalObject (readonly)

Returns the value of attribute terminal.



7
8
9
# File 'lib/carthage_cache/build_collector.rb', line 7

def terminal
  @terminal
end

Instance Method Details

#delete_unused_frameworks(white_list = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/carthage_cache/build_collector.rb', line 17

def delete_unused_frameworks(white_list = {})
  terminal.vputs "Deleting unused frameworks from '#{build_directory}' ..."
  list_built_frameworks.each do |framework_path|
    if delete_framework?(framework_path, white_list)
      terminal.vputs "Deleting '#{framework_path}' because is not longer needed."
      FileUtils.rm_r(framework_path)
      FileUtils.rm_r("#{framework_path}.dSYM")
      # TODO delete corresponding .bcsymbolmap file
    end
  end
end