fastlane-plugin-rename_android 1.0.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: fcc7d3cf79c5586b765a46c0fc93b7d635acb957e51ff66cbb2ab84e313bf0e7
4
+ data.tar.gz: 38863ba354640c3d1b3753e2fa19a4d8b57f3c305ac30f5446680d86ac4c8d82
5
+ SHA512:
6
+ metadata.gz: d63d35c41ed105531d1ac6c8793b11ab8a0c2bd043507d6d265566e127df87c605d664fbb5cda34af4e2532127b3afdc056d1c8225eb8983e2df87a59d713807
7
+ data.tar.gz: 0b9c0a3f6853991d592b4edac48fce606bb31fed54d8ab7e0d88b3d1afa5fad3ca684a6b7f8c2355e19e87903c66a6dfa60a8d69d164816971e4903c13da27d1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Josh Holtz <josh@rokkincat.com:>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # rename_android fastlane plugin
2
+ _Forked from [joshdholtz/fastlane-plugin-rename_android_package](https://github.com/joshdholtz/fastlane-plugin-rename_android_package) due to abandonment._
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/fastlane-plugin-rename_android.svg)](https://badge.fury.io/rb/fastlane-plugin-rename_android)
5
+
6
+ ## Getting Started
7
+
8
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-rename_android`, add it to your project by running:
9
+
10
+ ```bash
11
+ fastlane add_plugin rename_android
12
+ ```
13
+
14
+ ## About rename_android
15
+
16
+ Renames Android package for .java, .kt, AndroidManifest.xml, and build.gradle files
17
+
18
+ ## Example
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`.
21
+
22
+ ```rb
23
+ rename_android_package(
24
+ path: "./",
25
+ package_name: "com.joshholtz.fastlane.app",
26
+ new_package_name: "com.newjoshholtz.fastlane.app"
27
+ )
28
+ ```
29
+
30
+ ## Run tests for this plugin
31
+
32
+ To run both the tests, and code style validation, run
33
+
34
+ ```
35
+ rake
36
+ ```
37
+
38
+ To automatically fix many of the styling issues, use
39
+ ```
40
+ rubocop -a
41
+ ```
42
+
43
+ ## Issues and Feedback
44
+
45
+ For any other issues and feedback about this plugin, please submit it to this repository.
46
+
47
+ ## Troubleshooting
48
+
49
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
50
+
51
+ ## Using _fastlane_ Plugins
52
+
53
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
54
+
55
+ ## About _fastlane_
56
+
57
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,77 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane_core/configuration/config_item'
3
+ require 'fastlane_core/ui/ui'
4
+
5
+ module Fastlane
6
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
7
+
8
+ module Actions
9
+ class RenameAndroidAction < Action
10
+ def self.run(params)
11
+ UI.user_error!("No path provided") if params[:path].nil?
12
+ UI.user_error!("No package_name provided") if params[:package_name].nil?
13
+ UI.user_error!("No new_package_name provided") if params[:new_package_name].nil?
14
+
15
+ path = params[:path]
16
+ package_name = params[:package_name]
17
+ new_package_name = params[:new_package_name]
18
+
19
+ folder = package_name.gsub('.', '/')
20
+ new_folder = new_package_name.gsub('.', '/')
21
+ new_folder_path = "#{path}/app/src/main/java/#{new_folder}"
22
+
23
+ FileUtils.mkdir_p(new_folder_path)
24
+
25
+ java_sources = Dir.glob("#{path}/app/src/main/java/#{folder}/*.java")
26
+ java_sources.each do |file|
27
+ FileUtils.mv(file, new_folder_path)
28
+ end
29
+
30
+ kotlin_sources = Dir.glob("#{path}/app/src/main/java/#{folder}/*.kt")
31
+ kotlin_sources.each do |file|
32
+ FileUtils.mv(file, new_folder_path)
33
+ end
34
+
35
+ Bundler.with_unbundled_env do
36
+ sh("find #{path}/app/src -name '*.java' -type f -exec sed -i '' 's/#{package_name}/#{new_package_name}/' {} \\;")
37
+ sh("find #{path}/app/src -name '*.kt' -type f -exec sed -i '' 's/#{package_name}/#{new_package_name}/' {} \\;")
38
+ sh("find #{path}/app/src -name 'AndroidManifest.xml' -type f -exec sed -i '' 's/#{package_name}/#{new_package_name}/' {} \\;")
39
+ sh("find #{path}/app -name 'build.gradle' -type f -exec sed -i '' 's/#{package_name}/#{new_package_name}/' {} \\;")
40
+ end
41
+ end
42
+
43
+ def self.description
44
+ "Renames Android package for .java, .kt, AndroidManifest.xml, and build.gradle files"
45
+ end
46
+
47
+ def self.authors
48
+ %w[joshdholtz sourcetoad]
49
+ end
50
+
51
+ def self.details
52
+ "Renames Android package"
53
+ end
54
+
55
+ def self.available_options
56
+ [
57
+ FastlaneCore::ConfigItem.new(key: :path,
58
+ env_name: "FL_RENAME_ANDROID_PACKAGE_PATH",
59
+ description: "Path of root Android project folder",
60
+ is_string: true),
61
+ FastlaneCore::ConfigItem.new(key: :package_name,
62
+ env_name: "FL_RENAME_ANDROID_PACKAGE_PACKAGE_NAME",
63
+ description: "Old package name",
64
+ is_string: true),
65
+ FastlaneCore::ConfigItem.new(key: :new_package_name,
66
+ env_name: "FL_RENAME_ANDROID_PACKAGE_NEW_PACKAGE_NAME",
67
+ description: "New package name",
68
+ is_string: true)
69
+ ]
70
+ end
71
+
72
+ def self.is_supported?(platform)
73
+ [:android].include?(platform)
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module RenameAndroid
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,15 @@
1
+ require 'fastlane/plugin/rename_android/version'
2
+
3
+ module Fastlane
4
+ module RenameAndroidPackage
5
+ # Return all .rb files inside the "actions" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default, we want to import all available actions
13
+ Fastlane::RenameAndroidPackage.all_classes.each do |current|
14
+ require current
15
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-rename_android
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Josh Holtz
8
+ - Sourcetoad
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2025-02-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ email: info@sourcetoad.com
14
+ executables: []
15
+ extensions: []
16
+ extra_rdoc_files: []
17
+ files:
18
+ - LICENSE
19
+ - README.md
20
+ - lib/fastlane/plugin/rename_android.rb
21
+ - lib/fastlane/plugin/rename_android/actions/rename_android_action.rb
22
+ - lib/fastlane/plugin/rename_android/version.rb
23
+ homepage: https://github.com/sourcetoad/fastlane-plugin-rename_android
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ rubygems_mfa_required: 'true'
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '2.6'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubygems_version: 3.6.2
43
+ specification_version: 4
44
+ summary: Renames Android package for .java, .kt, AndroidManifest.xml, and build.gradle
45
+ files
46
+ test_files: []