Class: Fastlane::Actions::GsIncrementRcVersionAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 31

def self.authors
  ["SAVeselovskiy"]
end

.available_optionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 44

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :path,
                                 env_name: "GS_VERSIONS_FILE_PATH",
                                 description: "path to versions file",
                                 optional: false,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :project_name,
                                 env_name: "ALIAS",
                                 description: "project name for versions file access",
                                 optional: false,
                                 type: String)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 27

def self.description
  "Plugin for GradoService versioning system"
end

.detailsObject



39
40
41
42
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 39

def self.details
  # Optional:
  "Plugin for GradoService versioning system"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


59
60
61
62
63
64
65
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_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://github.com/fastlane/fastlane/blob/master/fastlane/docs/Platforms.md
  #
  # [:ios, :mac, :android].include?(platform)
  true
end

.return_valueObject



35
36
37
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 35

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/gs_versioning/actions/gs_increment_rc_version.rb', line 4

def self.run(params)
  require 'json'
  v_rc = Actions::GsGetRcVersionAction.run(params)
  v_release = Actions::GsGetReleaseVersionAction.run(params)
  build = GetVersionNumberFromPlistAction.run(xcodeproj: ENV["xcodeproj"], target: ENV["target"])
  major = build.split('.')[0].to_i
  if major > v_rc.major
    v_rc.major = major
    v_rc.minor = 0
    v_rc.build = 1
  elsif major < v_rc.major
    raise "Wrong major number specified in Info.plist. Version major number can't be less than current major number on app store (and versions.json file)"
  elsif v_release.major < v_rc.major || v_release.minor < v_rc.minor
    v_rc.build += 1
  else
    v_rc.minor += 1
    v_rc.build = 1
  end
  res = v_rc.toString
  UI.message("New relese_candidate version " + res)
  v_rc
end