Class: Fastlane::Actions::FivIncrementBuildNoAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FivIncrementBuildNoAction
- Defined in:
- lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
49 50 51 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 49 def self. ["Gary Großgarten"] end |
.available_options ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 63 def self. [ FastlaneCore::ConfigItem.new(key: :ios, env_name: "FIV_INCREMENT_BUILD_NO_IOS", description: "---", optional: false, type: Boolean), FastlaneCore::ConfigItem.new(key: :pathToConfigXML, env_name: "FIV_INCREMENT_BUILD_CONFIG", description: "---", optional: false, verify_block: proc do | value | UI.user_error!("Couldnt find config.xml! Please change your path.") unless File.exist?(value) end , type: String) ] end |
.description ⇒ Object
45 46 47 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 45 def self.description "fastlane plugin for ionic 4" end |
.details ⇒ Object
58 59 60 61 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 58 def self.details # Optional: "" end |
.is_supported?(platform) ⇒ Boolean
81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 81 def self.is_supported?(platform) # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example) # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform # # [:ios, :mac, :android].include?(platform) true end |
.return_value ⇒ Object
53 54 55 56 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb', line 53 def self.return_value "returns the new build number" end |
.run(params) ⇒ Object
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/fivethree_ionic/actions/fiv_increment_build_no.rb', line 8 def self.run(params) text = File.read(params[:pathToConfigXML]) puts "test #{text}" isIos = params[:ios] if (isIos) app_build_number = sh "echo \"cat //*[local-name()='widget']/@ios-CFBundleVersion\" | xmllint --shell #{params[:pathToConfigXML]}| awk -F'[=\"]' '!/>/{print $(NF-1)}'" puts app_build_number.length if(app_build_number.length == 0) new_contents = text .gsub(/<widget /, "<widget ios-CFBundleVersion=\"#{1}\" ") else build_number = app_build_number.to_i + 1 new_contents = text .gsub(/ios-CFBundleVersion="[0-9]*"/, "ios-CFBundleVersion=\"#{build_number}\"") end else app_build_number = sh "echo \"cat //*[local-name()='widget']/@android-versionCode\" | xmllint --shell #{params[:pathToConfigXML]}| awk -F'[=\"]' '!/>/{print $(NF-1)}'" puts app_build_number.length if(app_build_number.length == 0) new_contents = text .gsub(/<widget /, "<widget android-versionCode=\"#{1}\" ") else build_number = app_build_number.to_i + 1 new_contents = text .gsub(/android-versionCode="[0-9]*"/, "android-versionCode=\"#{build_number}\"") end end File.open(params[:pathToConfigXML], "w") {|file| file.puts new_contents} return build_number end |