Class: Fastlane::Actions::TestfairyAction

Inherits:
Fastlane::Action show all
Defined in:
lib/fastlane/actions/testfairy.rb

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, details, return_value, sh, step_text

Class Method Details

.authorsObject



80
81
82
# File 'lib/fastlane/actions/testfairy.rb', line 80

def self.authors
  ["taka0125"]
end

.available_optionsObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/fastlane/actions/testfairy.rb', line 52

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :api_key,
                                 env_name: "FL_TESTFAIRY_API_KEY", # The name of the environment variable
                                 description: "API Key for TestFairy", # a short description of this parameter
                                 verify_block: proc do |value|
                                   UI.user_error!("No API key for TestFairy given, pass using `api_key: 'key'`") unless value.to_s.length > 0
                                 end),
    FastlaneCore::ConfigItem.new(key: :ipa,
                                 env_name: 'TESTFAIRY_IPA_PATH',
                                 description: 'Path to your IPA file. Optional if you use the `gym` or `xcodebuild` action',
                                 default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
                                 verify_block: proc do |value|
                                   UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value)
                                 end),
    FastlaneCore::ConfigItem.new(key: :comment,
                                 env_name: "FL_TESTFAIRY_COMMENT",
                                 description: "Additional release notes for this upload. This text will be added to email notifications",
                                 default_value: 'No comment provided') # the default value if the user didn't provide one
  ]
end

.descriptionObject



48
49
50
# File 'lib/fastlane/actions/testfairy.rb', line 48

def self.description
  'Upload a new build to TestFairy'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


84
85
86
# File 'lib/fastlane/actions/testfairy.rb', line 84

def self.is_supported?(platform)
  platform == :ios
end

.outputObject



74
75
76
77
78
# File 'lib/fastlane/actions/testfairy.rb', line 74

def self.output
  [
    ['TESTFAIRY_BUILD_URL', 'URL of the newly uploaded build']
  ]
end

.run(params) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fastlane/actions/testfairy.rb', line 8

def self.run(params)
  require 'shenzhen'
  require 'shenzhen/plugins/testfairy'

  UI.success('Starting with ipa upload to TestFairy...')

  client = Shenzhen::Plugins::TestFairy::Client.new(
    params[:api_key]
  )

  return params[:ipa] if Helper.test?

  response = client.upload_build(params[:ipa], params.values)
  if parse_response(response)
    UI.success("Build URL: #{Actions.lane_context[SharedValues::TESTFAIRY_BUILD_URL]}")
    UI.success("Build successfully uploaded to TestFairy.")
  else
    UI.user_error!("Error when trying to upload ipa to TestFairy")
  end
end