fastlane-plugin-android_versioning_plus 0.5.5
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +54 -0
- data/lib/fastlane/plugin/android_versioning.rb +16 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/get_value_from_build.rb +82 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/get_version_code.rb +58 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/get_version_name.rb +58 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/increment_version_code.rb +81 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/increment_version_name.rb +100 -0
- data/lib/fastlane/plugin/android_versioning_plus/actions/set_value_in_build.rb +100 -0
- data/lib/fastlane/plugin/android_versioning_plus/version.rb +5 -0
- metadata +136 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 834aa6a80af5af6199203760ce35a01b8e05a6bf743c5ced92978dc663425319
|
4
|
+
data.tar.gz: 10fbdf8f9a6c5e75048624017a187064814285720f0d59d2568ab02dc297ccf7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8f44885ffc82c37ba5d933ddd786567e42541e9c8f1423553f0c7779e4f21a98a1ffe38cda819ced32e00a3a7c3ce00212220b1d071a83b524fe768ebb456099
|
7
|
+
data.tar.gz: a0cc81b85f0e764185def2aea4993b1b2d37a2d7aebc9d079ccc0807f9c7abc64e82b5644e88f535d8dc2b0b89b4a01483a1414a8c7540555a062e2a7fdf053e
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Manabu OHTAKE <manabu2783@hotmail.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,54 @@
|
|
1
|
+
# android_versioning plugin
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/fastlane-plugin-android_versioning)
|
4
|
+
[](https://badge.fury.io/rb/fastlane-plugin-android_versioning)
|
5
|
+
[](https://circleci.com/gh/otkmnb2783/fastlane-plugin-android_versioning)
|
6
|
+
|
7
|
+
## Getting Started
|
8
|
+
|
9
|
+
This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-android_versioning`, add it to your project by running:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
fastlane add_plugin android_versioning
|
13
|
+
```
|
14
|
+
|
15
|
+
## About android_versioning
|
16
|
+
|
17
|
+
Allows to set/get app version name and version code directly to/from build.gradle
|
18
|
+
|
19
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
20
|
+
|
21
|
+
## Example
|
22
|
+
|
23
|
+
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 show_version`.
|
24
|
+
|
25
|
+
**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)
|
26
|
+
|
27
|
+
## Run tests for this plugin
|
28
|
+
|
29
|
+
To run both the tests, and code style validation, run
|
30
|
+
|
31
|
+
```
|
32
|
+
rake
|
33
|
+
```
|
34
|
+
|
35
|
+
To automatically fix many of the styling issues, use
|
36
|
+
```
|
37
|
+
rubocop -a
|
38
|
+
```
|
39
|
+
|
40
|
+
## Issues and Feedback
|
41
|
+
|
42
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
43
|
+
|
44
|
+
## Troubleshooting
|
45
|
+
|
46
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
47
|
+
|
48
|
+
## Using `fastlane` Plugins
|
49
|
+
|
50
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
51
|
+
|
52
|
+
## About `fastlane`
|
53
|
+
|
54
|
+
`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_versioning_plus/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module AndroidVersioning
|
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::AndroidVersioning.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class GetValueFromBuildAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
app_project_dir ||= params[:app_project_dir]
|
8
|
+
regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
|
9
|
+
flavor = params[:flavor]
|
10
|
+
flavorSpecified = !(flavor.nil? or flavor.empty?)
|
11
|
+
regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
|
12
|
+
value = ""
|
13
|
+
found = false
|
14
|
+
flavorFound = false
|
15
|
+
productFlavorsSection = false
|
16
|
+
Dir.glob("#{app_project_dir}/build.gradle") do |path|
|
17
|
+
UI.verbose("path: #{path}")
|
18
|
+
UI.verbose("absolute_path: #{File.expand_path(path)}")
|
19
|
+
begin
|
20
|
+
File.open(path, 'r') do |file|
|
21
|
+
file.each_line do |line|
|
22
|
+
|
23
|
+
if flavorSpecified and !productFlavorsSection
|
24
|
+
unless line.include? "productFlavors"
|
25
|
+
next
|
26
|
+
end
|
27
|
+
productFlavorsSection = true
|
28
|
+
end
|
29
|
+
|
30
|
+
if flavorSpecified and !flavorFound
|
31
|
+
unless line.match(regex_flavor)
|
32
|
+
next
|
33
|
+
end
|
34
|
+
flavorFound = true
|
35
|
+
end
|
36
|
+
|
37
|
+
unless line.match(regex) and !found
|
38
|
+
next
|
39
|
+
end
|
40
|
+
key, left, value, right, comment = line.match(regex).captures
|
41
|
+
break
|
42
|
+
end
|
43
|
+
file.close
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
return value
|
48
|
+
end
|
49
|
+
|
50
|
+
#####################################################
|
51
|
+
# @!group Documentation
|
52
|
+
#####################################################
|
53
|
+
def self.available_options
|
54
|
+
[
|
55
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
56
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
57
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
58
|
+
optional: true,
|
59
|
+
type: String,
|
60
|
+
default_value: "android/app"),
|
61
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
62
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
63
|
+
description: "The product flavor name (optional)",
|
64
|
+
optional: true,
|
65
|
+
type: String),
|
66
|
+
FastlaneCore::ConfigItem.new(key: :key,
|
67
|
+
description: "The property key",
|
68
|
+
type: String)
|
69
|
+
|
70
|
+
]
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.authors
|
74
|
+
["Manabu OHTAKE"]
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.is_supported?(platform)
|
78
|
+
platform == :android
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class GetVersionCodeAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
GetValueFromBuildAction.run(
|
8
|
+
app_project_dir: params[:app_project_dir],
|
9
|
+
flavor: params[:flavor],
|
10
|
+
key: "versionCode"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
#####################################################
|
15
|
+
# @!group Documentation
|
16
|
+
#####################################################
|
17
|
+
def self.available_options
|
18
|
+
[
|
19
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
20
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
21
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
22
|
+
optional: true,
|
23
|
+
type: String,
|
24
|
+
default_value: "android/app"),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
26
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
27
|
+
description: "The product flavor name (optional)",
|
28
|
+
optional: true,
|
29
|
+
type: String)
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.description
|
34
|
+
"Get the version code of your project"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.details
|
38
|
+
[
|
39
|
+
"This action will return the current version code set on your project's build.gradle."
|
40
|
+
].join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.output
|
44
|
+
[
|
45
|
+
['VERSION_CODE', 'The version code']
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.authors
|
50
|
+
["Manabu OHTAKE"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.is_supported?(platform)
|
54
|
+
platform == :android
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class GetVersionNameAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
GetValueFromBuildAction.run(
|
8
|
+
app_project_dir: params[:app_project_dir],
|
9
|
+
flavor: params[:flavor],
|
10
|
+
key: "versionName"
|
11
|
+
)
|
12
|
+
end
|
13
|
+
|
14
|
+
#####################################################
|
15
|
+
# @!group Documentation
|
16
|
+
#####################################################
|
17
|
+
def self.available_options
|
18
|
+
[
|
19
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
20
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
21
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
22
|
+
optional: true,
|
23
|
+
type: String,
|
24
|
+
default_value: "android/app"),
|
25
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
26
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
27
|
+
description: "The product flavor name (optional)",
|
28
|
+
optional: true,
|
29
|
+
type: String)
|
30
|
+
]
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.description
|
34
|
+
"Get the version name of your project"
|
35
|
+
end
|
36
|
+
|
37
|
+
def self.details
|
38
|
+
[
|
39
|
+
"This action will return the current version name set on your project's build.gradle."
|
40
|
+
].join(' ')
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.output
|
44
|
+
[
|
45
|
+
['VERSION_NAME', 'The version name']
|
46
|
+
]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.authors
|
50
|
+
["Manabu OHTAKE"]
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.is_supported?(platform)
|
54
|
+
platform == :android
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
VERSION_CODE = :VERSION_CODE
|
8
|
+
end
|
9
|
+
class IncrementVersionCodeAction < Action
|
10
|
+
def self.run(params)
|
11
|
+
current_version_code = GetVersionCodeAction.run(params)
|
12
|
+
|
13
|
+
new_version_code =
|
14
|
+
if params[:version_code].nil?
|
15
|
+
current_version_code.to_i + 1
|
16
|
+
elsif params[:version_code] == -1
|
17
|
+
((Time.now.to_f * 1000).to_i / (60 * 1000)).to_i
|
18
|
+
else
|
19
|
+
params[:version_code].to_i
|
20
|
+
end
|
21
|
+
|
22
|
+
SetValueInBuildAction.run(
|
23
|
+
app_project_dir: params[:app_project_dir],
|
24
|
+
flavor: params[:flavor],
|
25
|
+
key: "versionCode",
|
26
|
+
value: new_version_code
|
27
|
+
)
|
28
|
+
Actions.lane_context[SharedValues::VERSION_CODE] = new_version_code.to_s
|
29
|
+
new_version_code.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
#####################################################
|
33
|
+
# @!group Documentation
|
34
|
+
#####################################################
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
38
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
39
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
40
|
+
optional: true,
|
41
|
+
type: String,
|
42
|
+
default_value: "android/app"),
|
43
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
44
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
45
|
+
description: "The product flavor name (optional)",
|
46
|
+
optional: true,
|
47
|
+
type: String),
|
48
|
+
FastlaneCore::ConfigItem.new(key: :version_code,
|
49
|
+
env_name: "ANDROID_VERSIONING_VERSION_CODE",
|
50
|
+
description: "Change to a specific version (optional)",
|
51
|
+
optional: true,
|
52
|
+
type: Integer)
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.description
|
57
|
+
"Increment the version code of your project"
|
58
|
+
end
|
59
|
+
|
60
|
+
def self.details
|
61
|
+
[
|
62
|
+
"This action will increment the version code directly in build.gradle . "
|
63
|
+
].join("\n")
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.output
|
67
|
+
[
|
68
|
+
['VERSION_CODE', 'The new version code']
|
69
|
+
]
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.authors
|
73
|
+
["Manabu OHTAKE"]
|
74
|
+
end
|
75
|
+
|
76
|
+
def self.is_supported?(platform)
|
77
|
+
platform == :android
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
module SharedValues
|
7
|
+
VERSION_NAME = :VERSION_NAME
|
8
|
+
end
|
9
|
+
class IncrementVersionNameAction < Action
|
10
|
+
def self.run(params)
|
11
|
+
if params[:version_name].nil? or params[:version_name].empty?
|
12
|
+
current_version = GetVersionNameAction.run(params)
|
13
|
+
UI.user_error!("Your current version (#{current_version}) does not respect the format A.B.C") unless current_version =~ /\d+.\d+.\d+/
|
14
|
+
version = current_version.split(".").map(&:to_i)
|
15
|
+
case params[:bump_type]
|
16
|
+
when "patch"
|
17
|
+
version[2] = version[2] + 1
|
18
|
+
new_version = version.join(".")
|
19
|
+
when "minor"
|
20
|
+
version[1] = version[1] + 1
|
21
|
+
version[2] = version[2] = 0
|
22
|
+
new_version = version.join(".")
|
23
|
+
when "major"
|
24
|
+
version[0] = version[0] + 1
|
25
|
+
version[1] = 0
|
26
|
+
version[2] = 0
|
27
|
+
new_version = version.join(".")
|
28
|
+
end
|
29
|
+
else
|
30
|
+
new_version = params[:version_name]
|
31
|
+
end
|
32
|
+
SetValueInBuildAction.run(
|
33
|
+
app_project_dir: params[:app_project_dir],
|
34
|
+
flavor: params[:flavor],
|
35
|
+
key: "versionName",
|
36
|
+
value: new_version
|
37
|
+
)
|
38
|
+
Actions.lane_context[SharedValues::VERSION_NAME] = new_version
|
39
|
+
new_version
|
40
|
+
end
|
41
|
+
|
42
|
+
#####################################################
|
43
|
+
# @!group Documentation
|
44
|
+
#####################################################
|
45
|
+
def self.available_options
|
46
|
+
[
|
47
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
48
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
49
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
50
|
+
optional: true,
|
51
|
+
type: String,
|
52
|
+
default_value: "android/app"),
|
53
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
54
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
55
|
+
description: "The product flavor name (optional)",
|
56
|
+
optional: true,
|
57
|
+
type: String),
|
58
|
+
FastlaneCore::ConfigItem.new(key: :bump_type,
|
59
|
+
env_name: "ANDROID_VERSIONING_BUMP_TYPE",
|
60
|
+
description: "Change to a specific type (optional)",
|
61
|
+
optional: true,
|
62
|
+
type: String,
|
63
|
+
default_value: "patch",
|
64
|
+
verify_block: proc do |value|
|
65
|
+
UI.user_error!("Available values are 'patch', 'minor' and 'major'") unless ['patch', 'minor', 'major'].include? value
|
66
|
+
end),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :version_name,
|
68
|
+
env_name: "ANDROID_VERSIONING_VERSION_NAME",
|
69
|
+
description: "Change to a specific version (optional)",
|
70
|
+
optional: true,
|
71
|
+
type: String)
|
72
|
+
]
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.description
|
76
|
+
"Increment the version name of your project"
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.details
|
80
|
+
[
|
81
|
+
"This action will increment the version name directly in build.gradle."
|
82
|
+
].join("\n")
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.output
|
86
|
+
[
|
87
|
+
['VERSION_NAME', 'The new version name']
|
88
|
+
]
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.authors
|
92
|
+
["Manabu OHTAKE"]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(platform)
|
96
|
+
platform == :android
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
require 'tempfile'
|
2
|
+
require 'fileutils'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class SetValueInBuildAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
app_project_dir ||= params[:app_project_dir]
|
9
|
+
regex = Regexp.new(/(?<key>#{params[:key]}\s+)(?<left>[\'\"]?)(?<value>[a-zA-Z0-9\-\.\_]*)(?<right>[\'\"]?)(?<comment>.*)/)
|
10
|
+
flavor = params[:flavor]
|
11
|
+
flavorSpecified = !(flavor.nil? or flavor.empty?)
|
12
|
+
regex_flavor = Regexp.new(/[ \t]#{flavor}[ \t]/)
|
13
|
+
found = false
|
14
|
+
productFlavorsSection = false
|
15
|
+
flavorFound = false
|
16
|
+
Dir.glob("#{app_project_dir}/build.gradle") do |path|
|
17
|
+
begin
|
18
|
+
temp_file = Tempfile.new('versioning')
|
19
|
+
File.open(path, 'r') do |file|
|
20
|
+
file.each_line do |line|
|
21
|
+
|
22
|
+
if flavorSpecified and !productFlavorsSection
|
23
|
+
unless line.include? "productFlavors" or productFlavorsSection
|
24
|
+
temp_file.puts line
|
25
|
+
next
|
26
|
+
end
|
27
|
+
productFlavorsSection = true
|
28
|
+
end
|
29
|
+
|
30
|
+
if flavorSpecified and !flavorFound
|
31
|
+
unless line.match(regex_flavor)
|
32
|
+
temp_file.puts line
|
33
|
+
next
|
34
|
+
end
|
35
|
+
flavorFound = true
|
36
|
+
end
|
37
|
+
|
38
|
+
unless line.match(regex) and !found
|
39
|
+
temp_file.puts line
|
40
|
+
next
|
41
|
+
end
|
42
|
+
line = line.gsub regex, "\\k<key>\\k<left>#{params[:value]}\\k<right>\\k<comment>"
|
43
|
+
found = true
|
44
|
+
temp_file.puts line
|
45
|
+
end
|
46
|
+
file.close
|
47
|
+
end
|
48
|
+
temp_file.rewind
|
49
|
+
temp_file.close
|
50
|
+
FileUtils.mv(temp_file.path, path)
|
51
|
+
temp_file.unlink
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
#####################################################
|
57
|
+
# @!group Documentation
|
58
|
+
#####################################################
|
59
|
+
def self.available_options
|
60
|
+
[
|
61
|
+
FastlaneCore::ConfigItem.new(key: :app_project_dir,
|
62
|
+
env_name: "ANDROID_VERSIONING_APP_PROJECT_DIR",
|
63
|
+
description: "The path to the application source folder in the Android project (default: android/app)",
|
64
|
+
optional: true,
|
65
|
+
type: String,
|
66
|
+
default_value: "android/app"),
|
67
|
+
FastlaneCore::ConfigItem.new(key: :flavor,
|
68
|
+
env_name: "ANDROID_VERSIONING_FLAVOR",
|
69
|
+
description: "The product flavor name (optional)",
|
70
|
+
optional: true,
|
71
|
+
type: String),
|
72
|
+
FastlaneCore::ConfigItem.new(key: :key,
|
73
|
+
description: "The property key",
|
74
|
+
type: String),
|
75
|
+
FastlaneCore::ConfigItem.new(key: :value,
|
76
|
+
description: "The property value",
|
77
|
+
type: String)
|
78
|
+
]
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.description
|
82
|
+
"Set the value of your project"
|
83
|
+
end
|
84
|
+
|
85
|
+
def self.details
|
86
|
+
[
|
87
|
+
"This action will set the value directly in build.gradle . "
|
88
|
+
].join("\n")
|
89
|
+
end
|
90
|
+
|
91
|
+
def self.authors
|
92
|
+
["Manabu OHTAKE"]
|
93
|
+
end
|
94
|
+
|
95
|
+
def self.is_supported?(platform)
|
96
|
+
platform == :android
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
metadata
ADDED
@@ -0,0 +1,136 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-android_versioning_plus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Egor Dmitriev
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-11-29 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: rake
|
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: rubocop
|
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: fastlane
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.17.0
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 2.17.0
|
97
|
+
description:
|
98
|
+
email: egordmitriev2@gmail.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- LICENSE
|
104
|
+
- README.md
|
105
|
+
- lib/fastlane/plugin/android_versioning.rb
|
106
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/get_value_from_build.rb
|
107
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/get_version_code.rb
|
108
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/get_version_name.rb
|
109
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/increment_version_code.rb
|
110
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/increment_version_name.rb
|
111
|
+
- lib/fastlane/plugin/android_versioning_plus/actions/set_value_in_build.rb
|
112
|
+
- lib/fastlane/plugin/android_versioning_plus/version.rb
|
113
|
+
homepage: https://github.com/OMed-Health/fastlane-plugin-android_versioning_plus
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubygems_version: 3.2.29
|
133
|
+
signing_key:
|
134
|
+
specification_version: 4
|
135
|
+
summary: Allows to set/get app version name and version code directly to/from build.gradle
|
136
|
+
test_files: []
|