Method: Fastlane::Actions::CocoapodsAction.run

Defined in:
fastlane/lib/fastlane/actions/cocoapods.rb

.run(params) ⇒ Object



4
5
6
7
8
9
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
35
36
37
# File 'fastlane/lib/fastlane/actions/cocoapods.rb', line 4

def self.run(params)
  Actions.verify_gem!('cocoapods')
  cmd = []

  unless params[:podfile].nil?
    if params[:podfile].end_with?('Podfile')
      podfile_folder = File.dirname(params[:podfile])
    else
      podfile_folder = params[:podfile]
    end
    cmd << ["cd '#{podfile_folder}' &&"]
  end

  cmd << ['bundle exec'] if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
  cmd << ['pod install']

  cmd << '--no-clean' unless params[:clean]
  cmd << '--no-integrate' unless params[:integrate]
  cmd << '--repo-update' if params[:repo_update]
  cmd << '--silent' if params[:silent]
  cmd << '--verbose' if params[:verbose]
  cmd << '--no-ansi' unless params[:ansi]

  Actions.sh(cmd.join(' '), error_callback: lambda { |result|
    if !params[:repo_update] && params[:try_repo_update_on_error]
      cmd << '--repo-update'
      Actions.sh(cmd.join(' '), error_callback: lambda { |retry_result|
        call_error_callback(params, retry_result)
      })
    else
      call_error_callback(params, result)
    end
  })
end