Class: Fastlane::Actions::BuildNumberGetFromXcconfigAction

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

Class Method Summary collapse

Class Method Details

.authorsObject



36
37
38
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 36

def self.authors
  ["Dima Vorona", "Yalantis"]
end

.available_optionsObject



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 18

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :xcconfig_path,
      env_name: "BUILD_NUMBER_XCCONFIG_PATH",
      description: "Path to the xcconfig file with Build Number",
      type: String,
      verify_block: proc do |value|
        UI.user_error!("Couldn't find .xcconfig file at path '#{value}'") unless File.exist?(File.expand_path(value))
      end
    )
  ]
end

.descriptionObject



14
15
16
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 14

def self.description
  "Read Build Number from the passed xcconfig"
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 40

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.outputObject



32
33
34
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 32

def self.output
  []
end

.run(options) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/fastlane/plugin/yalantis_ci/actions/build_number_get_from_xcconfig.rb', line 6

def self.run(options)
  path = options[:xcconfig_path]
  contents = File.read(path)

  match = /(?<=\bCURRENT_PROJECT_VERSION\s=\s)(?<value>[\d]+)/.match(contents)
  return match[:value] unless match.nil?
end