fastlane-plugin-versioning_android 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 +56 -0
- data/lib/fastlane/plugin/versioning_android.rb +16 -0
- data/lib/fastlane/plugin/versioning_android/actions/android_get_version_code.rb +70 -0
- data/lib/fastlane/plugin/versioning_android/actions/android_get_version_name.rb +70 -0
- data/lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb +88 -0
- data/lib/fastlane/plugin/versioning_android/actions/android_set_version_name.rb +90 -0
- data/lib/fastlane/plugin/versioning_android/helper/versioning_android_helper.rb +93 -0
- data/lib/fastlane/plugin/versioning_android/version.rb +5 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 15bae969f46be3a8a3e83bd25718d261ab19fdbf
|
4
|
+
data.tar.gz: 4c8ded404085de387760b4aaf047f57509965b44
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 000f1388360a17d8f631cca27e65a9e112967e3b9270ca96a1ae52cdd5f1c2bfb6d2c7315d675a635e607cb0ca36c962d97af49d9e07578535b77e6a7a007887
|
7
|
+
data.tar.gz: 3a40ecde89768df83e6cc141b57962784f16375812ad3a968d4aba452b40795fcdf70fbd86c31f14a9f295c80f0e9a3412c099571bbd356a842d8235a5e132ed
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Igor Lamos <igor@be.plus>
|
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,56 @@
|
|
1
|
+
# versioning_android plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-versioning_android)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-versioning_android`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin versioning_android
|
11
|
+
```
|
12
|
+
|
13
|
+
## About versioning_android
|
14
|
+
|
15
|
+
Android Versioning Plugin for Fastlane
|
16
|
+
|
17
|
+
### Available actions
|
18
|
+
- `android_get_version_code` to get the Version Code
|
19
|
+
- `android_get_version_name` to get the Version Name
|
20
|
+
- `android_set_version_code` to set the new Version Code
|
21
|
+
- `android_set_version_name` to set the new Version Name
|
22
|
+
|
23
|
+
## Example
|
24
|
+
|
25
|
+
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`.
|
26
|
+
|
27
|
+
You can find a fully functional setup of this plugin in the [UdemyFastlane](https://github.com/igorlamos/udemy-fastlane) repo, where you can also find more info about versioning of Android apps.
|
28
|
+
|
29
|
+
## Run tests for this plugin
|
30
|
+
|
31
|
+
To run both the tests, and code style validation, run
|
32
|
+
|
33
|
+
```
|
34
|
+
rake
|
35
|
+
```
|
36
|
+
|
37
|
+
To automatically fix many of the styling issues, use
|
38
|
+
```
|
39
|
+
rubocop -a
|
40
|
+
```
|
41
|
+
|
42
|
+
## Issues and Feedback
|
43
|
+
|
44
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
45
|
+
|
46
|
+
## Troubleshooting
|
47
|
+
|
48
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
49
|
+
|
50
|
+
## Using _fastlane_ Plugins
|
51
|
+
|
52
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
53
|
+
|
54
|
+
## About _fastlane_
|
55
|
+
|
56
|
+
_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/versioning_android/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module VersioningAndroid
|
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::VersioningAndroid.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
ANDROID_VERSION_CODE = :ANDROID_VERSION_CODE
|
5
|
+
end
|
6
|
+
|
7
|
+
class AndroidGetVersionCodeAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
gradle_file_path = Helper::VersioningAndroidHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
version_code = Helper::VersioningAndroidHelper.read_key_from_gradle_file(gradle_file_path, "versionCode")
|
11
|
+
|
12
|
+
if version_code == false
|
13
|
+
UI.user_error!("Unable to find the versionCode in build.gradle file at #{gradle_file_path}.")
|
14
|
+
end
|
15
|
+
|
16
|
+
UI.success("👍 Current Android Version Code is: #{version_code}")
|
17
|
+
|
18
|
+
# Store the Version Code in the shared hash
|
19
|
+
Actions.lane_context[SharedValues::ANDROID_VERSION_CODE] = version_code
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.description
|
23
|
+
"Get the Version Code of your Android project"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.details
|
27
|
+
"This action will return current Version Code of your Android project."
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.available_options
|
31
|
+
[
|
32
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
33
|
+
env_name: "FL_ANDROID_GET_VERSION_CODE_GRADLE_FILE",
|
34
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
35
|
+
optional: true,
|
36
|
+
type: String,
|
37
|
+
default_value: "app/build.gradle",
|
38
|
+
verify_block: proc do |value|
|
39
|
+
UI.user_error!("Could not find app build.gradle file") unless File.exist?(value) || Helper.test?
|
40
|
+
end)
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.output
|
45
|
+
[
|
46
|
+
['ANDROID_VERSION_CODE', 'The Version Code of your Android project']
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.return_value
|
51
|
+
"The Version Code of your Android project"
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.authors
|
55
|
+
["Igor Lamoš"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.is_supported?(platform)
|
59
|
+
[:android].include?(platform)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.example_code
|
63
|
+
[
|
64
|
+
'version_code = android_get_version_code # build.gradle is in the default location',
|
65
|
+
'version_code = android_get_version_code(gradle_file: "/path/to/build.gradle")'
|
66
|
+
]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Actions
|
3
|
+
module SharedValues
|
4
|
+
ANDROID_VERSION_NAME = :ANDROID_VERSION_NAME
|
5
|
+
end
|
6
|
+
|
7
|
+
class AndroidGetVersionNameAction < Action
|
8
|
+
def self.run(params)
|
9
|
+
gradle_file_path = Helper::VersioningAndroidHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
version_name = Helper::VersioningAndroidHelper.read_key_from_gradle_file(gradle_file_path, "versionName")
|
11
|
+
|
12
|
+
if version_name == false
|
13
|
+
UI.user_error!("Unable to find the versionName in build.gradle file at #{gradle_file_path}.")
|
14
|
+
end
|
15
|
+
|
16
|
+
UI.success("👍 Current Android Version Name is: #{version_name}")
|
17
|
+
|
18
|
+
# Store the Version Name in the shared hash
|
19
|
+
Actions.lane_context[SharedValues::ANDROID_VERSION_NAME] = version_name
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.description
|
23
|
+
"Get the Version Name of your Android project"
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.details
|
27
|
+
"This action will return current Version Name of your Android project."
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.available_options
|
31
|
+
[
|
32
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
33
|
+
env_name: "FL_ANDROID_GET_VERSION_NAME_GRADLE_FILE",
|
34
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
35
|
+
optional: true,
|
36
|
+
type: String,
|
37
|
+
default_value: "app/build.gradle",
|
38
|
+
verify_block: proc do |value|
|
39
|
+
UI.user_error!("Could not find app build.gradle file") unless File.exist?(value) || Helper.test?
|
40
|
+
end)
|
41
|
+
]
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.output
|
45
|
+
[
|
46
|
+
['ANDROID_VERSION_NAME', 'The Version Name of your Android project']
|
47
|
+
]
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.return_value
|
51
|
+
"The Version Name of your Android project"
|
52
|
+
end
|
53
|
+
|
54
|
+
def self.authors
|
55
|
+
["Igor Lamoš"]
|
56
|
+
end
|
57
|
+
|
58
|
+
def self.is_supported?(platform)
|
59
|
+
[:android].include?(platform)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.example_code
|
63
|
+
[
|
64
|
+
'version_name = android_get_version_name # build.gradle is in the default location',
|
65
|
+
'version_name = android_get_version_name(gradle_file: "/path/to/build.gradle")'
|
66
|
+
]
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,88 @@
|
|
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::VersioningAndroidHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
new_version_code = Helper::VersioningAndroidHelper.get_new_version_code(gradle_file_path, params[:version_code])
|
11
|
+
|
12
|
+
saved = Helper::VersioningAndroidHelper.save_key_to_gradle_file(gradle_file_path, "versionCode", new_version_code)
|
13
|
+
|
14
|
+
if saved == -1
|
15
|
+
UI.user_error!("Unable to set the Version Code in build.gradle file at #{gradle_file_path}.")
|
16
|
+
end
|
17
|
+
|
18
|
+
UI.success("☝️ Android Version Code has been set to: #{new_version_code}")
|
19
|
+
|
20
|
+
# Store the Version Code in the shared hash
|
21
|
+
Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_CODE] = new_version_code
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.description
|
25
|
+
"Set the Version Code of your Android project"
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.details
|
29
|
+
[
|
30
|
+
"This action will set the new Version Code on your Android project.",
|
31
|
+
"Without specifying new Version Code, current one will be incremented"
|
32
|
+
].join(' ')
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.available_options
|
36
|
+
[
|
37
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
38
|
+
env_name: "FL_ANDROID_SET_VERSION_CODE_GRADLE_FILE",
|
39
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
40
|
+
optional: true,
|
41
|
+
type: String,
|
42
|
+
default_value: "app/build.gradle",
|
43
|
+
verify_block: proc do |value|
|
44
|
+
UI.user_error!("Could not find app build.gradle file") unless File.exist?(value) || Helper.test?
|
45
|
+
end),
|
46
|
+
FastlaneCore::ConfigItem.new(key: :version_code,
|
47
|
+
env_name: "FL_ANDROID_SET_VERSION_CODE_VERSION_CODE",
|
48
|
+
description: "(optional) Set specific Version Code",
|
49
|
+
optional: true,
|
50
|
+
type: Integer,
|
51
|
+
default_value: nil)
|
52
|
+
]
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.output
|
56
|
+
[
|
57
|
+
['ANDROID_NEW_VERSION_CODE', 'The new Version Code of your Android project']
|
58
|
+
]
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.return_value
|
62
|
+
"The new Version Code of your Android project"
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.authors
|
66
|
+
["Igor Lamoš"]
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.is_supported?(platform)
|
70
|
+
[:android].include? platform
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.example_code
|
74
|
+
[
|
75
|
+
'android_set_version_code # Automatically increment by one',
|
76
|
+
'android_set_version_code(
|
77
|
+
version_code: "17" # Set a specific number
|
78
|
+
)',
|
79
|
+
'android_set_version_code(
|
80
|
+
version_code: "17",
|
81
|
+
gradle_file: "/path/to/build.gradle" # build.gradle is not in the default location
|
82
|
+
)',
|
83
|
+
'version_code = android_set_version_code # Save returned Version Code to a variable'
|
84
|
+
]
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -0,0 +1,90 @@
|
|
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::VersioningAndroidHelper.get_gradle_file_path(params[:gradle_file])
|
10
|
+
new_version_name = Helper::VersioningAndroidHelper.get_new_version_name(gradle_file_path, params[:version_name])
|
11
|
+
# bump_type ||= params[:bump_type]
|
12
|
+
|
13
|
+
saved = Helper::VersioningAndroidHelper.save_key_to_gradle_file(gradle_file_path, "versionName", new_version_name)
|
14
|
+
|
15
|
+
if saved == -1
|
16
|
+
UI.user_error!("Unable to set the Version Name in build.gradle file at #{gradle_file_path}.")
|
17
|
+
end
|
18
|
+
|
19
|
+
UI.success("☝️ Android Version Name has been set to: #{new_version_name}")
|
20
|
+
|
21
|
+
# Store the versionName in the shared hash
|
22
|
+
Actions.lane_context[SharedValues::ANDROID_NEW_VERSION_NAME] = new_version_name
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.description
|
26
|
+
"Set the Version Name of your Android project"
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.details
|
30
|
+
"This action will set the new Version Name on your Android project."
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.available_options
|
34
|
+
[
|
35
|
+
FastlaneCore::ConfigItem.new(key: :gradle_file,
|
36
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_GRADLE_FILE",
|
37
|
+
description: "(optional) Specify the path to your app build.gradle if it isn't in the default location",
|
38
|
+
optional: true,
|
39
|
+
type: String,
|
40
|
+
default_value: "app/build.gradle",
|
41
|
+
verify_block: proc do |value|
|
42
|
+
UI.user_error!("Could not find app build.gradle file") unless File.exist?(value) || Helper.test?
|
43
|
+
end),
|
44
|
+
FastlaneCore::ConfigItem.new(key: :version_name,
|
45
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_VERSION_NAME",
|
46
|
+
description: "(optional) Set specific Version Name",
|
47
|
+
optional: true,
|
48
|
+
type: String,
|
49
|
+
default_value: nil),
|
50
|
+
FastlaneCore::ConfigItem.new(key: :bump_type,
|
51
|
+
env_name: "FL_ANDROID_SET_VERSION_NAME_BUMP_TYPE",
|
52
|
+
description: "(optional) Type of version bump (major, minor, patch)",
|
53
|
+
optional: true,
|
54
|
+
type: String,
|
55
|
+
default_value: nil)
|
56
|
+
]
|
57
|
+
end
|
58
|
+
|
59
|
+
def self.output
|
60
|
+
[
|
61
|
+
['ANDROID_NEW_VERSION_NAME', 'The new Version Name of your Android project']
|
62
|
+
]
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.return_value
|
66
|
+
"The new Version Name of your Android project"
|
67
|
+
end
|
68
|
+
|
69
|
+
def self.authors
|
70
|
+
["Igor Lamoš"]
|
71
|
+
end
|
72
|
+
|
73
|
+
def self.is_supported?(platform)
|
74
|
+
[:android].include? platform
|
75
|
+
end
|
76
|
+
|
77
|
+
def self.example_code
|
78
|
+
[
|
79
|
+
'android_set_version_name(
|
80
|
+
version_name: "2.34.5" # Set a specific number
|
81
|
+
)',
|
82
|
+
'android_set_version_name(
|
83
|
+
version_name: "2.34.5",
|
84
|
+
gradle_file: "/path/to/build.gradle" # build.gradle is not in the default location
|
85
|
+
)'
|
86
|
+
]
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
module Fastlane
|
2
|
+
module Helper
|
3
|
+
class VersioningAndroidHelper
|
4
|
+
require "shellwords"
|
5
|
+
require "tempfile"
|
6
|
+
require "fileutils"
|
7
|
+
|
8
|
+
GRADLE_FILE_TEST = "/tmp/fastlane/tests/versioning/app/build.gradle"
|
9
|
+
|
10
|
+
def self.get_gradle_file(gradle_file)
|
11
|
+
return Helper.test? ? GRADLE_FILE_TEST : gradle_file
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.get_gradle_file_path(gradle_file)
|
15
|
+
gradle_file = self.get_gradle_file(gradle_file)
|
16
|
+
return File.expand_path(gradle_file).shellescape
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.get_new_version_code(gradle_file, new_version_code)
|
20
|
+
if new_version_code.nil?
|
21
|
+
current_version_code = self.read_key_from_gradle_file(gradle_file, "versionCode")
|
22
|
+
new_version_code = current_version_code.to_i + 1
|
23
|
+
end
|
24
|
+
|
25
|
+
return new_version_code.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.get_new_version_name(gradle_file, new_version_name, bump_type = nil)
|
29
|
+
if new_version_name.nil?
|
30
|
+
current_version_name = self.read_key_from_gradle_file(gradle_file, "versionName")
|
31
|
+
current_version_parts = current_version_name.split(/[.]/)
|
32
|
+
|
33
|
+
major = current_version_parts[0].to_i
|
34
|
+
minor = current_version_parts[1].to_i
|
35
|
+
patch = current_version_parts[2].to_i
|
36
|
+
|
37
|
+
if bump_type == "major"
|
38
|
+
new_version_name = "#{major + 1}.0.0"
|
39
|
+
elsif bump_type == "minor"
|
40
|
+
new_version_name = "#{major}.#{minor + 1}.0"
|
41
|
+
elsif bump_type == "patch"
|
42
|
+
new_version_name = "#{major}.#{minor}.#{patch + 1}"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
return new_version_name.to_s
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.read_key_from_gradle_file(gradle_file, key)
|
50
|
+
value = false
|
51
|
+
begin
|
52
|
+
file = File.new(gradle_file, "r")
|
53
|
+
while (line = file.gets)
|
54
|
+
next unless line.include? key
|
55
|
+
components = line.strip.split(' ')
|
56
|
+
value = components[components.length - 1].tr("\"", "")
|
57
|
+
break
|
58
|
+
end
|
59
|
+
file.close
|
60
|
+
rescue => err
|
61
|
+
UI.error("An exception occured while reading gradle file: #{err}")
|
62
|
+
err
|
63
|
+
end
|
64
|
+
return value
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.save_key_to_gradle_file(gradle_file, key, value)
|
68
|
+
current_value = self.read_key_from_gradle_file(gradle_file, key)
|
69
|
+
|
70
|
+
begin
|
71
|
+
found = false
|
72
|
+
temp_file = Tempfile.new("flSave_#{key}_ToGradleFile")
|
73
|
+
File.open(gradle_file, "r") do |file|
|
74
|
+
file.each_line do |line|
|
75
|
+
if line.include? key and found == false
|
76
|
+
found = true
|
77
|
+
line.replace line.sub(current_value.to_s, value.to_s)
|
78
|
+
end
|
79
|
+
temp_file.puts line
|
80
|
+
end
|
81
|
+
file.close
|
82
|
+
end
|
83
|
+
temp_file.rewind
|
84
|
+
temp_file.close
|
85
|
+
FileUtils.mv(temp_file.path, gradle_file)
|
86
|
+
temp_file.unlink
|
87
|
+
end
|
88
|
+
|
89
|
+
return found == true ? value : -1
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
metadata
ADDED
@@ -0,0 +1,164 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-versioning_android
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Igor Lamos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-21 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: simplecov
|
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: fastlane
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.66.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.66.0
|
125
|
+
description:
|
126
|
+
email: igor@be.plus
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- LICENSE
|
132
|
+
- README.md
|
133
|
+
- lib/fastlane/plugin/versioning_android.rb
|
134
|
+
- lib/fastlane/plugin/versioning_android/actions/android_get_version_code.rb
|
135
|
+
- lib/fastlane/plugin/versioning_android/actions/android_get_version_name.rb
|
136
|
+
- lib/fastlane/plugin/versioning_android/actions/android_set_version_code.rb
|
137
|
+
- lib/fastlane/plugin/versioning_android/actions/android_set_version_name.rb
|
138
|
+
- lib/fastlane/plugin/versioning_android/helper/versioning_android_helper.rb
|
139
|
+
- lib/fastlane/plugin/versioning_android/version.rb
|
140
|
+
homepage: https://github.com/beplus/fastlane-plugin-versioning_android
|
141
|
+
licenses:
|
142
|
+
- MIT
|
143
|
+
metadata: {}
|
144
|
+
post_install_message:
|
145
|
+
rdoc_options: []
|
146
|
+
require_paths:
|
147
|
+
- lib
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
158
|
+
requirements: []
|
159
|
+
rubyforge_project:
|
160
|
+
rubygems_version: 2.6.13
|
161
|
+
signing_key:
|
162
|
+
specification_version: 4
|
163
|
+
summary: Android Versioning Plugin for Fastlane
|
164
|
+
test_files: []
|