react_native_util 0.5.0 → 0.5.1

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: ec7faa11d4e1299c289b1fb7f155068749610da6c8c82c38a832bf71931a1c06
4
- data.tar.gz: 4e84dd8004655ba30919db3fcf9af3fdb06b7e15bacd0bf77b9169abdc6afcd6
3
+ metadata.gz: dfaa6619187a580a0872773ae36342ea43700ab1b3e9dd8da45f580dab7fb580
4
+ data.tar.gz: 74a0a023c968f18bacea1789b5601f90bc976bce155abb7571104a74399e7ede
5
5
  SHA512:
6
- metadata.gz: b7da0570c0270088031c9666b1ef8b2b34e41bb08df9b3f8b7442612ddea5e450832d04380d2a739e77263b450782a263561b20fb90b50459b075be8a902bf8c
7
- data.tar.gz: 8ee1632015a0c50e1e1722772c0bb67239d030f8cd0300decd14ec56162c5571adfe67fa3f0a26d753e4efb27a97ce11cf312445edbf0070498418463f39c29c
6
+ metadata.gz: 9ad3d26ed58e0d1d070d1cc48acf76f25ffd5aede1275f2554f6e246d294caf1fd6156b2875d2feea66bafe839bcce42c0774b725fe63724286f37ff0c07fd2a
7
+ data.tar.gz: 93890c3de8daedf7f2380a86f4463a55a45518dba1c77f7700646a50b02e45e8da72d5c5a5ba62461961d70d69d86ae2bf5c74421e20e0e93f6e69a7551ba0c7
data/README.md CHANGED
@@ -64,6 +64,13 @@ brew install jdee/tap/react_native_util --with-react-native-cli
64
64
  gem 'react_native_util'
65
65
  ```
66
66
 
67
+ ## Fastlane
68
+
69
+ See https://github.com/jdee/fastlane-plugin-react_native_util
70
+ ```bash
71
+ fastlane add_plugin react_native_util
72
+ ```
73
+
67
74
  ## Usage
68
75
 
69
76
  ```bash
@@ -128,34 +135,39 @@ git status
128
135
 
129
136
  _Typical command output:_
130
137
  ```
131
- 2019-05-14T12:30:50-07:00 react_native_util react_pod v0.5.0
132
- 2019-05-14T12:30:52-07:00 Darwin 18.5.0 x86_64
133
- 2019-05-14T12:30:52-07:00 Ruby 2.3.7: ~/.rvm/rubies/ruby-2.3.7/bin/ruby
134
- 2019-05-14T12:30:52-07:00 RubyGems 3.0.3: ~/.rvm/rubies/ruby-2.3.7/bin/gem
135
- 2019-05-14T12:30:52-07:00 Bundler 1.17.3: ~/.rvm/gems/ruby-2.3.7/bin/bundle
136
- 2019-05-14T12:30:52-07:00 react-native-cli: ~/.nvm/versions/node/v10.15.0/bin/react-native
137
- 2019-05-14T12:30:52-07:00 react-native-cli: 2.0.1
138
- 2019-05-14T12:30:52-07:00 react-native: 0.59.8
139
- 2019-05-14T12:30:52-07:00 yarn 1.16.0: /usr/local/bin/yarn
140
- 2019-05-14T12:30:53-07:00 cocoapods 1.6.1: ~/.rvm/gems/ruby-2.3.7/bin/pod
141
- 2019-05-14T12:30:53-07:00 cocoapods-core: 1.6.1
142
- 2019-05-14T12:30:53-07:00 package.json:
143
- 2019-05-14T12:30:53-07:00 app name: "TestApp"
144
- 2019-05-14T12:30:53-07:00 Found Xcode project at ~/github/jdee/react_native_util/examples/TestApp/ios/TestApp.xcodeproj
145
- 2019-05-14T12:30:53-07:00 Dependencies:
146
- 2019-05-14T12:30:53-07:00 react-native-webview
147
- 2019-05-14T12:30:53-07:00 Unlinking dependencies
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
148
155
  [✔] react-native unlink react-native-webview success in 0.5 s
149
- 2019-05-14T12:30:53-07:00 Generating ios/Podfile
150
- 2019-05-14T12:30:53-07:00 Removing Libraries from TestApp
151
- 2019-05-14T12:30:53-07:00 Removing Libraries from TestAppTests
152
- 2019-05-14T12:30:53-07:00 Removing Libraries group
153
- 2019-05-14T12:30:53-07:00 Linking dependencies
154
- [✔] react-native link react-native-webview success in 0.6 s
155
- 2019-05-14T12:30:54-07:00 Generating Pods project and ios/TestApp.xcworkspace
156
- [✔] pod install success in 10.2 s
157
- 2019-05-14T12:31:04-07:00 Conversion complete
158
- 2019-05-14T12:31:04-07:00 $ open ios/TestApp.xcworkspace
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
159
171
  ```
160
172
 
161
173
  ## Convert your own app with Rake
@@ -216,7 +228,7 @@ Dir.chdir '/path/to/rn/project' do
216
228
  # Update a converted project
217
229
  converter.update_project!
218
230
  rescue ReactNativeUtil::BaseException => e
219
- puts "Error from #convert_to_react_pod!: #{e.message}"
231
+ puts "Error from ReactNativeUtil::Converter: #{e.message}"
220
232
  end
221
233
  end
222
234
  ```
@@ -1,2 +1 @@
1
1
  require_relative 'react_native_util/converter'
2
- require_relative 'react_native_util/metadata'
@@ -1,6 +1,5 @@
1
1
  require 'commander'
2
2
  require_relative 'converter'
3
- require_relative 'metadata'
4
3
 
5
4
  module ReactNativeUtil
6
5
  class CLI
@@ -2,6 +2,7 @@ require 'cocoapods-core'
2
2
  require 'erb'
3
3
  require 'json'
4
4
  require 'rubygems'
5
+ require_relative 'metadata'
5
6
  require_relative 'project'
6
7
 
7
8
  module ReactNativeUtil
@@ -106,7 +107,24 @@ module ReactNativeUtil
106
107
  end
107
108
 
108
109
  # 7. pod install
109
- log "Generating Pods project and ios/#{app_name}.xcworkspace"
110
+ # TODO: Can this be customized? Is this the only thing I have to look for
111
+ # in case CocoaPods needs an initial setup? We pull it in as a dependency.
112
+ # It could be they've never set it up before. Assume if this directory
113
+ # exists, pod install is possible (possibly with --repo-update).
114
+ master_podspec_repo_path = File.join ENV['HOME'], '.cocoapods', 'repos', 'master'
115
+ unless Dir.exist?(master_podspec_repo_path)
116
+ # The worst thing that can happen is this is equivalent to pod repo update.
117
+ # But then pod install --repo-update will take very little time.
118
+ log 'Setting up CocoaPods'
119
+ run_command_with_spinner! 'pod', 'setup', log: File.join(Dir.tmpdir, 'pod-setup.log')
120
+ end
121
+
122
+ log "Generating Pods project and ios/#{app_name}.xcworkspace".bold.cyan
123
+ log 'Once pod install is complete, your project will be part of this workspace.'.bold.cyan
124
+ log 'From now on, you should build the workspace with Xcode instead of the project.'.bold.cyan
125
+ log 'Always add the workspace and Podfile.lock to SCM.'.bold.cyan
126
+ log 'It is common practice also to add the Pods directory.'.bold.cyan
127
+ log 'The workspace will be automatically opened when pod install completes.'.bold.cyan
110
128
  command = %w[pod install]
111
129
  command << '--repo-update' if options[:repo_update]
112
130
  run_command_with_spinner!(*command, chdir: 'ios', log: File.join(Dir.tmpdir, 'pod-install.log'))
@@ -117,6 +135,7 @@ module ReactNativeUtil
117
135
  execute 'open', File.join('ios', "#{app_name}.xcworkspace")
118
136
 
119
137
  # 9. TODO: SCM/git (add, commit - optional)
138
+ # See https://github.com/jdee/react_native_util/issues/18
120
139
  end
121
140
 
122
141
  def update_project!
@@ -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.0'
4
+ VERSION = '0.5.1'
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 ' \
@@ -28,18 +28,17 @@ module ReactNativeUtil
28
28
  attr_accessor :app_name
29
29
 
30
30
  def app_target
31
- targets.find { |t| t.name == app_name }
31
+ targets.find { |t| t.platform_name == :ios && t.product_type == 'com.apple.product-type.application' }
32
32
  end
33
33
 
34
34
  def test_target
35
- targets.select(&:test_target_type?).reject { |t| t.name =~ /tvOS/ }.first
35
+ targets.select(&:test_target_type?).select { |t| t.platform_name == :ios }.first
36
36
  end
37
37
 
38
38
  # Validate an assumption about the project. TODO: Provide override option.
39
39
  # @raise ConversionError if an application target is not found with the same name as the project.
40
40
  def validate_app_target!
41
- raise ConversionError, "Unable to find target #{app_name} in #{path}." if app_target.nil?
42
- raise ConversionError, "Target #{app_name} is not an application target." unless app_target.product_type == 'com.apple.product-type.application'
41
+ raise ConversionError, "Unable to find application target in #{path}." if app_target.nil?
43
42
  end
44
43
 
45
44
  # A representation of the Libraries group (if any) from the Xcode project.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_native_util
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Dee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-14 00:00:00.000000000 Z
11
+ date: 2019-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cocoapods