Class: Fastlane::Actions::IncrementVersionNameAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::IncrementVersionNameAction
- Defined in:
- lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
91 92 93 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 91 def self. ["Manabu OHTAKE"] end |
.available_options ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 45 def self. [ FastlaneCore::ConfigItem.new(key: :app_project_dir, env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR", description: "The path to the application source folder in the Android project (default: android/app)", optional: true, type: String, default_value: "android/app"), FastlaneCore::ConfigItem.new(key: :flavor, env_name: "ANDROID_VERSIONING_FLAVOR", description: "The product flavor name (optional)", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :bump_type, env_name: "ANDROID_VERSIONING_BUMP_TYPE", description: "Change to a specific type (optional)", optional: true, type: String, 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_name, env_name: "ANDROID_VERSIONING_VERSION_NAME", description: "Change to a specific version (optional)", optional: true, type: String) ] end |
.description ⇒ Object
75 76 77 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 75 def self.description "Increment the version name of your project" end |
.details ⇒ Object
79 80 81 82 83 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 79 def self.details [ "This action will increment the version name directly in build.gradle." ].join("\n") end |
.is_supported?(platform) ⇒ Boolean
95 96 97 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 95 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
85 86 87 88 89 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 85 def self.output [ ['VERSION_NAME', 'The new version name'] ] 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 |
# File 'lib/fastlane/plugin/android_versioning/actions/increment_version_name.rb', line 10 def self.run(params) if params[:version_name].nil? or params[:version_name].empty? current_version = GetVersionNameAction.run(params) UI.user_error!("Your current version (#{current_version}) does not respect the format A.B.C") unless current_version =~ /\d+.\d+.\d+/ version = current_version.split(".").map(&:to_i) case params[:bump_type] when "patch" version[2] = version[2] + 1 new_version = version.join(".") when "minor" version[1] = version[1] + 1 version[2] = version[2] = 0 new_version = version.join(".") when "major" version[0] = version[0] + 1 version[1] = 0 version[2] = 0 new_version = version.join(".") end else new_version = params[:version_name] end SetValueInBuildAction.run( app_project_dir: params[:app_project_dir], flavor: params[:flavor], key: "versionName", value: new_version ) Actions.lane_context[SharedValues::VERSION_NAME] = new_version new_version end |