cocoapods-fix-react-native 2018.04.03.21 → 2018.04.05.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-fix-react-native/versions/0_54_2.rb +120 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 109c41521da8261b83ca9c3afb893d6f4560ed6f62c5ab6bbc74adeec1005531
|
4
|
+
data.tar.gz: 61d9e617135d8aa1a73fd0e9f4e916697b63a97aa3b9dac3672d25ccd7cc11c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be53638fa0dd64c257afd16fec0795ddcd6877000ef7ac48662018e999d8b8028c73fa5ebad021668b33ba5258173a142b865d9cdb62a4384a44e4d55feb9254
|
7
|
+
data.tar.gz: e6b54222d96a7c3e0a859487436721323940e9b571c9f157f88b89c4a926decdae47f80703f031796a88f2181f1e730c2f94f08359473adca747b7f489da0b3a
|
@@ -0,0 +1,120 @@
|
|
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
|
19
|
+
|
20
|
+
# TODO: move to be both file in pods and file in node_mods?
|
21
|
+
def edit_pod_file(path, old_code, new_code)
|
22
|
+
file = File.join($root, path)
|
23
|
+
code = File.read(file)
|
24
|
+
if code.include?(old_code)
|
25
|
+
FileUtils.chmod('+w', file)
|
26
|
+
File.write(file, code.sub(old_code, new_code))
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def fix_cplusplus_header_compiler_error
|
31
|
+
filepath = File.join($root, 'React/Base/Surface/SurfaceHostingView/RCTSurfaceSizeMeasureMode.h')
|
32
|
+
FileUtils.chmod('+w', filepath)
|
33
|
+
|
34
|
+
contents = []
|
35
|
+
|
36
|
+
file = File.open(filepath, 'r')
|
37
|
+
file.each_line do |line|
|
38
|
+
contents << line
|
39
|
+
end
|
40
|
+
file.close
|
41
|
+
|
42
|
+
if contents[32].include? '&'
|
43
|
+
contents.insert(26, '#ifdef __cplusplus')
|
44
|
+
contents[36] = '#endif'
|
45
|
+
|
46
|
+
file = File.open(filepath, 'w') do |f|
|
47
|
+
f.puts(contents)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def fix_unused_yoga_headers
|
53
|
+
filepath = 'Pods/Target Support Files/yoga/yoga-umbrella.h'
|
54
|
+
# This only exists when using CocoaPods + Frameworks
|
55
|
+
return unless File.exists?(filepath)
|
56
|
+
|
57
|
+
contents = []
|
58
|
+
file = File.open(filepath, 'r')
|
59
|
+
file.each_line do |line|
|
60
|
+
contents << line
|
61
|
+
end
|
62
|
+
file.close
|
63
|
+
|
64
|
+
if contents[12].include? 'Utils.h'
|
65
|
+
contents.delete_at(15) # #import "YGNode.h"
|
66
|
+
contents.delete_at(15) # #import "YGNodePrint.h"
|
67
|
+
contents.delete_at(15) # #import "Yoga-internal.h"
|
68
|
+
contents.delete_at(12) # #import "Utils.h"
|
69
|
+
|
70
|
+
file = File.open(filepath, 'w') do |f|
|
71
|
+
f.puts(contents)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
fix_unused_yoga_headers
|
77
|
+
fix_cplusplus_header_compiler_error
|
78
|
+
|
79
|
+
# https://github.com/facebook/react-native/pull/14664
|
80
|
+
animation_view_file = 'Libraries/NativeAnimation/RCTNativeAnimatedNodesManager.h'
|
81
|
+
animation_view_old_code = 'import <RCTAnimation/RCTValueAnimatedNode.h>'
|
82
|
+
animation_view_new_code = 'import "RCTValueAnimatedNode.h"'
|
83
|
+
edit_pod_file animation_view_file, animation_view_old_code, animation_view_new_code
|
84
|
+
|
85
|
+
# https://github.com/facebook/react-native/issues/13198
|
86
|
+
# Only needed when you have the DevSupport subspec
|
87
|
+
has_dev_support = File.exist?(File.join($root, 'Libraries/WebSocket/RCTReconnectingWebSocket.m'))
|
88
|
+
|
89
|
+
if has_dev_support
|
90
|
+
# Move Fishhook to be based on RN's imports
|
91
|
+
websocket = 'Libraries/WebSocket/RCTReconnectingWebSocket.m'
|
92
|
+
websocket_old_code = 'import <fishhook/fishhook.h>'
|
93
|
+
websocket_new_code = 'import <React/fishhook.h>'
|
94
|
+
edit_pod_file websocket, websocket_old_code, websocket_new_code
|
95
|
+
else
|
96
|
+
# There's a link in the DevSettings to dev-only import
|
97
|
+
filepath = "#{$root}/React/Modules/RCTDevSettings.mm"
|
98
|
+
contents = []
|
99
|
+
file = File.open(filepath, 'r')
|
100
|
+
found = false
|
101
|
+
file.each_line do |line|
|
102
|
+
contents << line
|
103
|
+
end
|
104
|
+
file.close
|
105
|
+
|
106
|
+
comment_start = '#if ENABLE_PACKAGER_CONNECTION'
|
107
|
+
comment_end = '#endif'
|
108
|
+
|
109
|
+
if contents[22].rstrip != comment_start
|
110
|
+
contents.insert(22, comment_start)
|
111
|
+
contents.insert(24, comment_end)
|
112
|
+
|
113
|
+
contents.insert(207, comment_start)
|
114
|
+
contents.insert(231, comment_end)
|
115
|
+
end
|
116
|
+
|
117
|
+
file = File.open(filepath, 'w') do |f|
|
118
|
+
f.puts(contents)
|
119
|
+
end
|
120
|
+
end
|
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.
|
4
|
+
version: 2018.04.05.17
|
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-
|
11
|
+
date: 2018-04-05 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_54_2.rb
|
57
58
|
- lib/cocoapods-fix-react-native/versions/0_54_4.rb
|
58
59
|
- lib/cocoapods_plugin.rb
|
59
60
|
- spec/command/native_spec.rb
|