react_native_util gem
Work in progress
Community utility CLI for React Native projects.
Prerequisites
macOS required
The react_pod command requires yarn from Homebrew and the react-native-cli.
If installing react_native_util from the Homebrew tap, yarn will be
automatically installed if not present. The react-native-cli may also be
installed from Homebrew if desired:
brew install jdee/tap/react_native_util --with-react-native-cli
If running from RubyGems, please make sure these packages are installed:
brew install yarn
npm install -g react-native-cli
or
brew install react-native-cli
Installation
[sudo] gem install react_native_util
Install from Homebrew tap
brew install jdee/tap/react_native_util
Gemfile
gem 'react_native_util'
Usage
react_native_util -h
rn -h
rn react_pod -h
Try it out
Convert examples/TestApp using Rake.
bundle check || bundle install
bundle exec rake react_pod
git status
Typical command output:
2019-05-12T15:37:50-07:00 react_native_util react_pod v0.3.0
[
Rake task
Add to Rakefile:
require 'react_native_util/rake'
ReactNativeUtil::Rake::ReactPodTask.new
Customize:
require 'react_native_util/rake'
ReactNativeUtil::Rake::ReactPodTask.new(
:react_pod, # task name
'Convert project to use React pod', # description
chdir: '/path/to/rn/project', # path to project package.json
repo_update: true # optionally disable pod repo update
)
Ruby script
require 'react_native_util/converter'
Dir.chdir '/path/to/rn/project' do
begin
ReactNativeUtil::Converter.new(repo_update: true).convert_to_react_pod!
rescue ReactNativeUtil::BaseException => e
puts "Error from #convert_to_react_pod!: #{e.message}"
end
end