Class: Fastlane::Helper::HumanableBuildNumberHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/humanable_build_number/helper/humanable_build_number_helper.rb

Class Method Summary collapse

Class Method Details

.android_project?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/fastlane/plugin/humanable_build_number/helper/humanable_build_number_helper.rb', line 25

def self.android_project?
  Dir.glob("*gradle*").size > 0 ? true : false
end

.cook_humanable(date = nil, format:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/fastlane/plugin/humanable_build_number/helper/humanable_build_number_helper.rb', line 6

def self.cook_humanable(date = nil, format:)
  date ||= Time.now
  date = DateTime.parse(date) if date.kind_of?String
  build_number = date.strftime(format)

  Actions.lane_context[Actions::SharedValues::HUMANABLE_BUILD_NUMBER] = build_number
  ENV[Actions::SharedValues::HUMANABLE_BUILD_NUMBER.to_s] = build_number
end

.ios_project?Boolean

Returns:

  • (Boolean)


15
16
17
18
19
20
21
22
23
# File 'lib/fastlane/plugin/humanable_build_number/helper/humanable_build_number_helper.rb', line 15

def self.ios_project?
  ['*.xcodeproj', '*.xcworkspace'].each do |pattern|
    if Dir.glob(pattern).size > 0
      return true
    end
  end

  false
end

.set_build_number_for_android_tipsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fastlane/plugin/humanable_build_number/helper/humanable_build_number_helper.rb', line 29

def self.set_build_number_for_android_tips
  division_count = 50
  [
    'Here is a example to follow to set build number with gradle:',
    '-' * division_count,
    'lane :set_build_number do',
    '  gradle(',
    '    task: "assemble", ',
    '    build_type: "debug", ',
    '    properties: { ',
    '      "versionCode" => humanable_build_number.to_i',
    '    }',
    '  )',
    'end',
    '-' * division_count
  ].join("\n")
end