# Use GitHub mirror when CocoaPods pulls React Native third-party libraries, to resolve github.com SSL/connection failures
require_relative '../node_modules/react-native/scripts/cocoapods/helpers.rb'

github_mirror = ENV.fetch('COCOAPODS_GITHUB_MIRROR', 'https://ghproxy.net/https://github.com')

def mirror_git(base, repo_path)
  "#{base}/#{repo_path}.git"
end

Helpers::Constants.set_double_conversion_config(
  :git => mirror_git(github_mirror, 'google/double-conversion'),
)
Helpers::Constants.set_glog_config(
  :git => mirror_git(github_mirror, 'google/glog'),
)
Helpers::Constants.set_folly_config(
  :git => mirror_git(github_mirror, 'facebook/folly'),
)
Helpers::Constants.set_boost_config(
  :git => mirror_git(github_mirror, 'react-native-community/boost-for-react-native'),
)
Helpers::Constants.set_fmt_config(
  :git => mirror_git(github_mirror, 'fmtlib/fmt'),
)
Helpers::Constants.set_fast_float_config(
  :git => mirror_git(github_mirror, 'fastfloat/fast_float'),
)
