Class: Fastlane::Actions::SetAppVersionAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



47
48
49
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 47

def self.authors
  ["Felix Rudat"]
end

.available_optionsObject



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 59

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :version,
                                 env_name: "GENERIC_VERSION_SET_APP_VERSION",
                                 description: "Version",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :target,
                                 env_name: "GENERIC_VERSION_APP_TARGET",
                                 optional: true,
                                 conflicting_options: [:scheme],
                                 description: "Specify a specific target if you have multiple per project, optional"),
    FastlaneCore::ConfigItem.new(key: :scheme,
                                env_name: "GENERIC_VERSION_APP_SCHEME",
                                optional: true,
                                conflicting_options: [:target],
                                description: "Specify a specific scheme if you have multiple per project, optional")
  ]
end

.descriptionObject



43
44
45
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 43

def self.description
  "Manage your app version for Android and iOS"
end

.detailsObject



55
56
57
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 55

def self.details
  "With this plugin you have a unified way to manage your cross platform app version."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


79
80
81
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 79

def self.is_supported?(platform)
  true
end

.return_valueObject



51
52
53
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 51

def self.return_value
  "The new app version"
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb', line 7

def self.run(params)
  platform = other_action.lane_context[SharedValues::PLATFORM_NAME]
  version = params[:version]

  unless version
    UI.important("No specific version was given. The current version will be incremented.")

    # increment current version number
    current_version = Helper::GenericVersionHelper.sanitize_version(other_action.get_app_version(
                                                                      target: params[:target],
                                                                      scheme: params[:scheme]
                                                                    ))
    version = Helper::GenericVersionHelper.bump_version(current_version)
  end

  if platform == :android
    # android
    Helper::GenericVersionHelper.load_dependencies('fastlane-plugin-versioning_android')

    version = other_action.android_set_version_name(
      version_name: version
    )
  else
    # ios or osx
    Helper::GenericVersionHelper.load_dependencies('fastlane-plugin-versioning')

    version = other_action.increment_version_number_in_xcodeproj(
      version_number: version,
      target: params[:target],
      scheme: params[:scheme]
    )
  end

  version
end