fastlane-plugin-android_version_manage 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/lib/fastlane/plugin/android_version_manage.rb +16 -0
- data/lib/fastlane/plugin/android_version_manage/actions/android_commit_version_bump.rb +138 -0
- data/lib/fastlane/plugin/android_version_manage/actions/android_set_version_code.rb +76 -0
- data/lib/fastlane/plugin/android_version_manage/actions/android_set_version_name.rb +77 -0
- data/lib/fastlane/plugin/android_version_manage/helper/android_version_manage_helper.rb +92 -0
- data/lib/fastlane/plugin/android_version_manage/version.rb +5 -0
- metadata +176 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c7e055cfc05190b5135e5356a61e60043627837d7e37e5d26633ace778a42431
|
4
|
+
data.tar.gz: 7e02f33629a878bd011fac093cbcbf1c0ede553f60427ed73247696c83989b78
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a6dcb9f97584cf9a739000a821aed9721ee20520bdabc665cbce5227db9c0ed60da1545474d7bf2979db7ca4fc7f1133c0980ffd19ade5970dd5235698b206f1
|
7
|
+
data.tar.gz: 9c5bda30eeee22b3616505ecc63b6e9e646650279e66d91d2e1dc544462d14f37d76f7738324f3faa7128a05ac1c97cf23cd5a3e8ce47e0ec13fca376cb9f37e
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 futabooo <takahiro.futagawa@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,52 @@
|
|
1
|
+
# android_version_manage 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_version_manage)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_version_manage`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin android_version_manage
|
11
|
+
```
|
12
|
+
|
13
|
+
## About android_version_manage
|
14
|
+
|
15
|
+
Manage Android App Versioning
|
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,16 @@
|
|
1
|
+
require 'fastlane/plugin/android_version_manage/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module AndroidVersionManage
|
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::AndroidVersionManage.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,138 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
class AndroidCommitVersionBumpAction < Action
|
4
|
+
def self.run(params)
|
5
|
+
require 'pathname'
|
6
|
+
require 'set'
|
7
|
+
require 'shellwords'
|
8
|
+
|
9
|
+
gradle_file_path = File.expand_path(params[:gradle_file]).shellescape
|
10
|
+
|
11
|
+
# create our list of files that we expect to have changed, they should all be relative to the project root, which should be equal to the git workdir root
|
12
|
+
expected_changed_files = []
|
13
|
+
expected_changed_files << gradle_file_path
|
14
|
+
|
15
|
+
# get the list of files that have actually changed in our git workdir
|
16
|
+
git_dirty_files = Actions.sh("git -C #{repo_path} diff --name-only HEAD").split("\n") + Actions.sh("git -C #{repo_path} ls-files --other --exclude-standard").split("\n")
|
17
|
+
if git_dirty_files.empty?
|
18
|
+
UI.user_error!("No file changes picked up. Make sure you run the `increment_version_code` action first.")
|
19
|
+
end
|
20
|
+
|
21
|
+
# check if the files changed are the ones we expected to change (these should be only the files that have version info in them)
|
22
|
+
changed_files_as_expected = Set.new(git_dirty_files.map(&:downcase)).subset?(Set.new(expected_changed_files.map(&:downcase)))
|
23
|
+
|
24
|
+
unless changed_files_as_expected
|
25
|
+
unless params[:force]
|
26
|
+
error = [
|
27
|
+
"Found unexpected uncommited changes in the working directory. Expected these files to have ",
|
28
|
+
"changed: \n#{expected_changed_files.join("\n")}.\nBut found these actual changes: ",
|
29
|
+
"#{git_dirty_files.join("\n")}.\nMake sure you have cleaned up the build artifacts and ",
|
30
|
+
"are only left with the changed version files at this stage in your lane, and don't touch the ",
|
31
|
+
"working directory while your lane is running. You can also use the :force option to bypass this ",
|
32
|
+
"check, and always commit a version bump regardless of the state of the working directory."
|
33
|
+
].join("\n")
|
34
|
+
UI.user_error!(error)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# get the absolute paths to the files
|
39
|
+
git_add_paths = expected_changed_files.map do |path|
|
40
|
+
updated = path
|
41
|
+
updated.replace(updated.sub(repo_pathname.to_s, "./")) # .gsub(repo_pathname, ".")
|
42
|
+
puts(" -- updated = #{updated}".yellow)
|
43
|
+
File.expand_path(File.join(repo_pathname, updated))
|
44
|
+
end
|
45
|
+
|
46
|
+
# then create a commit with a message
|
47
|
+
command_add = build_git_command_add(repo_path, git_add_paths.map(&:shellescape).join(' '))
|
48
|
+
Actions.sh(command_add)
|
49
|
+
|
50
|
+
begin
|
51
|
+
command_commit = build_git_command(params, repo_path)
|
52
|
+
Actions.sh(command_commit)
|
53
|
+
UI.success("Committed \"#{params[:message]}\" 💾.")
|
54
|
+
rescue => ex
|
55
|
+
UI.error(ex)
|
56
|
+
UI.important("Didn't commit any changes.")
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.description
|
61
|
+
"This action is like a commit_version_bump action for Android"
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.authors
|
65
|
+
["futabooo"]
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.return_value
|
69
|
+
# If your method provides a return value, you can describe here what it does
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.details
|
73
|
+
# Optional:
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.available_options
|
77
|
+
[
|
78
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
79
|
+
env_name: "FL_ANDROID_COMMIT_VERSION_BUMP_GRADLE_FILE",
|
80
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
81
|
+
optional: true,
|
82
|
+
type: String,
|
83
|
+
default_value: "app/build.gradle"),
|
84
|
+
FastlaneCore::ConfigItem.new(key: :message,
|
85
|
+
env_name: "FL_ANDROID_COMMIT_VERSION_BUMP_COMMIT_MESSAGE",
|
86
|
+
description: "(optional) The commit message when committing the version bump",
|
87
|
+
optional: true),
|
88
|
+
FastlaneCore::ConfigItem.new(key: :force,
|
89
|
+
env_name: "FL_ANDROID_COMMIT_VERSION_BUMP_FORCE_COMMIT",
|
90
|
+
description: "(optional) Forces the commit, even if other files than the ones containing the version number have been modified",
|
91
|
+
optional: true,
|
92
|
+
default_value: false,
|
93
|
+
is_string: false),
|
94
|
+
FastlaneCore::ConfigItem.new(key: :no_verify,
|
95
|
+
env_name: "FL_ANDROID_COMMIT_VERSION_BUMP_GIT_PUSH_USE_NO_VERIFY",
|
96
|
+
description: "Whether or not to use --no-verify",
|
97
|
+
type: Boolean,
|
98
|
+
default_value: false)
|
99
|
+
]
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.is_supported?(platform)
|
103
|
+
platform == :android
|
104
|
+
end
|
105
|
+
|
106
|
+
class << self
|
107
|
+
def build_git_command_add(repo_path, paths)
|
108
|
+
command = ['git',
|
109
|
+
'-C',
|
110
|
+
"'#{repo_path}'",
|
111
|
+
'add',
|
112
|
+
"'#{paths}'"]
|
113
|
+
|
114
|
+
return command.join(' ')
|
115
|
+
end
|
116
|
+
|
117
|
+
def build_git_command_commit(params, repo_path)
|
118
|
+
version_code = Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_CODE]
|
119
|
+
|
120
|
+
params[:message] ||= (version_code ? "Version Bump to #{version_code}" : "Version Bump")
|
121
|
+
|
122
|
+
command = [
|
123
|
+
'git',
|
124
|
+
'-C',
|
125
|
+
"'#{repo_path}'",
|
126
|
+
'commit',
|
127
|
+
'-m',
|
128
|
+
"'#{params[:message]}'"
|
129
|
+
]
|
130
|
+
|
131
|
+
command << '--no-verify' if params[:no_verify]
|
132
|
+
|
133
|
+
return command.join(' ')
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
ANDROID_NEW_VERSION_CODE = :ANDROID_NEW_VERSION_CODE
|
5
|
+
end
|
6
|
+
|
7
|
+
class AndroidSetVersionCodeAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
gradle_file_path = Helper::AndroidVersionManageHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
new_version_code = Helper::AndroidVersionManageHelper.get_new_version_code(gradle_file_path, params[:version_code])
|
11
|
+
|
12
|
+
UI.message(gradle_file_path)
|
13
|
+
|
14
|
+
saved = Helper::AndroidVersionManageHelper.save_key_to_gradle_file(gradle_file_path, "versionCode", new_version_code)
|
15
|
+
|
16
|
+
if saved == -1
|
17
|
+
UI.user_error!("Unable to set the Version Code #{gradle_file_path}.")
|
18
|
+
end
|
19
|
+
|
20
|
+
UI.success("☝️ Android Version Code has been set to: #{new_version_code}")
|
21
|
+
|
22
|
+
# Store the Version Code in the shared hash
|
23
|
+
Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_CODE] = new_version_code
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.description
|
27
|
+
"Set the Version Code of your Android project"
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.authors
|
31
|
+
["futabooo"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.output
|
35
|
+
[
|
36
|
+
['ANDROID_NEW_VERSION_CODE', 'The new Version Code of Android project']
|
37
|
+
]
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.return_value
|
41
|
+
"The new Version Code of your Android project"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.details
|
45
|
+
[
|
46
|
+
"This action will set the new Version Code on your Android project.",
|
47
|
+
"Without specifying new Version Code, current one will be incremented"
|
48
|
+
].join(' ')
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.available_options
|
52
|
+
[
|
53
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
54
|
+
env_name: "FL_ANDROID_VERSION_MANAGE_GRADLE_FILE",
|
55
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
56
|
+
optional: true,
|
57
|
+
type: String,
|
58
|
+
default_value: "app/build.gradle.kts",
|
59
|
+
verify_block: proc do |value|
|
60
|
+
UI.user_error!("Could not find #{value} file") unless File.exist?(value) || Helper.test?
|
61
|
+
end),
|
62
|
+
FastlaneCore::ConfigItem.new(key: :version_code,
|
63
|
+
env_name: "FL_ANDROID_VERSION_MANAGE_VERSION_CODE",
|
64
|
+
description: "(optional) Set specific Version Code",
|
65
|
+
optional: true,
|
66
|
+
type: Integer,
|
67
|
+
default_value: nil)
|
68
|
+
]
|
69
|
+
end
|
70
|
+
|
71
|
+
def self.is_supported?(platform)
|
72
|
+
platform == :android
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
ANDROID_NEW_VERSION_NAME = :ANDROID_NEW_VERSION_NAME
|
5
|
+
end
|
6
|
+
|
7
|
+
class AndroidSetVersionNameAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
gradle_file_path = Helper::AndroidVersionManageHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
new_version_name = Helper::AndroidVersionManageHelper.get_new_version_name(gradle_file_path, params[:version_name], params[:bump_type])
|
11
|
+
|
12
|
+
saved = Helper::AndroidVersionManageHelper.save_key_to_gradle_file(gradle_file_path, "versionName", new_version_name)
|
13
|
+
|
14
|
+
if saved == -1
|
15
|
+
UI.user_error!("Unable to set the Version Name in #{gradle_file_path}.")
|
16
|
+
end
|
17
|
+
|
18
|
+
UI.success("☝️ Android Version Name has been set to: #{new_version_name}")
|
19
|
+
|
20
|
+
# Store the versionName in the shared hash
|
21
|
+
Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_NAME] = new_version_name
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.description
|
25
|
+
"Set the Version Name of your Android project"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.details
|
29
|
+
"This action will set the new Version Name on your Android project."
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.available_options
|
33
|
+
[
|
34
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
35
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_GRADLE_FILE",
|
36
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
37
|
+
optional: true,
|
38
|
+
type: String,
|
39
|
+
default_value: "app/build.gradle.kts",
|
40
|
+
verify_block: proc do |value|
|
41
|
+
UI.user_error!("Could not find #{value} file") unless File.exist?(value) || Helper.test?
|
42
|
+
end),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :version_name,
|
44
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_VERSION_NAME",
|
45
|
+
description: "(optional) Set specific Version Name",
|
46
|
+
optional: true,
|
47
|
+
type: String,
|
48
|
+
default_value: nil),
|
49
|
+
FastlaneCore::ConfigItem.new(key: :bump_type,
|
50
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_BUMP_TYPE",
|
51
|
+
description: "(optional) Type of version bump (major, minor, patch)",
|
52
|
+
optional: true,
|
53
|
+
type: String,
|
54
|
+
default_value: nil)
|
55
|
+
]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.output
|
59
|
+
[
|
60
|
+
['ANDROID_NEW_VERSION_NAME', 'The new Version Name of your Android project']
|
61
|
+
]
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.return_value
|
65
|
+
"The new Version Name of your Android project"
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.authors
|
69
|
+
["futabooo"]
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.is_supported?(platform)
|
73
|
+
platform == :android
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class AndroidVersionManageHelper
|
4
|
+
require "tempfile"
|
5
|
+
require "fileutils"
|
6
|
+
|
7
|
+
GRADLE_FILE_TEST = "/tmp/fastlane/tests/android-version-manage/app/build.gradle.kts"
|
8
|
+
|
9
|
+
def self.get_gradle_file(gradle_file)
|
10
|
+
return Helper.test? ? GRADLE_FILE_TEST : gradle_file
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.get_gradle_file_path(gradle_file)
|
14
|
+
gradle_file = self.get_gradle_file(gradle_file)
|
15
|
+
return File.expand_path(gradle_file).shellescape
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get_new_version_code(gradle_file, new_version_code)
|
19
|
+
if new_version_code.nil?
|
20
|
+
current_version_code = self.read_key_from_gradle_file(gradle_file, "versionCode")
|
21
|
+
new_version_code = current_version_code.to_i + 1
|
22
|
+
end
|
23
|
+
|
24
|
+
return new_version_code.to_i
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.get_new_version_name(gradle_file, new_version_name, bump_type)
|
28
|
+
if new_version_name.nil?
|
29
|
+
current_version_name = self.read_key_from_gradle_file(gradle_file, "versionName")
|
30
|
+
current_version_parts = current_version_name.split(/[.]/)
|
31
|
+
|
32
|
+
major = current_version_parts[0].to_i
|
33
|
+
minor = current_version_parts[1].to_i
|
34
|
+
patch = current_version_parts[2].to_i
|
35
|
+
|
36
|
+
if bump_type == "major"
|
37
|
+
new_version_name = "#{major + 1}.0.0"
|
38
|
+
elsif bump_type == "minor"
|
39
|
+
new_version_name = "#{major}.#{minor + 1}.0"
|
40
|
+
elsif bump_type == "patch"
|
41
|
+
new_version_name = "#{major}.#{minor}.#{patch + 1}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
return new_version_name.to_s
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.read_key_from_gradle_file(gradle_file, key)
|
49
|
+
value = false
|
50
|
+
begin
|
51
|
+
file = File.new(gradle_file, "r")
|
52
|
+
while (line = file.gets)
|
53
|
+
next unless line.include?(key)
|
54
|
+
components = line.strip.split(' ')
|
55
|
+
value = components[components.length - 1].tr("\"", "")
|
56
|
+
break
|
57
|
+
end
|
58
|
+
file.close
|
59
|
+
rescue => err
|
60
|
+
UI.error("An exception occured while reading gradle file: #{err}")
|
61
|
+
err
|
62
|
+
end
|
63
|
+
return value
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.save_key_to_gradle_file(gradle_file, key, value)
|
67
|
+
current_value = self.read_key_from_gradle_file(gradle_file, key)
|
68
|
+
|
69
|
+
begin
|
70
|
+
found = false
|
71
|
+
temp_file = Tempfile.new("flSave_#{key}_ToGradleFile")
|
72
|
+
File.open(gradle_file, "r") do |file|
|
73
|
+
file.each_line do |line|
|
74
|
+
if line.include?(key) && found == false
|
75
|
+
found = true
|
76
|
+
line.replace(line.sub(current_value.to_s, value.to_s))
|
77
|
+
end
|
78
|
+
temp_file.puts(line)
|
79
|
+
end
|
80
|
+
file.close
|
81
|
+
end
|
82
|
+
temp_file.rewind
|
83
|
+
temp_file.close
|
84
|
+
FileUtils.mv(temp_file.path, gradle_file)
|
85
|
+
temp_file.unlink
|
86
|
+
end
|
87
|
+
|
88
|
+
return found == true ? value : -1
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-android_version_manage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- futabooo
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
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: bundler
|
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: rspec
|
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_junit_formatter
|
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.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop-require_tools
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: fastlane
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 2.134.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 2.134.0
|
139
|
+
description:
|
140
|
+
email: takahiro.futagawa@gmail.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- LICENSE
|
146
|
+
- README.md
|
147
|
+
- lib/fastlane/plugin/android_version_manage.rb
|
148
|
+
- lib/fastlane/plugin/android_version_manage/actions/android_commit_version_bump.rb
|
149
|
+
- lib/fastlane/plugin/android_version_manage/actions/android_set_version_code.rb
|
150
|
+
- lib/fastlane/plugin/android_version_manage/actions/android_set_version_name.rb
|
151
|
+
- lib/fastlane/plugin/android_version_manage/helper/android_version_manage_helper.rb
|
152
|
+
- lib/fastlane/plugin/android_version_manage/version.rb
|
153
|
+
homepage: https://github.com/futabooo/fastlane-plugin-android_version_manage
|
154
|
+
licenses:
|
155
|
+
- MIT
|
156
|
+
metadata: {}
|
157
|
+
post_install_message:
|
158
|
+
rdoc_options: []
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubygems_version: 3.0.3
|
173
|
+
signing_key:
|
174
|
+
specification_version: 4
|
175
|
+
summary: Manage Android App Versioning
|
176
|
+
test_files: []
|