CocoaPods:更新了 pre_install 语法?
CocoaPods: Updated pre_install syntax?
我刚刚更新到 CocoaPods 0.38.2(或正在尝试更新)并且 运行 我的 pre_install 钩子有问题,它删除了不需要的本地化。我已经通读了 CocoaPods update documentation 但在将我的 pods
转换为 pods_targets
之后我仍然收到错误消息:
undefined method 'root' for <Pod::PodTarget name=Alamofire >:Pod::PodTarget
我在新的 PodTarget
定义中没有看到 root 的替代品。
这是原来的钩子:
pre_install do |installer|
supported_locales = ['base', 'en']
installer.pod_targets.each do |pod|
# remove unused localizations
%x[ find "#{pod.root}" -name '*.lproj' ].split.each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
# puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
end
想法?
您可以使用 this 解决方案,方法是修改 supported_locales
数组以匹配您支持的语言环境:
pre_install do |installer|
supported_locales = ['base', 'da', 'en']
Dir.glob(File.join(installer.sandbox.pod_dir('FormatterKit'), '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
我刚刚更新到 CocoaPods 0.38.2(或正在尝试更新)并且 运行 我的 pre_install 钩子有问题,它删除了不需要的本地化。我已经通读了 CocoaPods update documentation 但在将我的 pods
转换为 pods_targets
之后我仍然收到错误消息:
undefined method 'root' for <Pod::PodTarget name=Alamofire >:Pod::PodTarget
我在新的 PodTarget
定义中没有看到 root 的替代品。
这是原来的钩子:
pre_install do |installer|
supported_locales = ['base', 'en']
installer.pod_targets.each do |pod|
# remove unused localizations
%x[ find "#{pod.root}" -name '*.lproj' ].split.each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
# puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end
end
想法?
您可以使用 this 解决方案,方法是修改 supported_locales
数组以匹配您支持的语言环境:
pre_install do |installer|
supported_locales = ['base', 'da', 'en']
Dir.glob(File.join(installer.sandbox.pod_dir('FormatterKit'), '**', '*.lproj')).each do |bundle|
if (!supported_locales.include?(File.basename(bundle, ".lproj").downcase))
puts "Removing #{bundle}"
FileUtils.rm_rf(bundle)
end
end
end