fastlane-plugin-android_change_app_name 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b3c2e4b2351d8bd8b541b1b85f3d25ed39f354f9
4
+ data.tar.gz: f6270c03e143d58bc10244e90f391abafdf97b6b
5
+ SHA512:
6
+ metadata.gz: fecbeeac7d42018513d306c77e1d07801b3e53e86ad597739f2c68dbbd0df659feaf9fdd5efe845f10328de15b4a745874caf5c96ec0fb392c63abd4cfbe1bc0
7
+ data.tar.gz: 548be0697dae9932eff73822cfb864bc0fc79f186dab7898c7e3b3566a2ca222c61198653ac6f2158770d26be3f7121f3c3ad47f4e3b26d894a69c7465fe4503
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 MaximusMcCann <mxmccann@gmail.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,84 @@
1
+ # android_change_app_name plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-android_change_app_name)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_change_app_name`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin android_change_app_name
11
+ ```
12
+
13
+ ## About android_change_app_name
14
+
15
+ Changes the manifest's android:label attribute (appName). Stores the original name for revertinng.
16
+
17
+ Inupts:
18
+ ```
19
+ newName: String // The new name of your app
20
+ manifest: String (Optional) // The location to your AndroidManifest.xml file. Default: "app/src/main/AndroidManifest.xml"
21
+ ```
22
+
23
+ Usage:
24
+
25
+ ```
26
+ android_change_app_name(newName: "AwesomeNewName")
27
+ android_change_app_name(newName: "AwesomeNewName", manifest: "path/to/your/manifest.xml")
28
+ ```
29
+
30
+ Sets these keys
31
+
32
+ `ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME : String` = The original value from android:label.
33
+
34
+ ## About android_change_app_name_revert
35
+
36
+ Reverts the manifest's android:label attribute (appName) to the prior ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME value. Errors if ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME is not set.
37
+
38
+ Inupts:
39
+ ```
40
+ manifest: String (Optional) // The location to your AndroidManifest.xml file. Default: "app/src/main/AndroidManifest.xml"
41
+ ```
42
+
43
+ Usage:
44
+
45
+ ```
46
+ android_change_app_name_revert()
47
+ android_change_app_name_revert(manifest: "path/to/your/manifest.xml")
48
+
49
+ ```
50
+
51
+ ## Example
52
+
53
+ 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`.
54
+
55
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
56
+
57
+ ## Run tests for this plugin
58
+
59
+ To run both the tests, and code style validation, run
60
+
61
+ ```
62
+ rake
63
+ ```
64
+
65
+ To automatically fix many of the styling issues, use
66
+ ```
67
+ rubocop -a
68
+ ```
69
+
70
+ ## Issues and Feedback
71
+
72
+ For any other issues and feedback about this plugin, please submit it to this repository.
73
+
74
+ ## Troubleshooting
75
+
76
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
77
+
78
+ ## Using `fastlane` Plugins
79
+
80
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
81
+
82
+ ## About `fastlane`
83
+
84
+ `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,16 @@
1
+ require 'fastlane/plugin/android_change_app_name/version'
2
+
3
+ module Fastlane
4
+ module AndroidChangeAppName
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::AndroidChangeAppName.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,143 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME = :ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME
5
+ end
6
+ class AndroidChangeAppNameAction < Action
7
+ def self.run(params)
8
+ require 'nokogiri'
9
+
10
+ revertChange = params[:revertChange]
11
+ oldName = Actions.lane_context[SharedValues::ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME]
12
+
13
+ if revertChange and oldName.to_s.strip.length != 0
14
+ newName = oldName
15
+ manifest = params[:manifest]
16
+ else
17
+ newName = params[:newName]
18
+ manifest = params[:manifest]
19
+ end
20
+
21
+ doc = File.open(manifest) { |f|
22
+ @doc = Nokogiri::XML(f)
23
+
24
+ originalName = nil
25
+
26
+ @doc.css("application").each do |response_node|
27
+ originalName = response_node["android:label"]
28
+ response_node["android:label"] = newName
29
+ end
30
+
31
+ Actions.lane_context[SharedValues::ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME] = originalName
32
+
33
+ File.write(manifest, @doc.to_xml)
34
+ }
35
+
36
+ end
37
+
38
+ def self.description
39
+ "Changes the manifest's label attribute (appName). Stores the original name for revertinng."
40
+ end
41
+
42
+ def self.authors
43
+ ["MaximusMcCann"]
44
+ end
45
+
46
+ def self.return_value
47
+ # If your method provides a return value, you can describe here what it does
48
+ end
49
+
50
+ def self.details
51
+ "Changes the apk manifest file's label attribute (appName). Stores the original label value for reverting later."
52
+ end
53
+
54
+ def self.available_options
55
+ [
56
+ FastlaneCore::ConfigItem.new(key: :newName,
57
+ env_name: "",
58
+ description: "The new name for the app",
59
+ optional: true,
60
+ type: String),
61
+ FastlaneCore::ConfigItem.new(key: :manifest,
62
+ env_name: "",
63
+ description: "Optional custom location for AndroidManifest.xml",
64
+ optional: false,
65
+ type: String,
66
+ default_value: "app/src/main/AndroidManifest.xml"),
67
+ FastlaneCore::ConfigItem.new(key: :revertChange,
68
+ env_name: "",
69
+ description: "if 'true' will use ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME to reset the app name",
70
+ optional: true,
71
+ default_value: false)
72
+ ]
73
+ end
74
+
75
+ def self.output
76
+ [
77
+ ['ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME', 'The original app name.']
78
+ ]
79
+ end
80
+
81
+ def self.is_supported?(platform)
82
+ platform == :android
83
+ end
84
+ end
85
+
86
+ class AndroidChangeAppNameRevertAction < Action
87
+ def self.run(params)
88
+ require 'nokogiri'
89
+
90
+ oldName = Actions.lane_context[SharedValues::ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME]
91
+
92
+ if oldName.to_s.strip.length != 0
93
+ manifest = params[:manifest]
94
+ else
95
+ UI.error("no string for ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME. Have you run android_change_app_name?")
96
+ end
97
+
98
+ doc = File.open(manifest) { |f|
99
+ @doc = Nokogiri::XML(f)
100
+
101
+ @doc.css("application").each do |response_node|
102
+ originalName = response_node["android:label"]
103
+ response_node["android:label"] = oldName
104
+ end
105
+
106
+ File.write(manifest, @doc.to_xml)
107
+ }
108
+
109
+ end
110
+
111
+ def self.description
112
+ "Reverts the manifest's label attribute (appName) from ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME"
113
+ end
114
+
115
+ def self.authors
116
+ ["MaximusMcCann"]
117
+ end
118
+
119
+ def self.return_value
120
+ # If your method provides a return value, you can describe here what it does
121
+ end
122
+
123
+ def self.details
124
+ "Reverts the manifest's label attribute (appName) from ANDROID_CHANGE_APP_NAME_ORIGINAL_NAME"
125
+ end
126
+
127
+ def self.available_options
128
+ [
129
+ FastlaneCore::ConfigItem.new(key: :manifest,
130
+ env_name: "",
131
+ description: "Optional custom location for AndroidManifest.xml",
132
+ optional: false,
133
+ type: String,
134
+ default_value: "app/src/main/AndroidManifest.xml")
135
+ ]
136
+ end
137
+
138
+ def self.is_supported?(platform)
139
+ platform == :android
140
+ end
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,12 @@
1
+ module Fastlane
2
+ module Helper
3
+ class AndroidChangeAppNameHelper
4
+ # class methods that you define here become available in your action
5
+ # as `Helper::AndroidChangeAppNameHelper.your_method`
6
+ #
7
+ def self.show_message
8
+ UI.message("Hello from the android_change_app_name plugin helper!")
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module AndroidChangeAppName
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,148 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-android_change_app_name
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - MaximusMcCann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: nokogiri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: fastlane
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: 1.106.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: 1.106.2
111
+ description:
112
+ email: mxmccann@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - LICENSE
118
+ - README.md
119
+ - lib/fastlane/plugin/android_change_app_name.rb
120
+ - lib/fastlane/plugin/android_change_app_name/actions/android_change_app_name_action.rb
121
+ - lib/fastlane/plugin/android_change_app_name/helper/android_change_app_name_helper.rb
122
+ - lib/fastlane/plugin/android_change_app_name/version.rb
123
+ homepage:
124
+ licenses:
125
+ - MIT
126
+ metadata: {}
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ required_rubygems_version: !ruby/object:Gem::Requirement
137
+ requirements:
138
+ - - ">="
139
+ - !ruby/object:Gem::Version
140
+ version: '0'
141
+ requirements: []
142
+ rubyforge_project:
143
+ rubygems_version: 2.6.7
144
+ signing_key:
145
+ specification_version: 4
146
+ summary: Changes the manifest's label attribute (appName). Stores the original name
147
+ for revertinng.
148
+ test_files: []