Class: Fastlane::Actions::IncrementVersionNumberInPlistAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::IncrementVersionNumberInPlistAction
- Defined in:
- lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb
Class Method Summary collapse
- .author ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.author ⇒ Object
108 109 110 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 108 def self. "SiarheiFedartsou" end |
.available_options ⇒ Object
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 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 55 def self. [ FastlaneCore::ConfigItem.new(key: :bump_type, env_name: "FL_VERSION_NUMBER_BUMP_TYPE", description: "The type of this version bump. Available: patch, minor, major", default_value: "patch", verify_block: proc do |value| UI.user_error!("Available values are 'patch', 'minor' and 'major'") unless ['patch', 'minor', 'major'].include? value end), FastlaneCore::ConfigItem.new(key: :version_number, env_name: "FL_VERSION_NUMBER_VERSION_NUMBER", description: "Change to a specific version. This will replace the bump type value", optional: true), FastlaneCore::ConfigItem.new(key: :bundle_id, env_name: "FL_APPSTORE_VERSION_NUMBER_BUNDLE_ID", description: "Bundle ID of the application", optional: true, conflicting_options: [:xcodeproj, :target, :build_configuration_name], is_string: true), FastlaneCore::ConfigItem.new(key: :xcodeproj, env_name: "FL_VERSION_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, conflicting_options: [:bundle_id], 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 at path '#{File.(value)}'") if !File.exist?(value) and !Helper.is_test? end), FastlaneCore::ConfigItem.new(key: :target, env_name: "FL_VERSION_NUMBER_TARGET", optional: true, conflicting_options: [:bundle_id], description: "Specify a specific target if you have multiple per project, optional"), FastlaneCore::ConfigItem.new(key: :build_configuration_name, optional: true, conflicting_options: [:bundle_id], description: "Specify a specific build configuration if you have different Info.plist build settings for each configuration"), FastlaneCore::ConfigItem.new(key: :version_source, optional: true, default_value: 'plist', verify_block: proc do |value| UI.user_error!("Available values are 'plist' and 'appstore'") unless ['plist', 'appstore'].include? value end, description: "Source version to increment. Available options: plist, appstore") ] end |
.description ⇒ Object
45 46 47 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 45 def self.description "Increment the version number of your project" end |
.details ⇒ Object
49 50 51 52 53 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 49 def self.details [ "This action will increment the version number directly in Info.plist. " ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
112 113 114 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 112 def self.is_supported?(platform) [:ios, :mac].include? platform end |
.output ⇒ Object
102 103 104 105 106 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 102 def self.output [ ['VERSION_NUMBER', 'The new version number'] ] end |
.run(params) ⇒ Object
4 5 6 7 8 9 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 |
# File 'lib/fastlane/plugin/versioning/actions/increment_version_number_in_plist.rb', line 4 def self.run(params) if params[:version_number] next_version_number = params[:version_number] else case params[:version_source] when "plist" current_version = GetVersionNumberFromPlistAction.run(params) when "appstore" current_version = GetAppStoreVersionNumberAction.run(params) end version_array = current_version.split(".").map(&:to_i) case params[:bump_type] when "patch" version_array[2] = version_array[2] + 1 next_version_number = version_array.join(".") when "minor" version_array[1] = version_array[1] + 1 version_array[2] = version_array[2] = 0 next_version_number = version_array.join(".") when "major" version_array[0] = version_array[0] + 1 version_array[1] = version_array[1] = 0 version_array[1] = version_array[2] = 0 next_version_number = version_array.join(".") end end if Helper.test? plist = "/tmp/fastlane/tests/fastlane/Info.plist" else plist = GetInfoPlistPathAction.run(xcodeproj: params[:xcodeproj], target: params[:target], build_configuration_name: params[:build_configuration_name]) end SetInfoPlistValueAction.run(path: plist, key: 'CFBundleShortVersionString', value: next_version_number) Actions.lane_context[SharedValues::VERSION_NUMBER] = next_version_number end |