class Fastlane::Actions::IosGetVersionAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 62
def self.authors
  ["Igor Lamoš"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 39
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :xcodeproj,
                            env_name: "FL_IOS_GET_VERSION_XCODEPROJ",
                         description: "(optional) Specify the path to your main Xcode project if it isn't in the project root directory",
                            optional: true,
                        verify_block: proc do |value|
                          UI.user_error!("Please specify the path to the project, not workspace") if value.end_with? ".xcworkspace"
                          UI.user_error!("Could not find Xcode project") unless File.exist?(value)
                        end)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 27
def self.description
  "Get the Version of your iOS project"
end
details() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 31
def self.details
  [
    "This action will return current Version of your iOS project.",
    "You have to set up your Xcode project to use AGV. For more info:",
    "https://developer.apple.com/library/ios/qa/qa1827/_index.html"
  ].join(' ')
end
example_code() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 70
def self.example_code
  [
    'build_number = ios_get_version # Xcode project is in the project root directory',
    'build_number = ios_get_version(xcodeproj: "/path/to/Project.xcodeproj")'
  ]
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 66
def self.is_supported?(platform)
  [:ios].include? platform
end
output() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 52
def self.output
  [
    ['IOS_VERSION', 'The Version of your iOS project']
  ]
end
return_value() click to toggle source
# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 58
def self.return_value
  "The Version of your iOS project"
end
run(params) click to toggle source

More information about how to set up your project and how it works: developer.apple.com/library/ios/qa/qa1827/_index.html Attention: This is NOT the Version - but the Build Number

# File lib/fastlane/plugin/versioning_ios/actions/ios_get_version.rb, line 12
def self.run(params)
  xcodeproj = params[:xcodeproj]

  command_get = Helper::VersioningIosHelper.get_version_command(xcodeproj)
  Helper::VersioningIosHelper.is_agv_enabled(xcodeproj)

  version = Helper.test? ? `#{command_get}` : (Actions.sh command_get)
  version = Helper::VersioningIosHelper.parse_version(version)

  UI.success("👍  Current Version is: #{version}")

  # Store the Version in the shared hash
  Actions.lane_context[SharedValues::IOS_VERSION] = version
end