-
Notifications
You must be signed in to change notification settings - Fork 0
/
podfile_helpers.rb
48 lines (37 loc) · 1.32 KB
/
podfile_helpers.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
require 'pathname'
def brown(message)
return "\e[33m#{message}\e[0m"
end
def blue(message)
return "\e[34m#{message}\e[0m"
end
def eval_versioned_scripts!(file_name, message: '', context: nil)
project_directory = Pod::Config.instance.project_root
project_root_directory = Pathname.new(File.dirname(project_directory))
glob_pattern = File.join(project_directory, "versioned-react-native/ABI*/#{file_name}")
Dir.glob(glob_pattern) { |file_path|
relative_file_path = Pathname.new(file_path).relative_path_from(project_root_directory)
unless message.empty?
puts brown "#{message} #{blue relative_file_path}"
end
eval File.read(file_path), context
}
end
def use_versioned_abis!
eval_versioned_scripts! 'dependencies.rb',
message: 'Using versioned dependencies from'
end
def run_versioned_postinstalls!(pod_name, target_installation_result)
eval_versioned_scripts! 'postinstalls.rb',
context: binding
end
def use_pods!(pattern, project_name = nil, pods_to_exclude = [])
base_directory = Pod::Config.instance.project_root
Dir.glob(pattern, base: base_directory) { |file_path|
podName = File.basename(file_path).split('.')[0]
unless pods_to_exclude.include? podName
podPath = File.dirname(file_path)
pod podName, path: "./#{podPath}", project_name: project_name
end
}
end