Class: ReactNativeUtil::CLI

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods, Util
Defined in:
lib/react_native_util/cli.rb

Instance Attribute Summary

Attributes included from Util

#platform

Instance Method Summary collapse

Methods included from Util

#boolean_env_var?, #execute, #float_env_var, #log, #mac?

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/react_native_util/cli.rb', line 10

def run
  program :name, SUMMARY
  program :version, VERSION
  program :description, DESCRIPTION

  command :react_pod do |c|
    c.syntax = "#{NAME} react_pod [OPTIONS]"
    c.summary = 'Convert a React Native app to use the React pod from node_modules.'
    c.description = "[Work in progress] Removes all static libraries built by the Libraries group and adds a generic " \
      "Podfile.\nResults in a buildable, working project."

    c.option '--[no-]repo-update', 'Update the local podspec repo (default: update; env. var. REACT_NATIVE_UTIL_REPO_UPDATE)'

    c.action do |_args, opts|
      begin
        converter = Converter.new repo_update: opts.repo_update
        converter.convert_to_react_pod!
      rescue ConversionError => e
        log "Conversion failed: #{e.message}"
      end
    end
  end

  run!
end