Sha256: fe247c2b6cf3e93b82385c1e58dc75b74b79be3e6d08707d706a3de12856f79b

Contents?: true

Size: 1.06 KB

Versions: 15

Compression:

Stored size: 1.06 KB

Contents

# Notes:
#
#  - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
#  - An enviroment variable of `COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT` will override the defaults for dev.
#
#  - Returns the root directory to use for React Native

def get_root
  # Are you using :path based Pods?
  dev_pods_react = !File.directory?('Pods/React/React')

  # Check for whether we're in a project that uses relative paths
  same_repo_node_modules = File.directory?('node_modules/react-native')
  previous_repo_node_modules = File.directory?('../node_modules/react-native')

  # Find out where the files could be rooted
  $root = 'Pods/React'

  if dev_pods_react
    # Use this as an override, if present and non empty string
    $env_root = ENV["COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT"]

    if defined?($env_root) && ($env_root != nil) && ($env_root != '')
      $root = $env_root
    else
      $root = 'node_modules/react-native' if same_repo_node_modules
      $root = '../node_modules/react-native' if previous_repo_node_modules
    end
  end

  return $root
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
cocoapods-fix-react-native-2019.09.17.15 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2019.03.19.11 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2019.02.11.19 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2019.01.26.16 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2019.01.16.18 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.12.08.00 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.12.02.17 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.11.13.19 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.10.31.23 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.10.13.14 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.10.12.20 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.09.18.17 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.09.11.01 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.08.29.00 lib/cocoapods-fix-react-native/helpers/root_helper.rb
cocoapods-fix-react-native-2018.07.04.16 lib/cocoapods-fix-react-native/helpers/root_helper.rb