Class: Fastlane::Actions::GetBuildNumberAction
Constant Summary
Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES
Class Method Summary
collapse
action_name, author, deprecated_notes, lane_context, method_missing, other_action, return_value, sample_return_value, shell_out_should_use_bundle_exec?, step_text
Class Method Details
.authors ⇒ Object
83
84
85
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 83
def self.authors
["Liquidsoul"]
end
|
.available_options ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 59
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :xcodeproj,
env_name: "FL_BUILD_NUMBER_PROJECT",
description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory",
optional: true,
verify_block: proc do |value|
UI.user_error!("Please pass the path to the project, not the workspace") if value.end_with?(".xcworkspace")
UI.user_error!("Could not find Xcode project") if !File.exist?(value) && !Helper.test?
end),
FastlaneCore::ConfigItem.new(key: :hide_error_when_versioning_disabled,
env_name: "FL_BUILD_NUMBER_HIDE_ERROR_WHEN_VERSIONING_DISABLED",
description: "Used during `fastlane init` to hide the error message",
default_value: false,
type: Boolean)
]
end
|
.category ⇒ Object
101
102
103
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 101
def self.category
:project
end
|
.description ⇒ Object
48
49
50
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 48
def self.description
"Get the build number of your project"
end
|
.details ⇒ Object
52
53
54
55
56
57
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 52
def self.details
[
"This action will return the current build number set on your project.",
"You first have to set up your Xcode project, if you haven't done it already: [https://developer.apple.com/library/ios/qa/qa1827/_index.html](https://developer.apple.com/library/ios/qa/qa1827/_index.html)."
].join("\n")
end
|
.example_code ⇒ Object
91
92
93
94
95
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 91
def self.example_code
[
'build_number = get_build_number(xcodeproj: "Project.xcodeproj")'
]
end
|
.is_supported?(platform) ⇒ Boolean
87
88
89
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 87
def self.is_supported?(platform)
[:ios, :mac].include?(platform)
end
|
.output ⇒ Object
77
78
79
80
81
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 77
def self.output
[
['BUILD_NUMBER', 'The build number']
]
end
|
.return_type ⇒ Object
97
98
99
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 97
def self.return_type
:string
end
|
.run(params) ⇒ Object
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
42
|
# File 'fastlane/lib/fastlane/actions/get_build_number.rb', line 10
def self.run(params)
folder = params[:xcodeproj] ? File.join(params[:xcodeproj], '..') : '.'
command_prefix = [
'cd',
File.expand_path(folder).shellescape,
'&&'
].join(' ')
command = [
command_prefix,
'agvtool',
'what-version',
'-terse'
].join(' ')
if Helper.test?
Actions.lane_context[SharedValues::BUILD_NUMBER] = command
else
build_number = Actions.sh(command).split("\n").last.strip
Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number
end
return build_number
rescue => ex
return false if params[:hide_error_when_versioning_disabled]
UI.error('Before being able to increment and read the version number from your Xcode project, you first need to setup your project properly. Please follow the guide at https://developer.apple.com/library/content/qa/qa1827/_index.html')
raise ex
end
|