class Fastlane::Actions::PerfectoAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 80 def self.available_options [ FastlaneCore::ConfigItem.new(key: :perfecto_cloudurl, description: "Perfecto's cloud url", optional: false, is_string: true, verify_block: proc do |value| UI.user_error!("No perfecto_cloudurl given.") if value.to_s.empty? end), FastlaneCore::ConfigItem.new(key: :perfecto_token, description: "Perfecto's security token", optional: false, is_string: true, verify_block: proc do |value| UI.user_error!("No perfecto_token given.") if value.to_s.empty? end), FastlaneCore::ConfigItem.new(key: :perfecto_media_location, description: "Path to Perfecto media location", optional: false, is_string: true, verify_block: proc do |value| UI.user_error!("No perfecto_media_location given.") if value.to_s.empty? end), FastlaneCore::ConfigItem.new(key: :artifactType, description: "Optional, Artifact types: GENERAL, IOS, SIMULATOR, ANDROID, IMAGE, AUDIO, VIDEO, SCRIPT", optional: true, default_value: "", is_string: true), FastlaneCore::ConfigItem.new(key: :artifactName, description: "Optional, Used for the representation of the artifact when downloaded", optional: true, default_value: "", is_string: true), FastlaneCore::ConfigItem.new(key: :file_path, description: "Path to the app file", optional: true, is_string: true, default_value: default_file_path) ] end
default_file_path()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 69 def self.default_file_path platform = Actions.lane_context[Actions::SharedValues::PLATFORM_NAME] if platform == :ios # Shared value for ipa path if it was generated by gym https://docs.fastlane.tools/actions/gym/. return Actions.lane_context[Actions::SharedValues::IPA_OUTPUT_PATH] else # Shared value for apk if it was generated by gradle. return Actions.lane_context[Actions::SharedValues::GRADLE_APK_OUTPUT_PATH] end end
description()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 41 def self.description "This plugin allows you to automatically upload ipa/apk files to Perfecto for manual/automation testing" end
details()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 53 def self.details # Optional: "A fastlane plugin which aids in automated deployment of ipa/apk files to Perfecto iOS/Android devices" end
example_code()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 125 def self.example_code [ "perfecto", 'perfecto( perfecto_cloudurl: ENV["PERFECTO_CLOUDURL"], perfecto_token: ENV["PERFECTO_TOKEN"], perfecto_media_location: ENV["PERFECTO_MEDIA_LOCATION"], file_path: "path_to_apk_or_ipa_file", artifactType: ENV["artifactType"], artifactName: ENV["artifactName"] )' ] end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 121 def self.is_supported?(platform) [:ios, :android].include?(platform) end
output()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 63 def self.output [ ["perfecto_media_fullpath", "Perfecto media repo location"] ] end
return_value()
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 49 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 12 def self.run(params) # Mandatory parameters perfecto_cloudurl = params[:perfecto_cloudurl] perfecto_token = params[:perfecto_token] filepath = params[:file_path].to_s perfecto_media_fullpath = params[:perfecto_media_location] artifact_type = params[:artifactType] || "" artifact_nme = params[:artifactName] || "" # validates the filepath and perfecto media location file UI.message("validating filepath") validate_filepath(filepath) UI.message("validating media location") # uploads the ipa/apk to perfecto media repository UI.message("Attempting to upload: " + filepath + " to Perfecto!") # Helper::PerfectoHelper.upload_file(perfecto_cloudurl, perfecto_token, filepath, perfecto_media_fullpath) Helper::PerfectoHelper.upload_v1(perfecto_cloudurl, perfecto_token, filepath, perfecto_media_fullpath, artifact_type, artifact_nme) UI.success("The File in: " + filepath + " is successfully uploaded to Perfecto media location : " + perfecto_media_fullpath) # Setting the environment variable: PERFECTO_MEDIA_FULLPATH with the perfecto media repository location. ENV["PERFECTO_MEDIA_FULLPATH"] = nil ENV["PERFECTO_MEDIA_FULLPATH"] = perfecto_media_fullpath UI.success("Setting Environment variable PERFECTO_MEDIA_FULLPATH = " + ENV["PERFECTO_MEDIA_FULLPATH"]) # Setting the media fullpath in shared values post successful upload in order to be used by other fastlane actions. Actions.lane_context[SharedValues::PERFECTO_MEDIA_FULLPATH] = perfecto_media_fullpath end
validate_filepath(filepath)
click to toggle source
Validate filepath.
# File lib/fastlane/plugin/perfecto/actions/perfecto_action.rb, line 59 def self.validate_filepath(filepath) UI.user_error!("No file found at filepath parameter location.") unless File.exist?(filepath) end