Class: Fastlane::Actions::FivUpdateVersionAndBuildNoAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



36
37
38
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 36

def self.authors
  %w[Fivethree]
end

.available_optionsObject



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 50

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :ios,
      env_name: 'FIV_INCREMENT_BUILD_NO_IOS',
      description: '---',
      optional: false,
      type: Boolean
    ),
    FastlaneCore::ConfigItem.new(
      key: :pathToConfigXML,
      env_name: 'FIV_INCREMENT_BUILD_CONFIG',
      description: '---',
      optional: false,
      verify_block:
        proc do |value|
          unless File.exist?(value)
            UI.user_error!(
              'Couldnt find config.xml! Please change your path.'
            )
          end
        end,
      type: String
    ),
    FastlaneCore::ConfigItem.new(
      key: :skip_version,
      env_name: 'FIV_SKIP_VERSION',
      description: '---',
      optional: true,
      default_value: false,
      type: Boolean
    )
  ]
end

.descriptionObject



32
33
34
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 32

def self.description
  'Fastlane plugin for Ionic v4 Projects'
end

.detailsObject



45
46
47
48
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 45

def self.details
  # Optional:
  'Fastlane'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


85
86
87
88
89
90
91
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 85

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_valueObject



40
41
42
43
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 40

def self.return_value
  # If your method provides a return value, you can describe here what it does
  'returns object containing version and build_no'
end

.run(params) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version_and_build_no.rb', line 9

def self.run(params)
  version = ''
  if (params[:skip_version])
    puts('skiping version, just incrementing build no')
    old_version =
      sh "echo \"cat //*[local-name()='widget']/@version\" | xmllint --shell #{
           params[:pathToConfigXML]
         }|  awk -F'[=\"]' '!/>/{print $(NF-1)}'"
    version = old_version.delete!("\n")
  else
    version =
      Fastlane::Actions::FivUpdateVersionAction.run(
        pathToConfigXML: params[:pathToConfigXML]
      )
  end
  build_no =
    Fastlane::Actions::FivIncrementBuildNoAction.run(
      pathToConfigXML: params[:pathToConfigXML], ios: params[:ios]
    )

  return { version: version, build_no: build_no }
end