class Fastlane::Actions::LatestHockeyappVersionNumberAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 60
def self.authors
  ["Travis Palmer"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 29
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :app_name,
                                 env_name: "FL_LATEST_HOCKEYAPP_VERSION_NUMBER_APP_NAME",
                                 description: "The app name to use when fetching the version number",
                                 optional: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("No App Name for LatestHockeyappVersionNumberAction given, pass using `app_name: 'name'`") unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :api_token,
                                 env_name: "FL_HOCKEY_API_TOKEN",
                                 description: "API Token for Hockey Access",
                                 optional: false,
                                 verify_block: proc do |value|
                                   UI.user_error!("No API token for LatestHockeyappVersionNumberAction given, pass using `api_token: 'token'`") unless value and !value.empty?
                                 end),
    FastlaneCore::ConfigItem.new(key: :release_type,
                                 env_name: "FL_LATEST_HOCKEYAPP_VERSION_NUMBER_RELEASE_TYPE",
                                 description: "The release type to use when fetching the version number: Beta=0, Store=1, Alpha=2, Enterprise=3",
                                 default_value: "0"),
    FastlaneCore::ConfigItem.new(key: :platform,
                                 env_name: "FL_LATEST_HOCKEYAPP_VERSION_NUMBER_PLATFORM",
                                 description: "The platform to use when fetching the version number: iOS, Android, Mac OS, Windows Phone, Custom",
                                 default_value: "iOS")
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 21
def self.description
  "Easily fetch the most recent HockeyApp version number for your app"
end
details() click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 25
def self.details
  "Provides a way to have increment_build_number be based on the latest HockeyApp version"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 64
def self.is_supported?(platform)
  [:ios, :mac, :android].include? platform
end
return_value() click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 56
def self.return_value
  "The most recent version number for the specified app"
end
run(params) click to toggle source
# File lib/fastlane/plugin/latest_hockeyapp_version_number/actions/latest_hockeyapp_version_number_action.rb, line 4
def self.run(params)
  require 'hockeyapp'

  HockeyApp::Config.configure do |config|
    config.token = params[:api_token]
  end

  UI.message "Fetching latest version of #{params[:app_name]} from HockeyApp"
  client = HockeyApp.build_client
  apps = client.get_apps
  app = apps.find { |a| a.title == params[:app_name] && a.platform == params[:platform] && a.release_type == params[:release_type].to_i }
  version = app.versions.first.version.to_i
  UI.message "Found version #{version}"

  version
end