class Fastlane::Actions::CodepushGetDeploymentKeyAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 33
def self.authors
  ['Pranit Harekar']
end
available_options() click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 44
def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :app_name,
      env_name: "APP_CENTER_APP_NAME",
      description: "Name of the App Center app, optional if ENV['APP_CENTER_APP_NAME'] is set",
      optional: false,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :execution_dir_path,
      description: 'Release React CLI command execution dir path',
      optional: true,
      type: String,
      default_value: "./"
    ),
    FastlaneCore::ConfigItem.new(
      key: :dry_run,
      description: "Print the command that would be run, and don't run it",
      is_string: false,
      default_value: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :deployment_name,
      description: 'Deployment name',
      optional: false,
      type: String
    )
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 29
def self.description
  'CodePush get deployment key given deployment name'
end
details() click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 41
def self.details
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 75
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 37
def self.return_value
  'Returns deployment key in string format. Returns nil if deployment does not exists'
end
run(params) click to toggle source
# File lib/fastlane/plugin/codepush/actions/codepush_get_deployment_key_action.rb, line 6
def self.run(params)
  Dir.chdir(params[:execution_dir_path].to_s) do
    result = Actions::CodepushExistsDeploymentAction.run(params)
    if result
      command = "appcenter codepush deployment list "
      ## params
      command += "-a #{params[:app_name]} "
      command += "--displayKeys "

      if params[:dry_run]
        UI.message('Dry run!'.red + ' Would have run: ' + command + "\n")
      else
        result = sh(command.to_s)
        m = result.match(/#{params[:deployment_name]}[^│]+│[^│]+(?<key>[\w_-]{37})/)
        return m[:key]
      end
    else
      UI.important("🙅‍♀️ Deployment '#{params[:deployment_name]}' does not exists!")
      return nil
    end
  end
end