class Fastlane::Actions::AndroidGetVersionAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 36
def self.authors
  ["Chris River"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 49
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :gradle_path,
                            env_name: "WEXLANE_GRADLE_PATH",
                         description: "Path to the gradle file",
                            optional: false,
                                type: String)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 32
def self.description
  "Common tools for CI"
end
details() click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 44
def self.details
  # Optional:
  "Dependencies shared between all WEX mobile projects"
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 59
def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  #
  # [:ios, :mac, :android].include?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/wexlane/actions/android_get_version.rb, line 40
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/wexlane/actions/android_get_version.rb, line 7
def self.run(params)
  path = params[:gradle_path]#{}"app/build.gradle"
  version_name = "0"
    if !File.file?(path)
        UI.message(" -> No file exist at path: (#{path})!")
        return version_name
    end
    begin
        file = File.new(path, "r")
        while (line = file.gets)
            if line.include? "versionName"
               versionComponents = line.strip.split(' ')
               version_name = versionComponents[versionComponents.length - 1].tr("\"","")
               break
            end
        end
        file.close
    rescue => err
        UI.error("An exception occured while readinf gradle file: #{err}")
        err
    end
    return version_name
  UI.message("The wexlane plugin is working!")
end