Class: Fastlane::Actions::RenameAndroidAppNameAction
- Inherits:
-
Action
- Object
- Action
- Fastlane::Actions::RenameAndroidAppNameAction
- Defined in:
- lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb
Class Method Summary collapse
- .authors ⇒ Object
- .available_options ⇒ Object
- .description ⇒ Object
- .details ⇒ Object
- .find_elements(node, name) ⇒ Object
- .is_supported?(platform) ⇒ Boolean
- .output ⇒ Object
- .return_value ⇒ Object
- .run(params) ⇒ Object
Class Method Details
.authors ⇒ Object
46 47 48 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 46 def self. ["Sourcetoad"] end |
.available_options ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 58 def self. [ FastlaneCore::ConfigItem.new(key: :new_name, env_name: "FL_RENAME_ANDROID_PACKAGE_NEW_APP_NAME", description: "The new name for the app", optional: true, type: String, default_value: ""), FastlaneCore::ConfigItem.new(key: :manifest, env_name: "FL_RENAME_ANDROID_PACKAGE_ANDROID_MANIFEST_PATH", description: "Optional custom location for AndroidManifest.xml", optional: true, type: String, default_value: "app/src/main/AndroidManifest.xml") ] end |
.description ⇒ Object
42 43 44 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 42 def self.description "Changes the manifest's label attribute (appName)." end |
.details ⇒ Object
54 55 56 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 54 def self.details "Changes the apk manifest file's label attribute (appName)." end |
.find_elements(node, name) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 29 def self.find_elements(node, name) results = [] return results unless node.respond_to?(:nodes) node.nodes.each do |child| next unless child.kind_of?(Ox::Element) results << child if child.name == name results.concat(find_elements(child, name)) end results end |
.is_supported?(platform) ⇒ Boolean
79 80 81 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 79 def self.is_supported?(platform) platform == :android end |
.output ⇒ Object
75 76 77 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 75 def self.output [] end |
.return_value ⇒ Object
50 51 52 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 50 def self.return_value # If your method provides a return value, you can describe here what it does end |
.run(params) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb', line 12 def self.run(params) require 'ox' new_name = params[:new_name] manifest = params[:manifest] xml = File.read(manifest) doc = Ox.parse(xml) find_elements(doc, 'application').each do |app_node| app_node['android:label'] = new_name FastlaneCore::UI.("Updating app name to: #{new_name}") end File.write(manifest, Ox.dump(doc, indent: 2)) end |