react_native_util 0.5.1 → 0.5.2

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: dfaa6619187a580a0872773ae36342ea43700ab1b3e9dd8da45f580dab7fb580
4
- data.tar.gz: 74a0a023c968f18bacea1789b5601f90bc976bce155abb7571104a74399e7ede
3
+ metadata.gz: 2425c426f2431713e38ebe51543ae8437ff6953ea0aac68a04560ea655c4aa5b
4
+ data.tar.gz: 064b49be7fa5e472a052a9c157bffea0c075e1f03fe7fee9bea3c312b0dfdc9b
5
5
  SHA512:
6
- metadata.gz: 9ad3d26ed58e0d1d070d1cc48acf76f25ffd5aede1275f2554f6e246d294caf1fd6156b2875d2feea66bafe839bcce42c0774b725fe63724286f37ff0c07fd2a
7
- data.tar.gz: 93890c3de8daedf7f2380a86f4463a55a45518dba1c77f7700646a50b02e45e8da72d5c5a5ba62461961d70d69d86ae2bf5c74421e20e0e93f6e69a7551ba0c7
6
+ metadata.gz: c61350888eb02504d33771ef2c5bb7acd2be43b80b58586cff707833123bd19e203e3a1d71851cbbefc8e3e7e2d2c6af9d45e3983d1d069627b712eeb764bf08
7
+ data.tar.gz: 7783d98436a76f26c6c1619ff970eee5475c6730c67981cfec9293a4bfed8f514dc67478fbf09261a1009d2ff43d3948323a880f44024e2c4bc4e3ad01bf724a
data/README.md CHANGED
@@ -135,39 +135,52 @@ git status
135
135
 
136
136
  _Typical command output:_
137
137
  ```
138
- 2019-05-14T19:21:36-07:00 react_native_util react_pod v0.5.1
139
- 2019-05-14T19:21:37-07:00 Darwin 18.5.0 x86_64
140
- 2019-05-14T19:21:37-07:00 Ruby 2.6.3: ~/.rvm/rubies/ruby-2.6.3/bin/ruby
141
- 2019-05-14T19:21:37-07:00 RubyGems 3.0.3: ~/.rvm/rubies/ruby-2.6.3/bin/gem
142
- 2019-05-14T19:21:37-07:00 Bundler 2.0.1: ~/.rvm/gems/ruby-2.6.3/bin/bundle
143
- 2019-05-14T19:21:37-07:00 react-native-cli: ~/.nvm/versions/node/v10.15.0/bin/react-native
144
- 2019-05-14T19:21:37-07:00 react-native-cli: 2.0.1
145
- 2019-05-14T19:21:37-07:00 react-native: 0.59.8
146
- 2019-05-14T19:21:38-07:00 yarn 1.16.0: /usr/local/bin/yarn
147
- 2019-05-14T19:21:38-07:00 cocoapods 1.6.1: ~/.rvm/gems/ruby-2.6.3/bin/pod
148
- 2019-05-14T19:21:38-07:00 cocoapods-core: 1.6.1
149
- 2019-05-14T19:21:38-07:00 package.json:
150
- 2019-05-14T19:21:38-07:00 app name: "TestApp"
151
- 2019-05-14T19:21:38-07:00 Found Xcode project at ~/github/$USER/react_native_util/examples/TestApp/ios/TestApp.xcodeproj
152
- 2019-05-14T19:21:38-07:00 Dependencies:
153
- 2019-05-14T19:21:38-07:00 react-native-webview
154
- 2019-05-14T19:21:38-07:00 Unlinking dependencies
138
+ 2019-05-15T12:04:44-07:00 react_native_util react_pod v0.5.2
139
+ 2019-05-15T12:04:46-07:00 Darwin 18.5.0 x86_64
140
+ 2019-05-15T12:04:46-07:00 Ruby 2.6.3: ~/.rvm/rubies/ruby-2.6.3/bin/ruby
141
+ 2019-05-15T12:04:46-07:00 RubyGems 3.0.3: ~/.rvm/rubies/ruby-2.6.3/bin/gem
142
+ 2019-05-15T12:04:46-07:00 Bundler 2.0.1: ~/.rvm/gems/ruby-2.6.3/bin/bundle
143
+ 2019-05-15T12:04:46-07:00 react-native-cli: ~/.nvm/versions/node/v10.15.0/bin/react-native
144
+ 2019-05-15T12:04:46-07:00 react-native-cli: 2.0.1
145
+ 2019-05-15T12:04:46-07:00 react-native: 0.59.8
146
+ 2019-05-15T12:04:46-07:00 yarn 1.16.0: /usr/local/bin/yarn
147
+ 2019-05-15T12:04:47-07:00 cocoapods 1.6.1: ~/.rvm/gems/ruby-2.6.3/bin/pod
148
+ 2019-05-15T12:04:47-07:00 cocoapods-core: 1.6.1
149
+ 2019-05-15T12:04:47-07:00 package.json:
150
+ 2019-05-15T12:04:47-07:00 app name: "TestApp"
151
+ 2019-05-15T12:04:47-07:00 Found Xcode project at ~/github/$USER/react_native_util/examples/TestApp/ios/TestApp.xcodeproj
152
+ 2019-05-15T12:04:47-07:00 Dependencies:
153
+ 2019-05-15T12:04:47-07:00 react-native-webview
154
+ 2019-05-15T12:04:47-07:00 Unlinking dependencies
155
155
  [✔] react-native unlink react-native-webview success in 0.5 s
156
- 2019-05-14T19:21:39-07:00 Generating ios/Podfile
157
- 2019-05-14T19:21:39-07:00 Removing Libraries from TestApp
158
- 2019-05-14T19:21:39-07:00 Removing Libraries from TestAppTests
159
- 2019-05-14T19:21:39-07:00 Removing Libraries group
160
- 2019-05-14T19:21:39-07:00 Linking dependencies
161
- [✔] react-native link react-native-webview success in 0.5 s
162
- 2019-05-14T19:21:40-07:00 Generating Pods project and ios/TestApp.xcworkspace
163
- 2019-05-14T19:21:40-07:00 Once pod install is complete, your project will be part of this workspace.
164
- 2019-05-14T19:21:40-07:00 From now on, you should build the workspace with Xcode instead of the project.
165
- 2019-05-14T19:21:40-07:00 Always add the workspace and Podfile.lock to SCM.
166
- 2019-05-14T19:21:40-07:00 It is common practice also to add the Pods directory.
167
- 2019-05-14T19:21:40-07:00 The workspace will be automatically opened when pod install completes.
168
- [✔] pod install success in 8.6 s
169
- 2019-05-14T19:21:48-07:00 Conversion complete ✅
170
- 2019-05-14T19:21:48-07:00 $ open ios/TestApp.xcworkspace
156
+ 2019-05-15T12:04:47-07:00 Generating ios/Podfile
157
+ 2019-05-15T12:04:47-07:00 Removing Libraries from TestApp
158
+ 2019-05-15T12:04:47-07:00 Removing libRCTBlob.a
159
+ 2019-05-15T12:04:47-07:00 Removing libRCTAnimation.a
160
+ 2019-05-15T12:04:47-07:00 Removing libReact.a
161
+ 2019-05-15T12:04:47-07:00 Removing libRCTActionSheet.a
162
+ 2019-05-15T12:04:47-07:00 Removing libRCTGeolocation.a
163
+ 2019-05-15T12:04:47-07:00 Removing libRCTImage.a
164
+ 2019-05-15T12:04:47-07:00 Removing libRCTLinking.a
165
+ 2019-05-15T12:04:47-07:00 Removing libRCTNetwork.a
166
+ 2019-05-15T12:04:47-07:00 Removing libRCTSettings.a
167
+ 2019-05-15T12:04:47-07:00 Removing libRCTText.a
168
+ 2019-05-15T12:04:47-07:00 Removing libRCTVibration.a
169
+ 2019-05-15T12:04:47-07:00 Removing libRCTWebSocket.a
170
+ 2019-05-15T12:04:47-07:00 Removing Libraries from TestAppTests
171
+ 2019-05-15T12:04:47-07:00 Removing libReact.a
172
+ 2019-05-15T12:04:47-07:00 Removing Libraries group
173
+ 2019-05-15T12:04:47-07:00 Linking dependencies
174
+ [✔] react-native link react-native-webview success in 0.6 s
175
+ 2019-05-15T12:04:48-07:00 Generating Pods project and ios/TestApp.xcworkspace
176
+ 2019-05-15T12:04:48-07:00 Once pod install is complete, your project will be part of this workspace.
177
+ 2019-05-15T12:04:48-07:00 From now on, you should build the workspace with Xcode instead of the project.
178
+ 2019-05-15T12:04:48-07:00 Always add the workspace and Podfile.lock to SCM.
179
+ 2019-05-15T12:04:48-07:00 It is common practice also to add the Pods directory.
180
+ 2019-05-15T12:04:48-07:00 The workspace will be automatically opened when pod install completes.
181
+ [✔] pod install success in 9.2 s
182
+ 2019-05-15T12:04:57-07:00 Conversion complete ✅
183
+ 2019-05-15T12:04:57-07:00 $ open ios/TestApp.xcworkspace
171
184
  ```
172
185
 
173
186
  ## Convert your own app with Rake
@@ -237,3 +250,7 @@ end
237
250
 
238
251
  Hosted [Yard](https://yardoc.org) documentation available at
239
252
  https://www.rubydoc.info/gems/react_native_util.
253
+
254
+ ## Successfully converted apps:
255
+
256
+ - https://github.com/azhavrid/movie-swiper
@@ -1,7 +1,7 @@
1
1
  # Conversion tools for React Native projects
2
2
  module ReactNativeUtil
3
3
  NAME = 'react_native_util'
4
- VERSION = '0.5.1'
4
+ VERSION = '0.5.2'
5
5
  SUMMARY = 'Community utility CLI for React Native projects'
6
6
  DESCRIPTION = 'Converts a project created with react-native init to use CocoaPods with the ' \
7
7
  'React pod from node_modules. This preserves compatibility with ' \
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  require_relative 'core_ext/xcodeproj'
2
4
  require_relative 'util'
3
5
 
@@ -50,16 +52,20 @@ module ReactNativeUtil
50
52
  # Remove the Libraries group from the xcodeproj in memory.
51
53
  def remove_libraries_group
52
54
  # Remove links against these static libraries
53
- targets.reject { |t| t.name =~ /-tvOS/ }.each do |t|
55
+ targets.select { |t| t.platform_name == :ios }.each do |t|
54
56
  remove_libraries_from_target t
55
57
  end
56
58
 
59
+ unless (library_roots - DEFAULT_DEPENDENCIES).empty?
60
+ log 'Libraries group not empty. Not removing.'
61
+ return
62
+ end
63
+
57
64
  log 'Removing Libraries group'
58
65
  libraries_group.remove_from_project
59
66
  end
60
67
 
61
68
  def remove_libraries_from_target(target)
62
- log "Removing Libraries from #{target.name}"
63
69
  to_remove = target.frameworks_build_phase.files.select do |file|
64
70
  path = file.file_ref.pretty_print
65
71
  next false unless /^lib(.+)\.a$/.match?(path)
@@ -67,7 +73,11 @@ module ReactNativeUtil
67
73
  static_libs.include?(path)
68
74
  end
69
75
 
70
- to_remove.each { |f| target.frameworks_build_phase.remove_build_file f }
76
+ log "Removing Libraries from #{target.name}" unless to_remove.empty?
77
+ to_remove.each do |f|
78
+ log " Removing #{f.file_ref.pretty_print}"
79
+ target.frameworks_build_phase.remove_build_file f
80
+ end
71
81
  end
72
82
 
73
83
  # A list of external dependencies from NPM requiring react-native link.
@@ -76,9 +86,26 @@ module ReactNativeUtil
76
86
  return [] if libraries_group.nil?
77
87
 
78
88
  dependency_paths.map do |path|
79
- # Find the root above the ios/*.xcodeproj under node_modules
80
- root = File.expand_path '../..', path
81
- File.basename root
89
+ # Map each path to a Pathname, expanding $(SRCROOT) or ${SRCROOT}
90
+ # SRCROOT = location of the app project: ./ios
91
+ Pathname.new path.gsub(/\$(\(SRCROOT\)|{SRCROOT})/, 'ios')
92
+ end.select do |pathname|
93
+ # Valid if any path component named node_modules
94
+ pathname.each_filename do |path_component|
95
+ break true if path_component == 'node_modules'
96
+
97
+ false
98
+ end
99
+ end.map do |pathname|
100
+ # Map each selected Pathname to the root immediately under node_modules
101
+ node_modules_found = false
102
+ pathname.each_filename do |path_component|
103
+ break path_component if node_modules_found
104
+
105
+ node_modules_found = path_component == 'node_modules'
106
+ '' # In case node_modules is the last component
107
+ # TODO: Then what? Shouldn't happen, of course....
108
+ end
82
109
  end
83
110
  end
84
111
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_native_util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Dee