Class: Fastlane::Actions::IncrementBuildNumberAction
- Inherits:
-
Fastlane::Action
- Object
- Fastlane::Action
- Fastlane::Actions::IncrementBuildNumberAction
- Defined in:
- lib/fastlane/actions/increment_build_number.rb
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .output ⇒ Object
- .run(params) ⇒ Object
Methods inherited from Fastlane::Action
Class Method Details
.author ⇒ Object
76 77 78 |
# File 'lib/fastlane/actions/increment_build_number.rb', line 76 def self. "KrauseFx" end |
.available_options ⇒ Object
63 64 65 66 67 68 |
# File 'lib/fastlane/actions/increment_build_number.rb', line 63 def self. [ ['build_number', 'specify specific build number (optional, omitting it increments by one)'], ['xcodeproj', 'optional, you must specify the path to your main Xcode project if it is not in the project root directory'] ] end |
.description ⇒ Object
59 60 61 |
# File 'lib/fastlane/actions/increment_build_number.rb', line 59 def self.description "Increment the build number of your project" end |
.output ⇒ Object
70 71 72 73 74 |
# File 'lib/fastlane/actions/increment_build_number.rb', line 70 def self.output [ ['BUILD_NUMBER', 'The new build number'] ] 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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fastlane/actions/increment_build_number.rb', line 10 def self.run(params) # More information about how to set up your project and how it works: # https://developer.apple.com/library/ios/qa/qa1827/_index.html # Attention: This is NOT the version number - but the build number begin first_param = (params.first rescue nil) case first_param when NilClass custom_number = nil folder = '.' when Fixnum custom_number = first_param folder = '.' when Hash custom_number = first_param[:build_number] folder = first_param[:xcodeproj] ? File.join('.', first_param[:xcodeproj], '..') : '.' end command_prefix = [ 'cd', File.(folder).shellescape, '&&' ].join(' ') command = [ command_prefix, 'agvtool', custom_number ? "new-version -all #{custom_number}" : 'next-version -all' ].join(' ') if Helper.test? Actions.lane_context[SharedValues::BUILD_NUMBER] = command else Actions.sh command # Store the new number in the shared hash build_number = `#{command_prefix} agvtool what-version`.split("\n").last.to_i Actions.lane_context[SharedValues::BUILD_NUMBER] = build_number end rescue => ex Helper.log.error 'Make sure to to follow the steps to setup your Xcode project: https://developer.apple.com/library/ios/qa/qa1827/_index.html'.yellow raise ex end end |