-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
framework_paths.rb
54 lines (45 loc) · 1.51 KB
/
framework_paths.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
module Pod
module Xcode
class FrameworkPaths
# @return [String] the path to the .framework
#
attr_reader :source_path
# @return [String, Nil] the dSYM path, if one exists
#
attr_reader :dsym_path
# @return [Array<String>, Nil] the bcsymbolmap files path array, if one exists
#
attr_reader :bcsymbolmap_paths
def initialize(source_path, dsym_path = nil, bcsymbolmap_paths = nil)
@source_path = source_path
@dsym_path = dsym_path
@bcsymbolmap_paths = bcsymbolmap_paths
end
def ==(other)
if other.class == self.class
other.source_path == @source_path && other.dsym_path == @dsym_path && other.bcsymbolmap_paths == @bcsymbolmap_paths
else
false
end
end
alias eql? ==
def hash
[source_path, dsym_path, bcsymbolmap_paths].hash
end
def all_paths
[source_path, dsym_path, bcsymbolmap_paths].flatten.compact
end
# @param [Pathname] path the path to the `.framework` bundle
#
# @return [FrameworkPaths] the path of the framework with dsym & bcsymbolmap paths, if found
#
def self.from_path(path)
dsym_name = "#{path.basename}.dSYM"
dsym_path = Pathname.new("#{path.dirname}/#{dsym_name}")
dsym_path = nil unless dsym_path.exist?
bcsymbolmap_paths = Pathname.glob(path.dirname, '*.bcsymbolmap')
FrameworkPaths.new(path, dsym_path, bcsymbolmap_paths)
end
end
end
end