fastlane-plugin-rename_android 1.0.4 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7f8ec4f9dd5fb13a3ed884f29d67d2a5ca04bd543e751fa54d0ed629dea80cb
4
- data.tar.gz: 0ca8eb3a8030974b85a8a171f06f9d10f9f47c78cef0cfb7d12f865f92b78033
3
+ metadata.gz: b2bda1e041770bafee2c25e3e1466bbc3231c5f3edc4268f796172709dff1151
4
+ data.tar.gz: cacf555305d636585283e5fa1f29c42d31a59de620cbc475db2842169ccf5c85
5
5
  SHA512:
6
- metadata.gz: 3edb40b9f52e10bcc27c7a92401aa0024779f78060556bf128580ebcf9a1ef0deb5bc84901654a25c90cfb09d35533bca35ba7756534469b7e2002b75131ff15
7
- data.tar.gz: fe0e56438b52e680e25c72a02fc0df68f98ab16c83ee43959e57b3e34be2e6bf85391148633857ec144a5708e11ee8c822e31e4d0fadc399c57774185712c98a
6
+ metadata.gz: 06357d4f041368d738b992443fbaaabc783c15dd9689ec8475bf37ac74019e0c3b05d1cbf849e0eb097633a0e9ea5a25c0c9d7e1bb8ae611d58539c6c81460a9
7
+ data.tar.gz: fcb119e44ee9376368d2b02e7ce9d4af9e62cbcc4043074eb791bc14d5788e654e08b59c366cc952a3809cd41e2df5680e28ddf240273bf4b76cadc42d7a6d8c
data/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Josh Holtz <josh@rokkincat.com:>
3
+ Copyright (c) 2018 Josh Holtz <josh@rokkincat.com>
4
+ Copyright (c) 2025 Sourcetoad <info@sourcetoad.com>
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -11,33 +11,53 @@ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To
11
11
  fastlane add_plugin rename_android
12
12
  ```
13
13
 
14
- ## About rename_android
14
+ ## Actions
15
15
 
16
- Renames Android package for .java, .kt, AndroidManifest.xml, and build.gradle files
16
+ ### rename_android
17
17
 
18
- ## Example
18
+ Renames the Android package name across `.java`, `.kt`, `AndroidManifest.xml`, and `build.gradle` files.
19
19
 
20
- Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
20
+ ```rb
21
+ rename_android(
22
+ path: "./",
23
+ package_name: "com.example.oldapp",
24
+ new_package_name: "com.example.newapp"
25
+ )
26
+ ```
27
+
28
+ | Parameter | Description | Required | Default |
29
+ |--------------------|----------------------------------|----------|---------|
30
+ | `path` | Path to the Android project root | Yes | |
31
+ | `package_name` | The current package name | Yes | |
32
+ | `new_package_name` | The new package name | Yes | |
33
+
34
+ ### rename_android_app_name
35
+
36
+ Changes the `android:label` attribute in the `AndroidManifest.xml` file. This is the display name of the app.
21
37
 
22
38
  ```rb
23
- rename_android(
24
- path: "./",
25
- package_name: "com.joshholtz.fastlane.app",
26
- new_package_name: "com.newjoshholtz.fastlane.app"
39
+ rename_android_app_name(
40
+ new_name: "My New App Name",
41
+ manifest: "app/src/main/AndroidManifest.xml"
27
42
  )
28
43
  ```
29
44
 
45
+ | Parameter | Description | Required | Default |
46
+ |------------|--------------------------------------|----------|------------------------------------|
47
+ | `new_name` | The new display name for the app | No | |
48
+ | `manifest` | Path to the AndroidManifest.xml file | No | `app/src/main/AndroidManifest.xml` |
49
+
30
50
  ## Run tests for this plugin
31
51
 
32
52
  To run both the tests, and code style validation, run
33
53
 
34
54
  ```
35
- rake
55
+ bundle exec rake
36
56
  ```
37
57
 
38
58
  To automatically fix many of the styling issues, use
39
59
  ```
40
- rubocop -a
60
+ bundle exec rubocop -a
41
61
  ```
42
62
 
43
63
  ## Issues and Feedback
@@ -16,6 +16,11 @@ module Fastlane
16
16
  package_name = params[:package_name]
17
17
  new_package_name = params[:new_package_name]
18
18
 
19
+ if package_name == new_package_name
20
+ UI.message("Old and new package names are the same, nothing to do")
21
+ return 0
22
+ end
23
+
19
24
  folder = package_name.gsub('.', '/')
20
25
  new_folder = new_package_name.gsub('.', '/')
21
26
  new_folder_path = "#{path}/app/src/main/java/#{new_folder}"
@@ -0,0 +1,84 @@
1
+ # Originally based off of https://github.com/MaximusMcCann/fastlane-plugin-android_change_app_name
2
+ # Updated to use Ox XML parser instead of Nokogiri.
3
+ # Removed the reverting functionality.
4
+
5
+ require 'fastlane/action'
6
+ require 'fastlane_core/configuration/config_item'
7
+ require 'fastlane_core/ui/ui'
8
+
9
+ module Fastlane
10
+ module Actions
11
+ class RenameAndroidAppNameAction < Action
12
+ def self.run(params)
13
+ require 'ox'
14
+
15
+ new_name = params[:new_name]
16
+ manifest = params[:manifest]
17
+
18
+ xml = File.read(manifest)
19
+ doc = Ox.parse(xml)
20
+
21
+ find_elements(doc, 'application').each do |app_node|
22
+ app_node['android:label'] = new_name
23
+ FastlaneCore::UI.message("Updating app name to: #{new_name}")
24
+ end
25
+
26
+ File.write(manifest, Ox.dump(doc, indent: 2))
27
+ end
28
+
29
+ def self.find_elements(node, name)
30
+ results = []
31
+ return results unless node.respond_to?(:nodes)
32
+
33
+ node.nodes.each do |child|
34
+ next unless child.kind_of?(Ox::Element)
35
+
36
+ results << child if child.name == name
37
+ results.concat(find_elements(child, name))
38
+ end
39
+ results
40
+ end
41
+
42
+ def self.description
43
+ "Changes the manifest's label attribute (appName)."
44
+ end
45
+
46
+ def self.authors
47
+ ["Sourcetoad"]
48
+ end
49
+
50
+ def self.return_value
51
+ # If your method provides a return value, you can describe here what it does
52
+ end
53
+
54
+ def self.details
55
+ "Changes the apk manifest file's label attribute (appName)."
56
+ end
57
+
58
+ def self.available_options
59
+ [
60
+ FastlaneCore::ConfigItem.new(key: :new_name,
61
+ env_name: "FL_RENAME_ANDROID_PACKAGE_NEW_APP_NAME",
62
+ description: "The new name for the app",
63
+ optional: true,
64
+ type: String,
65
+ default_value: ""),
66
+ FastlaneCore::ConfigItem.new(key: :manifest,
67
+ env_name: "FL_RENAME_ANDROID_PACKAGE_ANDROID_MANIFEST_PATH",
68
+ description: "Optional custom location for AndroidManifest.xml",
69
+ optional: true,
70
+ type: String,
71
+ default_value: "app/src/main/AndroidManifest.xml")
72
+ ]
73
+ end
74
+
75
+ def self.output
76
+ []
77
+ end
78
+
79
+ def self.is_supported?(platform)
80
+ platform == :android
81
+ end
82
+ end
83
+ end
84
+ end
@@ -1,5 +1,5 @@
1
1
  module Fastlane
2
2
  module RenameAndroid
3
- VERSION = "1.0.4"
3
+ VERSION = "1.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastlane-plugin-rename_android
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Holtz
@@ -9,8 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-10-22 00:00:00.000000000 Z
13
- dependencies: []
12
+ date: 2026-05-21 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: ox
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '2.14'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '2.14'
14
28
  description:
15
29
  email: info@sourcetoad.com
16
30
  executables: []
@@ -21,6 +35,7 @@ files:
21
35
  - README.md
22
36
  - lib/fastlane/plugin/rename_android.rb
23
37
  - lib/fastlane/plugin/rename_android/actions/rename_android_action.rb
38
+ - lib/fastlane/plugin/rename_android/actions/rename_android_app_name_action.rb
24
39
  - lib/fastlane/plugin/rename_android/version.rb
25
40
  homepage: https://github.com/sourcetoad/fastlane-plugin-rename_android
26
41
  licenses:
@@ -35,7 +50,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
35
50
  requirements:
36
51
  - - ">="
37
52
  - !ruby/object:Gem::Version
38
- version: '2.6'
53
+ version: '2.7'
39
54
  required_rubygems_version: !ruby/object:Gem::Requirement
40
55
  requirements:
41
56
  - - ">="