class Fastlane::Actions::ModifyMetaDataAction
Public Class Methods
available_options()
click to toggle source
# File lib/fastlane/plugin/androidmanifest_editor/actions/modify_meta_data.rb, line 34 def self.available_options [ FastlaneCore::ConfigItem.new(key: :manifest_file, description: "Path of AndroidManifest.xml", optional: false, type: String), FastlaneCore::ConfigItem.new(key: :meta_info, description: "hash of mata key-values", optional: false, type: Hash) ] end
description()
click to toggle source
# File lib/fastlane/plugin/androidmanifest_editor/actions/modify_meta_data.rb, line 47 def self.description "edit meta-data in AndroidManifest.xml" end
details()
click to toggle source
# File lib/fastlane/plugin/androidmanifest_editor/actions/modify_meta_data.rb, line 59 def self.details "edit meta-data of application section in AndroidManifest.xml" end
is_supported?(platform)
click to toggle source
# File lib/fastlane/plugin/androidmanifest_editor/actions/modify_meta_data.rb, line 63 def self.is_supported?(platform) [:android].include?(platform) end
return_value()
click to toggle source
# File lib/fastlane/plugin/androidmanifest_editor/actions/modify_meta_data.rb, line 55 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/androidmanifest_editor/actions/modify_meta_data.rb, line 4 def self.run(params) manifest_file = params[:manifest_file] meta_info = params[:meta_info] require 'nokogiri' doc = File.open(manifest_file) { |f| @doc = Nokogiri::XML(f) meta_info.each { |meta_key, meta_value| node_found = false @doc.css("application meta-data").each do |response_node| if response_node["android:name"] == meta_key response_node["android:value"] = meta_value node_found = true UI.message("Found existing node and changed its value to: #{meta_value}") break end end if not node_found @doc.xpath("//application//activity").last.add_next_sibling "\n<meta-data android:name=\"#{meta_key}\" android:value=\"#{meta_value}\" />\n" UI.message("Insert new node with value #{meta_value} into xml file") end } File.write(manifest_file, @doc.to_xml) } end