fastlane-plugin-update_version_name 0.1.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: d2d7a391962ae67d6c95cb0059f3d76290a7d0ec749c6698a4dce178255a5843
4
+ data.tar.gz: ff80035d4d1b41e30f33827fb3929a646bdc7c224f81a11e1d4306a6a05dcff1
5
+ SHA512:
6
+ metadata.gz: c8808212b1062ec6a4641873ed137dd1742a03347c9df07f72f6a0ae6f8aa0373efba16f07ed6a147775417ab505bebf26d3a5116a9b5a023defab3bae577056
7
+ data.tar.gz: 1c698caef822ed3daa9998afbc88af15dd91d6656a680076886eb0b7c99ea39e9f8a5ff0cf39ce5f1337a204b2c88e04291b94caac1daac020ab03d75c4bef68
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Thiago Rodrigues <thiago@uliving.com.br>
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,52 @@
1
+ # update_version_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-update_version_name)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-update_version_name`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin update_version_name
11
+ ```
12
+
13
+ ## About update_version_name
14
+
15
+ Updates the versionName in the build.gradle file of an Android project
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ 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`.
22
+
23
+ **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)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _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,81 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/update_version_name_helper'
3
+
4
+ require 'fileutils'
5
+
6
+ module Fastlane
7
+ module Actions
8
+ class UpdateVersionNameAction < Action
9
+ def self.run(params)
10
+ gradle_file_path = params[:gradle_file_path]
11
+ version_name = params[:version_name]
12
+
13
+ UI.message("Plugin update_version_name is looking for gradle file at path: #{gradle_file_path}")
14
+
15
+ unless File.exist?(gradle_file_path)
16
+ UI.user_error!("Could not find gradle file at path '#{gradle_file_path}'")
17
+ end
18
+
19
+ version_name_line_regex = /^\s*versionName\s*['"](.*)['"]$/
20
+ file_content = File.read(gradle_file_path)
21
+ new_content = ""
22
+ version_name_updated = false
23
+
24
+ file_content.each_line do |line|
25
+ if version_name_line_regex.match?(line)
26
+ new_line = line.gsub(version_name_line_regex, " versionName \"#{version_name}\"")
27
+ new_content += new_line
28
+ version_name_updated = true
29
+ UI.message("Updated versionName to #{version_name}")
30
+ else
31
+ new_content += line
32
+ end
33
+ end
34
+
35
+ if version_name_updated
36
+ File.open(gradle_file_path, 'w') { |file| file.puts(new_content) }
37
+ UI.success("Successfully updated versionName in gradle file to #{version_name}")
38
+ else
39
+ UI.important("No versionName found in gradle file to update")
40
+ end
41
+ end
42
+
43
+ def self.description
44
+ "Updates the versionName in your project's gradle file to the specified value"
45
+ end
46
+
47
+ def self.authors
48
+ ["Codesumn"]
49
+ end
50
+
51
+ def self.return_value
52
+ "The new versionName after it has been updated in the gradle file"
53
+ end
54
+
55
+ def self.details
56
+ "Use this action to update the versionName in your Android project's gradle file directly from your Fastlane script."
57
+ end
58
+
59
+ def self.available_options
60
+ [
61
+ FastlaneCore::ConfigItem.new(
62
+ key: :gradle_file_path,
63
+ env_name: "FL_UPDATE_VERSION_NAME_GRADLE_FILE_PATH",
64
+ description: "The relative path to the gradle file containing the versionName you want to update",
65
+ type: String
66
+ ),
67
+ FastlaneCore::ConfigItem.new(
68
+ key: :version_name,
69
+ env_name: "FL_UPDATE_VERSION_NAME_VERSION_NAME",
70
+ description: "The new versionName to set in your gradle file",
71
+ type: String
72
+ )
73
+ ]
74
+ end
75
+
76
+ def self.is_supported?(platform)
77
+ platform == :android
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,13 @@
1
+ require 'fastlane_core/ui/ui'
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
5
+
6
+ module Helper
7
+ class UpdateVersionNameHelper
8
+ def self.show_message
9
+ UI.message("Hello from the update_version_name plugin helper!")
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module UpdateVersionName
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,13 @@
1
+ require 'fastlane/plugin/update_version_name/version'
2
+
3
+ module Fastlane
4
+ module UpdateVersionName
5
+ def self.all_classes
6
+ Dir[File.expand_path('**/{actions,helper}/*.rb', File.dirname(__FILE__))]
7
+ end
8
+ end
9
+ end
10
+
11
+ Fastlane::UpdateVersionName.all_classes.each do |current|
12
+ require current
13
+ end
metadata ADDED
@@ -0,0 +1,49 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-update_version_name
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thiago Rodrigues
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-04-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: thiago@uliving.com.br
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - lib/fastlane/plugin/update_version_name.rb
22
+ - lib/fastlane/plugin/update_version_name/actions/update_version_name_action.rb
23
+ - lib/fastlane/plugin/update_version_name/helper/update_version_name_helper.rb
24
+ - lib/fastlane/plugin/update_version_name/version.rb
25
+ homepage: https://github.com/thoggs/fastlane-plugin-update_version_name
26
+ licenses:
27
+ - MIT
28
+ metadata:
29
+ rubygems_mfa_required: 'true'
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '2.6'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubygems_version: 3.5.4
46
+ signing_key:
47
+ specification_version: 4
48
+ summary: Updates the versionName in the build.gradle file of an Android project
49
+ test_files: []