cocoapods-fix-react-native 2018.04.26.08 → 2018.04.28.09

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 99cd0dcda7427a76824c404dcf8da5981b51b0b57d998d6a80b21e3f399dc842
4
- data.tar.gz: 33ccc74e7514c2c5bc1445c6c30f24ed1c018a7d39375853e8eeac3dc554f817
3
+ metadata.gz: c9d83aa260cbf102b14794cb685bb41812f6364df156f85e916fa20d72fdbfdf
4
+ data.tar.gz: b6f0a43c648d29ea2cfc5e849dd854bda7864f0260c6b41a0da4c5571ac6635e
5
5
  SHA512:
6
- metadata.gz: ea7d34b5774766615b5193f3f51b22195bdf0c1363ef9fcfbc235d287c443582842a799e1f2ed77d69d3e39c610dbee8f42d8f30efd19ff25d4b94249ce2176a
7
- data.tar.gz: 82281e850cdc94d7f7b79bb0a5a7f4e1074ddfd0ac46f65ca96225b9ce152e93358dd0a4180b2a36a4f787beb78592ca7635ad36e85cf5fe23469835e2b321b6
6
+ metadata.gz: 6f08e612a32ad64150d1ffeb3e6beedbf8faa021d8c2430ae200711752485f6b848e094f49320fb2b15c61e1333bca0d98004daf54a79ac5ffddf4a6ff7dc88c
7
+ data.tar.gz: 97148bcb5405710afcade77b9ae440f7a87e159bb0704f65c39dbab06fe1df67719e0e3f893155c06abae75e218aed4916e9b0a491a50faee58c7eac0107e74b
@@ -0,0 +1,80 @@
1
+ require 'cocoapods'
2
+
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')
10
+
11
+ # 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
24
+
25
+ # TODO: move to be both file in pods and file in node_mods?
26
+ def patch_pod_file(path, old_code, new_code)
27
+ file = File.join($root, path)
28
+ unless File.exist?(file)
29
+ Pod::UI.warn "#{file} does not exist so was not patched.."
30
+ return
31
+ end
32
+ code = File.read(file)
33
+ if code.include?(old_code)
34
+ Pod::UI.message "Patching #{file}", '- '
35
+ FileUtils.chmod('+w', file)
36
+ File.write(file, code.sub(old_code, new_code))
37
+ end
38
+ end
39
+
40
+ def fix_unused_yoga_headers
41
+ filepath = 'Pods/Target Support Files/yoga/yoga-umbrella.h'
42
+ # This only exists when using CocoaPods + Frameworks
43
+ return unless File.exist?(filepath)
44
+
45
+ contents = []
46
+ file = File.open(filepath, 'r')
47
+ file.each_line do |line|
48
+ contents << line
49
+ end
50
+ file.close
51
+
52
+ if contents[14].include? 'YGNode.h'
53
+ Pod::UI.message "Patching #{filepath}", '- '
54
+ contents.delete_at(14) # #import "YGNode.h"
55
+ contents.delete_at(14) # #import "YGNodePrint.h"
56
+ contents.delete_at(14) # #import "Yoga-internal.h"
57
+
58
+ file = File.open(filepath, 'w') do |f|
59
+ f.puts(contents)
60
+ end
61
+ end
62
+ end
63
+
64
+ fix_unused_yoga_headers
65
+
66
+ # https://github.com/facebook/react-native/pull/14664
67
+ animation_view_file = 'Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h'
68
+ animation_view_old_code = 'import <RCTAnimation/RCTValueAnimatedNode.h>'
69
+ animation_view_new_code = 'import "RCTValueAnimatedNode.h"'
70
+ patch_pod_file animation_view_file, animation_view_old_code, animation_view_new_code
71
+
72
+ # https://github.com/facebook/react-native/issues/13198
73
+ # Only needed when you have the DevSupport subspec
74
+ has_dev_support = File.exist?(File.join($root, 'Libraries/WebSocket/RCTReconnectingWebSocket.m'))
75
+
76
+ # Move Fishhook to be based on RN's imports
77
+ websocket = 'Libraries/WebSocket/RCTReconnectingWebSocket.m'
78
+ websocket_old_code = 'import <fishhook/fishhook.h>'
79
+ websocket_new_code = 'import <React/fishhook.h>'
80
+ patch_pod_file websocket, websocket_old_code, websocket_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.04.26.08
4
+ version: 2018.04.28.09
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-04-26 00:00:00.000000000 Z
11
+ date: 2018-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -54,6 +54,7 @@ files:
54
54
  - cocoapods-fix-react-native.gemspec
55
55
  - lib/cocoapods-fix-react-native.rb
56
56
  - lib/cocoapods-fix-react-native/version_resolver.rb
57
+ - lib/cocoapods-fix-react-native/versions/0_53_3.rb
57
58
  - lib/cocoapods-fix-react-native/versions/0_54_2.rb
58
59
  - lib/cocoapods-fix-react-native/versions/0_54_4.rb
59
60
  - lib/cocoapods_plugin.rb