class Fastlane::Actions::IntentconfirmationAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/intentconfirmation/actions/intentconfirmation_action.rb, line 32
def self.authors
  ["Kamil Krzyk"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/intentconfirmation/actions/intentconfirmation_action.rb, line 36
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :fastlane_permission_file,
                            env_name: "FASTLANE_PERMISSION_FILE",
                            description: "Location of file that allows to perform lanes without confirmation",
                            optional: true,
                            type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/intentconfirmation/actions/intentconfirmation_action.rb, line 28
def self.description
  "Halts the lane invocation, asks user to confirm if he wants to continue."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/intentconfirmation/actions/intentconfirmation_action.rb, line 46
def self.is_supported?(platform)
  platform == :android || platform == :ios
end
run(params) click to toggle source
# File lib/fastlane/plugin/intentconfirmation/actions/intentconfirmation_action.rb, line 6
def self.run(params)
  UI.message("This lane will cause changes on application store.")

  fastlane_permission_file="#{params[:fastlane_permission_file]}"
  if !fastlane_permission_file.nil? && File.exists?(File.expand_path(fastlane_permission_file))
    UI.message("Permission file found. Lane will execute without asking for confirmation.")
  else 
    question="Do you want to continue? ('yes' or 'no')"
    UI.message(question.blue)

    answer = STDIN.gets.chomp.strip while (answer || "").length == 0
    
    if answer.eql? 'yes'
      UI.message("Confirmation received. Lane will continue.".yellow)
    elsif answer.eql? 'no'
      raise Exception, "User refused to continue. Lane was stopped by user.".red
    else
      raise Exception, "Unknown response. Lane was stopped by script.".red
    end
  end
end