react_native_util 0.1.1 → 0.1.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: e7d1096b94b1dae16b1386dc77cad0668e30f37d68c15a46a8f032a2fe71e7a1
4
- data.tar.gz: '0698e08bc5e62d690c23ef7c68639a70ad85459f30537c4115f70f2a28d6de5c'
3
+ metadata.gz: 58961157dd9ea8d01ec449637c1176395346c7642fe46d0fc28b47a957fde4ea
4
+ data.tar.gz: 6a20fb2a70fa264e561f2b69314e8b4a2d88c48144583919010cf5b321234b75
5
5
  SHA512:
6
- metadata.gz: 109dd9adf2ea0329d85b5b07ae499cfe9322f415e016f821b2f193b571aa5607da4dc6c01e5d11526878f543651a8b291eb6ed9833a9dbf94c3dd400df774b8d
7
- data.tar.gz: afe598261cf29c736c11dc72da93064fcc356e42827b4aef7b4f1ec4410b10dd2fe0fe52b9bf2a4f226420b709ad1749486f5c94a7e839c0999c3e3d613071ef
6
+ metadata.gz: 3f6c62f22d58fe55fccb9b763b5bc0dbfa369ab52af53fcb65d3688c7e4a4b858481aeb1b7fcca25ea16e72d49fdeacdc520fba005fb8229dd800b88017c6e31
7
+ data.tar.gz: 92b345621ac4e5d59eef6cb454cb4b3343965942ed353a1b3a1da6e04754e2b9c4fc5ab8a1399b8c6268eecc0dc38b71d1bc415a88001fc2abb812b77aa6f4f4
data/README.md CHANGED
@@ -9,12 +9,26 @@
9
9
 
10
10
  Community utility CLI for React Native projects.
11
11
 
12
+ ## Prerequisites
13
+
14
+ _macOS required_
15
+
16
+ ```bash
17
+ brew install yarn
18
+ npm install -g react-native-cli
19
+ ```
20
+
12
21
  ## Installation
13
22
 
14
23
  ```bash
15
24
  [sudo] gem install react_native_util
16
- react_native_util -h
17
- rn -h
25
+ ```
26
+
27
+ ## Install from Homebrew tap
28
+
29
+ ```bash
30
+ brew tap jdee/tap
31
+ brew install react_native_util
18
32
  ```
19
33
 
20
34
  ## Gemfile
@@ -23,6 +37,14 @@ rn -h
23
37
  gem 'react_native_util'
24
38
  ```
25
39
 
40
+ ## Usage
41
+
42
+ ```bash
43
+ react_native_util -h
44
+ rn -h
45
+ rn react_pod -h
46
+ ```
47
+
26
48
  ## Try it out
27
49
 
28
50
  First set up a test app:
@@ -18,7 +18,7 @@ module ReactNativeUtil
18
18
  c.description = "[Work in progress] Removes all static libraries built by the Libraries group and adds a generic " \
19
19
  "Podfile.\nResults in a buildable, working project."
20
20
 
21
- c.option '--[no-]repo-update', 'Update the local podspec repo (default: update; env. var. REACT_NATIVE_CONVERT_REPO_UPDATE)'
21
+ c.option '--[no-]repo-update', 'Update the local podspec repo (default: update; env. var. REACT_NATIVE_UTIL_REPO_UPDATE)'
22
22
 
23
23
  c.action do |_args, opts|
24
24
  begin
@@ -42,7 +42,7 @@ module ReactNativeUtil
42
42
  def initialize(repo_update: nil)
43
43
  @options = {}
44
44
  if repo_update.nil?
45
- @options[:repo_update] = boolean_env_var?(:REACT_NATIVE_CONVERT_REPO_UPDATE, default_value: true)
45
+ @options[:repo_update] = boolean_env_var?(:REACT_NATIVE_UTIL_REPO_UPDATE, default_value: true)
46
46
  else
47
47
  @options[:repo_update] = repo_update
48
48
  end
@@ -68,6 +68,11 @@ module ReactNativeUtil
68
68
  load_xcodeproj!
69
69
  log "Found Xcode project at #{xcodeproj_path}"
70
70
 
71
+ if libraries_group.nil?
72
+ log "Libraries group not found in #{xcodeproj_path}. No conversion necessary."
73
+ exit 0
74
+ end
75
+
71
76
  # 2. Detect native dependencies in Libraries group.
72
77
  log 'Dependencies:'
73
78
  dependencies.each { |d| log " #{d}" }
@@ -93,7 +98,7 @@ module ReactNativeUtil
93
98
  xcodeproj.save
94
99
 
95
100
  # 5. Generate boilerplate Podfile.
96
- # TODO: Determine appropriate subspecs
101
+ # TODO: Determine appropriate subspecs from contents of Libraries group
97
102
  generate_podfile!
98
103
 
99
104
  # 6. Run react-native link for each dependency.
@@ -133,9 +138,8 @@ module ReactNativeUtil
133
138
  raise ConversionError, "Failed to load #{xcodeproj_path}: #{e.message}"
134
139
  end
135
140
 
136
- # A list, usually of PBXFileReferences, of children of the
137
- # Libraries group from the xcodeproj.
138
- # @return [Array] an array of child references
141
+ # A representation of the Libraries group (if any) from the Xcode project.
142
+ # @return the Libraries group
139
143
  def libraries_group
140
144
  xcodeproj['Libraries']
141
145
  end
@@ -244,7 +248,7 @@ module ReactNativeUtil
244
248
 
245
249
  target = xcodeproj.targets.find { |t| t.name == app_name }
246
250
  phase = target.new_shell_script_build_phase 'Start Packager'
247
- phase.shell_script = packager_script
251
+ phase.shell_script = script
248
252
 
249
253
  # TODO: Move this build phase to the top of the list before the pod install.
250
254
  end
@@ -259,7 +263,10 @@ module ReactNativeUtil
259
263
  def packager_script
260
264
  react_project!.targets.first.build_phases.find { |p| p.name =~ /packager/i }.shell_script.gsub(%r{../scripts}, '../node_modules/react-native/scripts')
261
265
  rescue Errno::ENOENT
262
- log 'Could not open React.xcodeproj'
266
+ log 'Could not open React.xcodeproj. File not found.'
267
+ nil
268
+ rescue Xcodeproj::PlainInformative => e
269
+ log "Could not open React.xcodeproj. #{e.message}"
263
270
  nil
264
271
  end
265
272
  end
@@ -1,6 +1,9 @@
1
1
  class Regexp
2
2
  unless defined?(match?)
3
3
  # For portability to system Ruby
4
+ # TODO: Correct this. The condition above is meaningless.
5
+ # We're always overriding this method, even if it already
6
+ # exists. This is fine for now, but should be improved.
4
7
  def match?(str)
5
8
  !match(str).nil?
6
9
  end
@@ -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.1.1'
4
+ VERSION = '0.1.2'
5
5
  SUMMARY = 'Community utility CLI for React Native projects'
6
6
  DESCRIPTION = 'Automatically modifies a project created with react-native ' \
7
7
  'init to use the React pod from node_modules.'
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jimmy Dee
@@ -70,16 +70,16 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '2.0'
75
+ version: '1.16'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '2.0'
82
+ version: '1.16'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: pry
85
85
  requirement: !ruby/object:Gem::Requirement