From 1f44113ca158c5c5179bb1c807ba6f7b36594e8d Mon Sep 17 00:00:00 2001 From: Miklos Fazekas Date: Sun, 27 Sep 2020 11:59:32 +0200 Subject: [PATCH] Review fixes --- react-native-mapbox-gl.podspec | 5 +++-- scripts/autogenerate.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/react-native-mapbox-gl.podspec b/react-native-mapbox-gl.podspec index 2aa3d83ee..e95b911b8 100644 --- a/react-native-mapbox-gl.podspec +++ b/react-native-mapbox-gl.podspec @@ -2,7 +2,8 @@ require 'json' package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) -rnmbgl_ios_version = $ReactNativeMapboxGLIOSVersion || ENV["REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION"] || '~> 5.8' +default_ios_mapbox_version = '~> 5.8' +rnmbgl_ios_version = $ReactNativeMapboxGLIOSVersion || ENV["REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION"] || default_ios_mapbox_version if ENV.has_key?("REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION") puts "REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION env is deprecated please use `$ReactNativeMapboxGLIOSVersion = \"#{rnmbgl_ios_version}\"`" end @@ -28,7 +29,7 @@ Pod::Spec.new do |s| s.default_subspecs= ['DynamicLibrary'] else s.subspec 'StaticLibraryFixer' do |sp| - if rnmbgl_ios_version.split('.')[0].to_i == 5 + if rnmbgl_ios_version.split('.')[0] =~ /.*(\d+)/ && $1.to_i == 5 s.dependency '@react-native-mapbox-gl-mapbox-static', rnmbgl_ios_version end end diff --git a/scripts/autogenerate.js b/scripts/autogenerate.js index 99d48b33e..b9ebc8103 100644 --- a/scripts/autogenerate.js +++ b/scripts/autogenerate.js @@ -21,7 +21,7 @@ function readIosVersion() { 'react-native-mapbox-gl.podspec', ); const lines = fs.readFileSync(podspecPath, 'utf8').split('\n'); - const mapboxLineRegex = /^REACT_NATIVE_MAPBOX_MAPBOX_IOS_VERSION.*||.+'~>\s+(\d+\.\d+)'$/; + const mapboxLineRegex = /^default_ios_mapbox_version\s*=\s*'~>\s+(\d+\.\d+)'$/; const mapboxLine = lines.filter(i => mapboxLineRegex.exec(i))[0]; return `${mapboxLineRegex.exec(mapboxLine)[1]}.0`; }