Class: Fastlane::Actions::PodPushSafelyAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.available_optionsObject



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb', line 30

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :podspec,
      description: 'The Podspec you want to push'
    ),
    FastlaneCore::ConfigItem.new(
      key: :sync,
      description: 'If validation depends on other recently pushed pods, synchronize',
      is_string: false,
      default_value: false
    )
  ]
end

.descriptionObject



26
27
28
# File 'lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb', line 26

def self.description
  'Safely push a Podspec to Trunk or a private repository'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb', line 45

def self.is_supported?(platform)
  [:ios].include?(platform)
end

.pod_push_safely(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb', line 8

def self.pod_push_safely(params)
  UI.message("Starting to push podspec: #{params[:podspec]}")
  other_action.pod_push(path: params[:podspec], allow_warnings: true, synchronous: params[:sync])
rescue StandardError => e
  UI.message(e)
  if e.message.include?('Unable to accept duplicate entry')
    UI.message("pod_push passed for #{params[:podspec]} on previous run. Skipping further attempts.")
  else
    UI.message("pod_push failed for #{params[:podspec]}. Waiting a minute until retry for trunk to get updated...")
    sleep(60) # sleep for a minute, wait until trunk gets updates
    pod_push_safely(params)
  end
end

.run(params) ⇒ Object



4
5
6
# File 'lib/fastlane/plugin/stream_actions/actions/pod_push_safely.rb', line 4

def self.run(params)
  pod_push_safely(params)
end