Class: Fastlane::Actions::FivUpdateVersionAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::FivUpdateVersionAction
- Defined in:
- lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb
Documentation collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
Class Method Summary collapse
Class Method Details
.authors ⇒ Object
93 94 95 96 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 93 def self. # So no one will ever forget your contribution to fastlane :) You are awesome btw! ['Your GitHub/Twitter Name'] end |
.available_options ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 56 def self. # Define all options your action supports. [ 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 ⇒ Object
46 47 48 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 46 def self.description 'A short description with <= 80 characters of what this action does' end |
.details ⇒ Object
50 51 52 53 54 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 50 def self.details # Optional: # this is your chance to provide a more detailed description of this action 'You can use this action to do cool things...' end |
.is_supported?(platform) ⇒ Boolean
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 98 def self.is_supported?(platform) # you can do things like # # true # # platform == :ios # # [:ios, :mac].include?(platform) # platform == :ios end |
.output ⇒ Object
78 79 80 81 82 83 84 85 86 87 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 78 def self.output # Define the shared values you are going to provide # Example [ [ 'FIV_UPDATE_VERSION_CUSTOM_VALUE', 'A description of what this value contains' ] ] end |
.return_value ⇒ Object
89 90 91 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 89 def self.return_value 'returns the new version specified in config.xml' 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 |
# File 'lib/fastlane/plugin/fivethree_ionic/actions/fiv_update_version.rb', line 8 def self.run(params) # fastlane will take care of reading in the parameter and fetching the environment variable: old_version = sh "echo \"cat //*[local-name()='widget']/@version\" | xmllint --shell #{ params[:pathToConfigXML] }| awk -F'[=\"]' '!/>/{print $(NF-1)}'" old_version = old_version.delete!("\n") puts "current version: #{old_version}" puts "Insert new version number, current version in config.xml is '#{ old_version }' (Leave empty and press enter to skip this step): " new_version_number = STDIN.gets.strip puts "new version: #{new_version_number}" if new_version_number.length > 0 puts 'take new version number' version = new_version_number else puts 'take old version number' version = old_version end text = File.read(params[:pathToConfigXML]) new_contents = text.gsub(/version="[0-9.]*"/, "version=\"#{version}\"") File.open(params[:pathToConfigXML], 'w') do |file| file.puts new_contents end return version end |