class Fastlane::Actions::AndroidChangePackageIdentifierAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 62 def self.available_options [ FastlaneCore::ConfigItem.new(key: :newIdentifier, env_name: "", description: "The new package identifier for the app. Trumps appendToIdentifier", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :appendToIdentifier, env_name: "", description: "The text to append to the package identifier. adds a (.) intitally", optional: true, type: String), FastlaneCore::ConfigItem.new(key: :manifest, env_name: "", description: "Optional custom location for AndroidManifest.xml", optional: false, type: String, default_value: "app/src/main/AndroidManifest.xml") ] end
description()
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 45 def self.description "Change the package identifier in the AndroidManifest.xml file. Can revert as well." end
details()
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 57 def self.details # Optional: "Change the package identifier in the AndroidManifest.xml file. Can revert as well." end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 89 def self.is_supported?(platform) platform == :android end
output()
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 83 def self.output [ ['ANDROID_CHANGE_PACKAGE_IDENTIFIER_ORIGINAL', 'The original package identifier.'] ] end
return_value()
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 53 def self.return_value # If your method provides a return value, you can describe here what it does end
run(params)
click to toggle source
# File lib/fastlane/plugin/android_change_package_identifier/actions/android_change_package_identifier_action.rb, line 7 def self.run(params) require 'nokogiri' newIdentifier = params[:newIdentifier] appendToIdentifier = nil manifest = params[:manifest] if newIdentifier.to_s.strip.length == 0 appendToIdentifier = params[:appendToIdentifier] if appendToIdentifier.to_s.strip.length == 0 UI.error("Must provide either newIdentifier or appendToIdentifier") end end doc = File.open(manifest) { |f| @doc = Nokogiri::XML(f) original = nil @doc.css("manifest").each do |response_node| original = response_node["package"] if newIdentifier.to_s.strip.length != 0 response_node["package"] = newIdentifier else response_node["package"] = "#{original}.#{appendToIdentifier}" end UI.message("Updating package identifier to: #{response_node["package"]}") end Actions.lane_context[SharedValues::ANDROID_CHANGE_PACKAGE_IDENTIFIER_ORIGINAL] = original File.write(manifest, @doc.to_xml) } end