class Fastlane::Actions::FivIncrementBuildNoAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb, line 74 def self.available_options [ 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| unless File.exist?(value) UI.user_error!( 'Couldnt find config.xml! Please change your path.' ) end end, type: String ) ] end
description()
click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb, line 57 def self.description 'fastlane plugin for ionic 4' end
details()
click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb, line 69 def self.details # Optional: '' end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb, line 101 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()
click to toggle source
# File lib/fastlane/plugin/fivethree_ionic/actions/fiv_increment_build_no.rb, line 65 def self.return_value 'returns the new build number' end
run(params)
click to toggle source
# 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') do |file| file.puts new_contents end return build_number end