Class: ReactNativeUtil::Rake::ReactPodTask

Inherits:
Rake::TaskLib
  • Object
show all
Includes:
Util
Defined in:
lib/react_native_util/rake/react_pod_task.rb

Overview

Rakefile:

require 'react_native_util/rake'
ReactNativeUtil::Rake::ReactPodTask.new chdir: '/path/to/rn/app'

The task accepts a path argument that overrides chdir. If neither chdir or a path argument is provided, the command executes in the current directory.

Instance Method Summary collapse

Methods included from Util

#boolean_env_var?, #elapsed_from, #execute, #float_env_var, #have_command?, #log, #mac?, #platform, #run_command_with_spinner!, #validate_commands!

Constructor Details

#initialize(name = :react_pod, description = 'Convert project to use React pod', update_description = 'Update project', chdir: '.', repo_update: boolean_env_var?(:REACT_NATIVE_UTIL_REPO_UPDATE, default_value: true)) ⇒ ReactPodTask

Returns a new instance of ReactPodTask.



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/react_native_util/rake/react_pod_task.rb', line 16

def initialize(
  name = :react_pod,
  description = 'Convert project to use React pod',
  update_description = 'Update project',
  chdir: '.',
  repo_update: boolean_env_var?(:REACT_NATIVE_UTIL_REPO_UPDATE, default_value: true)
)
  desc description
  task name, %i[path] do |_task, opts|
    project_dir = opts[:path] || chdir
    Dir.chdir project_dir do
      Converter.new(repo_update: repo_update).convert_to_react_pod!
    end
  end

  desc update_description
  task "#{name}:update", %i[path] do |_task, opts|
    project_dir = opts[:path] || chdir
    Dir.chdir project_dir do
      Converter.new(repo_update: repo_update).update_project!
    end
  end
end