class Fastlane::Actions::FlutterVersioncodeBumpAction

Public Class Methods

authors() click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 34
def self.authors
  ["Sjors van Mierlo"]
end
available_options() click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 51
def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :pubspec_location,
                            env_name: "PUBSPEC_LOCATION",
                         description: "The location of the pubspec.yaml",
                            optional: true,
                                type: String,
                                default_value: 'pubspec.yaml'),
    FastlaneCore::ConfigItem.new(key: :version_code_increment,
                            env_name: "VERSION_CODE_INCREMENT",
                         description: "The increment of the version code",
                            optional: true,
                                type: Integer,
                       default_value: 1)
  ]
end
description() click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 30
def self.description
  "A plugin to bump the flutter version code with fastlane."
end
details() click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 44
def self.details
  "A plugin to bump the flutter version code with fastlane
  and also keep the comments in the pubspec.yaml.

  Useful for automated app distribution with an unique version code for each build."
end
is_supported?(platform) click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 68
def self.is_supported?(platform)
  true
end
return_value() click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 38
def self.return_value
  [
    ['VERSION', 'The bumped version']
  ]
end
run(params) click to toggle source
# File lib/fastlane/plugin/flutter_versioncode_bump/actions/flutter_versioncode_bump_action.rb, line 8
def self.run(params)
  # Retrieve given params
  pubspec_location = params[:pubspec_location]
  version_code_increment = params[:version_code_increment]

  UI.message("Let's bump the flutter version code with an increment of #{version_code_increment}!")

  # Retrieve the full version of the given pubspec.yaml location
  full_version = Helper::FlutterVersioncodeBumpHelper.retrieve_full_version(pubspec_location)
  UI.message("Current version is: #{full_version}")

  # Bump the version code of the full version by the increment that is given
  full_version = Helper::FlutterVersioncodeBumpHelper.bump_version_code(full_version, version_code_increment)

  # Update the version code of the pubspec.yaml
  Helper::FlutterVersioncodeBumpHelper.write_full_version(pubspec_location, full_version)
  UI.success("Succesfully bumped flutter version to: #{full_version}")
  {
    'version' => full_version
  }
end