Class: Fastlane::Actions::AndroidSetVersionCodeAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::AndroidSetVersionCodeAction
- Defined in:
- lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .example_code ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
65 66 67 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 65 def self. ["Igor Lamoš"] end |
.available_options ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 35 def self. [ FastlaneCore::ConfigItem.new(key: :gradle_file, env_name: "FL_ANDROID_SET_VERSION_CODE_GRADLE_FILE", description: "(optional) Specify the path to your app build.gradle if it isn't in the default location", optional: true, type: String, default_value: "app/build.gradle", verify_block: proc do |value| UI.user_error!("Could not find app build.gradle file") unless File.exist?(value) || Helper.test? end), FastlaneCore::ConfigItem.new(key: :version_code, env_name: "FL_ANDROID_SET_VERSION_CODE_VERSION_CODE", description: "(optional) Set specific Version Code", optional: true, type: Integer, default_value: nil) ] end |
.description ⇒ Object
24 25 26 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 24 def self.description "Set the Version Code of your Android project" end |
.details ⇒ Object
28 29 30 31 32 33 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 28 def self.details [ "This action will set the new Version Code on your Android project.", "Without specifying new Version Code, current one will be incremented" ].join(' ') end |
.example_code ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 73 def self.example_code [ 'android_set_version_code # Automatically increment by one', 'android_set_version_code( version_code: "17" # Set a specific number )', 'android_set_version_code( version_code: "17", gradle_file: "/path/to/build.gradle" # build.gradle is not in the default location )', 'version_code = android_set_version_code # Save returned Version Code to a variable' ] end |
.is_supported?(platform) ⇒ Boolean
69 70 71 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 69 def self.is_supported?(platform) [:android].include? platform end |
.output ⇒ Object
55 56 57 58 59 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 55 def self.output [ ['ANDROID_NEW_VERSION_CODE', 'The new Version Code of your Android project'] ] end |
.return_value ⇒ Object
61 62 63 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 61 def self.return_value "The new Version Code of your Android project" end |
.run(params) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb', line 8 def self.run(params) gradle_file_path = Helper::VersioningAndroidHelper.get_gradle_file_path(params[:gradle_file]) new_version_code = Helper::VersioningAndroidHelper.get_new_version_code(gradle_file_path, params[:version_code]) saved = Helper::VersioningAndroidHelper.save_key_to_gradle_file(gradle_file_path, "versionCode", new_version_code) if saved == -1 UI.user_error!("Unable to set the Version Code in build.gradle file at #{gradle_file_path}.") end UI.success("☝️ Android Version Code has been set to: #{new_version_code}") # Store the Version Code in the shared hash Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_CODE] = new_version_code end |