cocoapods-fix-react-native 2018.05.17.19 → 2018.07.04.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b357120784ba7a79928e4d0d1588dd36b92f44ba1fbcdc01e85f3da6bd2a51ec
4
- data.tar.gz: 39f7daa2900eae16665461c4d8b1811138569d152b178575a2f13a6047003574
3
+ metadata.gz: 399a0e9ff7e6d7727caa8682c3fcecc047bc40a6d7fa60842aa6621a84ed948b
4
+ data.tar.gz: 93ae25c753da8c9b7c1730f636e420d49b7184986a4f4f52a2e8d14b3955679e
5
5
  SHA512:
6
- metadata.gz: 04e360e6cf563ee39aabb5619befff8fbc0366230c66fb031b5d15bb253824c3b8e8ae658ee0cae9a254d011b89a453dd4217234ce0cb8a85feb02ddca47e065
7
- data.tar.gz: 2ed6827ddc2978b571019f372683658ed627c09a07506910466802d6aa001d9dc096350724e3193b2965cfd1adbb2e7da18cfc8328a5d1dbc6bdede405ce952a
6
+ metadata.gz: 96dc61a8241e190bc5b29bd285b24a5f9c2437b3adf04db8f5cfd0c83e8df4b9f793fc8f07131d2f535b6f3fb781527471026bccdbd0fc4bfa5ce8178d2ecd9e
7
+ data.tar.gz: 349bcc32a884bc6a3694f7e5b2781204381bcb8a3069266eae631790739d387d6810839840c0050a6bae7579e31be98b0666d504c91c9dcd4e717c29cf422aa3
data/README.md CHANGED
@@ -58,6 +58,13 @@ you can in your `Podfile`. This hook will first look at what version of React
58
58
  Native is installed, and will then run a corresponding scripts to make changes
59
59
  to the environment.
60
60
 
61
+ ## Custom React Native Root Directory
62
+
63
+ To set a custom React Native root directory for dev an environment variable `COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT` may be set. Example:
64
+
65
+ # Some shell script that sets up environment variables
66
+ export COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT="../my_react_project_directory/node_modules/react-native"
67
+
61
68
  ## Contributing Back
62
69
 
63
70
  You'll note that this repo has issues disabled, I'm not going to make the time
@@ -0,0 +1,32 @@
1
+ # Notes:
2
+ #
3
+ # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
4
+ # - An enviroment variable of `COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT` will override the defaults for dev.
5
+ #
6
+ # - Returns the root directory to use for React Native
7
+
8
+ def get_root
9
+ # Are you using :path based Pods?
10
+ dev_pods_react = !File.directory?('Pods/React/React')
11
+
12
+ # Check for whether we're in a project that uses relative paths
13
+ same_repo_node_modules = File.directory?('node_modules/react-native')
14
+ previous_repo_node_modules = File.directory?('../node_modules/react-native')
15
+
16
+ # Find out where the files could be rooted
17
+ $root = 'Pods/React'
18
+
19
+ if dev_pods_react
20
+ # Use this as an override, if present and non empty string
21
+ $env_root = ENV["COCOAPODS_FIX_REACT_NATIVE_DEV_ROOT"]
22
+
23
+ if defined?($env_root) && ($env_root != nil) && ($env_root != '')
24
+ $root = $env_root
25
+ else
26
+ $root = 'node_modules/react-native' if same_repo_node_modules
27
+ $root = '../node_modules/react-native' if previous_repo_node_modules
28
+ end
29
+ end
30
+
31
+ return $root
32
+ end
@@ -1,26 +1,11 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-fix-react-native/helpers/root_helper'
2
3
 
3
- # Notes:
4
- #
5
- # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
6
- #
7
-
8
- # Are you using :path based Pods?
9
- dev_pods_react = !File.directory?('Pods/React/React')
4
+ # Obtain the React Native root directory
5
+ $root = get_root
10
6
 
11
7
  # Detect CocoaPods + Frameworks
12
- $has_frameworks = File.exist?('Pods/Target Support Files/React/React-umbrella.h')
13
-
14
- # Check for whether we're in a project that uses relative paths
15
- same_repo_node_modules = File.directory?('node_modules/react-native')
16
- previous_repo_node_modules = File.directory?('../node_modules/react-native')
17
-
18
- # Find out where the files could be rooted
19
- $root = 'Pods/React'
20
- if dev_pods_react
21
- $root = 'node_modules/react-native' if same_repo_node_modules
22
- $root = '../node_modules/react-native' if previous_repo_node_modules
23
- end
8
+ $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h'
24
9
 
25
10
  # TODO: move to be both file in pods and file in node_mods?
26
11
  def patch_pod_file(path, old_code, new_code)
@@ -1,21 +1,7 @@
1
- # Notes:
2
- #
3
- # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
4
- #
5
-
6
- # Are you using :path based Pods?
7
- dev_pods_react = !File.directory?('Pods/React/React')
8
-
9
- # Check for whether
10
- same_repo_node_modules = File.directory?('node_modules/react-native')
11
- previous_repo_node_modules = File.directory?('../node_modules/react-native')
12
-
13
- # Find out where the files could be rooted
14
- $root = 'Pods/React'
15
- if dev_pods_react
16
- $root = 'node_modules/react-native' if same_repo_node_modules
17
- $root = '../node_modules/react-native' if previous_repo_node_modules
18
- end
1
+ require 'cocoapods-fix-react-native/helpers/root_helper'
2
+
3
+ # Obtain the React Native root directory
4
+ $root = get_root
19
5
 
20
6
  # TODO: move to be both file in pods and file in node_mods?
21
7
  def edit_pod_file(path, old_code, new_code)
@@ -1,27 +1,12 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-fix-react-native/helpers/root_helper'
2
3
 
3
- # Notes:
4
- #
5
- # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
6
- #
7
-
8
- # Are you using :path based Pods?
9
- dev_pods_react = !File.directory?('Pods/React/React')
4
+ # Obtain the React Native root directory
5
+ $root = get_root
10
6
 
11
7
  # Detect CocoaPods + Frameworks
12
8
  $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h'
13
9
 
14
- # Check for whether we're in a project that uses relative paths
15
- same_repo_node_modules = File.directory?('node_modules/react-native')
16
- previous_repo_node_modules = File.directory?('../node_modules/react-native')
17
-
18
- # Find out where the files could be rooted
19
- $root = 'Pods/React'
20
- if dev_pods_react
21
- $root = 'node_modules/react-native' if same_repo_node_modules
22
- $root = '../node_modules/react-native' if previous_repo_node_modules
23
- end
24
-
25
10
  # TODO: move to be both file in pods and file in node_mods?
26
11
  def patch_pod_file(path, old_code, new_code)
27
12
  file = File.join($root, path)
@@ -1,27 +1,12 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-fix-react-native/helpers/root_helper'
2
3
 
3
- # Notes:
4
- #
5
- # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
6
- #
7
-
8
- # Are you using :path based Pods?
9
- dev_pods_react = !File.directory?('Pods/React/React')
4
+ # Obtain the React Native root directory
5
+ $root = get_root
10
6
 
11
7
  # Detect CocoaPods + Frameworks
12
8
  $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h'
13
9
 
14
- # Check for whether we're in a project that uses relative paths
15
- same_repo_node_modules = File.directory?('node_modules/react-native')
16
- previous_repo_node_modules = File.directory?('../node_modules/react-native')
17
-
18
- # Find out where the files could be rooted
19
- $root = 'Pods/React'
20
- if dev_pods_react
21
- $root = 'node_modules/react-native' if same_repo_node_modules
22
- $root = '../node_modules/react-native' if previous_repo_node_modules
23
- end
24
-
25
10
  # TODO: move to be both file in pods and file in node_mods?
26
11
  def patch_pod_file(path, old_code, new_code)
27
12
  file = File.join($root, path)
@@ -1,27 +1,12 @@
1
1
  require 'cocoapods'
2
+ require 'cocoapods-fix-react-native/helpers/root_helper'
2
3
 
3
- # Notes:
4
- #
5
- # - All file paths should be relative to the React repo, rather than the Pods dir, or node_modules
6
- #
7
-
8
- # Are you using :path based Pods?
9
- dev_pods_react = !File.directory?('Pods/React/React')
4
+ # Obtain the React Native root directory
5
+ $root = get_root
10
6
 
11
7
  # Detect CocoaPods + Frameworks
12
8
  $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h'
13
9
 
14
- # Check for whether we're in a project that uses relative paths
15
- same_repo_node_modules = File.directory?('node_modules/react-native')
16
- previous_repo_node_modules = File.directory?('../node_modules/react-native')
17
-
18
- # Find out where the files could be rooted
19
- $root = 'Pods/React'
20
- if dev_pods_react
21
- $root = 'node_modules/react-native' if same_repo_node_modules
22
- $root = '../node_modules/react-native' if previous_repo_node_modules
23
- end
24
-
25
10
  # TODO: move to be both file in pods and file in node_mods?
26
11
  def patch_pod_file(path, old_code, new_code)
27
12
  file = File.join($root, path)
@@ -0,0 +1,60 @@
1
+ require 'cocoapods'
2
+ require 'cocoapods-fix-react-native/helpers/root_helper'
3
+
4
+ # Obtain the React Native root directory
5
+ $root = get_root
6
+
7
+ # Detect CocoaPods + Frameworks
8
+ $has_frameworks = File.exists?'Pods/Target Support Files/React/React-umbrella.h'
9
+
10
+ # TODO: move to be both file in pods and file in node_mods?
11
+ def patch_pod_file(path, old_code, new_code)
12
+ file = File.join($root, path)
13
+ unless File.exist?(file)
14
+ Pod::UI.warn "#{file} does not exist so was not patched.."
15
+ return
16
+ end
17
+ code = File.read(file)
18
+ if code.include?(old_code)
19
+ Pod::UI.message "Patching #{file}", '- '
20
+ FileUtils.chmod('+w', file)
21
+ File.write(file, code.sub(old_code, new_code))
22
+ end
23
+ end
24
+
25
+ # Detect source file dependency in the generated Pods.xcodeproj workspace sub-project
26
+ def has_pods_project_source_file(source_filename)
27
+ pods_project = 'Pods/Pods.xcodeproj/project.pbxproj'
28
+ File.open(pods_project).grep(/#{source_filename}/).any?
29
+ end
30
+
31
+ # Detect dependent source file required for building when the given source file is present
32
+ def meets_pods_project_source_dependency(source_filename, dependent_source_filename)
33
+ has_pods_project_source_file(source_filename) ? has_pods_project_source_file(dependent_source_filename) : true
34
+ end
35
+
36
+ def detect_missing_subspec_dependency(subspec_name, source_filename, dependent_source_filename)
37
+ unless meets_pods_project_source_dependency(source_filename, dependent_source_filename)
38
+ Pod::UI.warn "#{subspec_name} subspec may be required given your current dependencies"
39
+ end
40
+ end
41
+
42
+ def detect_missing_subspecs
43
+ return unless $has_frameworks
44
+
45
+ # For CocoaPods + Frameworks, RCTNetwork and CxxBridge subspecs are necessary for DevSupport.
46
+ # When the React pod is generated it must include all the required source, and see umbrella deps.
47
+ detect_missing_subspec_dependency('RCTNetwork', 'RCTBlobManager.mm', 'RCTNetworking.mm')
48
+ detect_missing_subspec_dependency('CxxBridge', 'RCTJavaScriptLoader.mm', 'RCTCxxBridge.mm')
49
+
50
+ # RCTText itself shouldn't require DevSupport, but it depends on Core -> RCTDevSettings -> RCTPackagerClient
51
+ detect_missing_subspec_dependency('DevSupport', 'RCTDevSettings.mm', 'RCTPackagerClient.m')
52
+ end
53
+
54
+ detect_missing_subspecs
55
+
56
+ # # https://github.com/facebook/react-native/pull/14664
57
+ animation_view_file = 'Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h'
58
+ animation_view_old_code = 'import <RCTAnimation/RCTValueAnimatedNode.h>'
59
+ animation_view_new_code = 'import "RCTValueAnimatedNode.h"'
60
+ patch_pod_file animation_view_file, animation_view_old_code, animation_view_new_code
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cocoapods-fix-react-native
3
3
  version: !ruby/object:Gem::Version
4
- version: 2018.05.17.19
4
+ version: 2018.07.04.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Orta Therox
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-05-17 00:00:00.000000000 Z
11
+ date: 2018-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,12 +54,14 @@ files:
54
54
  - cocoapods-fix-react-native.gemspec
55
55
  - lib/cocoapods-fix-react-native.rb
56
56
  - lib/cocoapods-fix-react-native/fix_with_context.rb
57
+ - lib/cocoapods-fix-react-native/helpers/root_helper.rb
57
58
  - lib/cocoapods-fix-react-native/issues/react_dependency_version.rb
58
59
  - lib/cocoapods-fix-react-native/versions/0_53_3-post.rb
59
60
  - lib/cocoapods-fix-react-native/versions/0_54_2-post.rb
60
61
  - lib/cocoapods-fix-react-native/versions/0_54_4-post.rb
61
62
  - lib/cocoapods-fix-react-native/versions/0_55_3-post.rb
62
63
  - lib/cocoapods-fix-react-native/versions/0_55_4-post.rb
64
+ - lib/cocoapods-fix-react-native/versions/0_56_0-post.rb
63
65
  - lib/cocoapods_plugin.rb
64
66
  - spec/command/native_spec.rb
65
67
  - spec/spec_helper.rb
@@ -83,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  version: '0'
84
86
  requirements: []
85
87
  rubyforge_project:
86
- rubygems_version: 2.7.6
88
+ rubygems_version: 2.7.7
87
89
  signing_key:
88
90
  specification_version: 4
89
91
  summary: CocoaPods plugin which automates hot-patching React Native