fastlane-plugin-generic_version 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: ee921cc9c81bf5301caa413e13db260e1544456dafa1415e1dac6d4d727d911f
4
+ data.tar.gz: e74ee2fe21e39f0d791f06762c689cc8caf2da3b7aad25aefcaf2bf133a4f953
5
+ SHA512:
6
+ metadata.gz: c990246f983be4e4233014668107a43508dda88e4da464932c14ac0b11ce078ba1089912b8d88d41a116c3bd8f194fbffd6804d3e1b7b5e3b2e0db7d60d3291b
7
+ data.tar.gz: f23ae61789f3e65593fde6b2b41eb69da1c292731143217b7447d691ae2f0c2bf4bddcd041e0cd822892712b12fdbaeef66ff76975006a9c16d9892b66587dc4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Felix Rudat <frudat@doegel.de>
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
+ # generic_version plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-generic_version)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-generic_version`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin generic_version
11
+ ```
12
+
13
+ ## About generic_version
14
+
15
+ Manage your app version for Android and iOS
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,63 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane/action'
3
+ require_relative '../helper/generic_version_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class GenericVersionAction < Action
8
+ def self.run(params)
9
+ version = Helper::GenericVersionHelper.strip_tags(params[:version])
10
+ build = Helper::GenericVersionHelper.strip_tags(params[:build])
11
+
12
+ new_version = other_action.set_app_version(
13
+ version: version,
14
+ )
15
+
16
+ new_build = other_action.set_app_build(
17
+ build: build
18
+ )
19
+
20
+ UI.important "New version is:"
21
+ UI.message " Version: #{new_version}"
22
+ UI.message " Build: #{new_build}"
23
+
24
+ version
25
+ end
26
+
27
+ def self.description
28
+ "Manage your app version for Android and iOS"
29
+ end
30
+
31
+ def self.authors
32
+ ["Felix Rudat"]
33
+ end
34
+
35
+ def self.return_value
36
+ "Whenever a specific version was set it will be returned, nil otherwise."
37
+ end
38
+
39
+ def self.details
40
+ "With this plugin you have a unified way to manage your cross platform app version. Also it delivers some handy tools."
41
+ end
42
+
43
+ def self.available_options
44
+ [
45
+ FastlaneCore::ConfigItem.new(key: :version,
46
+ env_name: "GENERIC_VERSION_SET_APP_VERSION",
47
+ description: "App version",
48
+ optional: true,
49
+ type: String),
50
+ FastlaneCore::ConfigItem.new(key: :build,
51
+ env_name: "GENERIC_VERSION_SET_APP_BUILD",
52
+ description: "App build",
53
+ optional: true,
54
+ type: String)
55
+ ]
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ true
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,50 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane/action'
3
+ require_relative '../helper/generic_version_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class GetAppBuildAction < Action
8
+ def self.run(params)
9
+ platform = other_action.lane_context[SharedValues::PLATFORM_NAME]
10
+ build = nil
11
+
12
+ if platform == :android
13
+ # android
14
+ Helper::GenericVersionHelper.load_dependencies
15
+
16
+ build = other_action.android_get_version_code
17
+ else
18
+ # ios or osx
19
+ build = other_action.get_build_number
20
+ end
21
+
22
+ build
23
+ end
24
+
25
+ def self.description
26
+ "Manage your app build for Android and iOS"
27
+ end
28
+
29
+ def self.authors
30
+ ["Felix Rudat"]
31
+ end
32
+
33
+ def self.return_value
34
+ "The current app build"
35
+ end
36
+
37
+ def self.details
38
+ "With this plugin you have a unified way to manage your cross platform app build."
39
+ end
40
+
41
+ def self.available_options
42
+ []
43
+ end
44
+
45
+ def self.is_supported?(platform)
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,50 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane/action'
3
+ require_relative '../helper/generic_version_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class GetAppVersionAction < Action
8
+ def self.run(params)
9
+ platform = other_action.lane_context[SharedValues::PLATFORM_NAME]
10
+ version = nil
11
+
12
+ if platform == :android
13
+ # android
14
+ Helper::GenericVersionHelper.load_dependencies
15
+
16
+ version = other_action.android_get_version_name
17
+ else
18
+ # ios or osx
19
+ version = other_action.get_version_number
20
+ end
21
+
22
+ version
23
+ end
24
+
25
+ def self.description
26
+ "Manage your app version for Android and iOS"
27
+ end
28
+
29
+ def self.authors
30
+ ["Felix Rudat"]
31
+ end
32
+
33
+ def self.return_value
34
+ "The current app version"
35
+ end
36
+
37
+ def self.details
38
+ "With this plugin you have a unified way to manage your cross platform app version."
39
+ end
40
+
41
+ def self.available_options
42
+ []
43
+ end
44
+
45
+ def self.is_supported?(platform)
46
+ true
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,65 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane/action'
3
+ require_relative '../helper/generic_version_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class SetAppBuildAction < Action
8
+ def self.run(params)
9
+ platform = other_action.lane_context[SharedValues::PLATFORM_NAME]
10
+ build = params[:build]
11
+
12
+ unless build
13
+ # just a notification
14
+ UI.important("No specific build was given. The current build will be incremented.")
15
+ end
16
+
17
+ if platform == :android
18
+ # android
19
+ Helper::GenericVersionHelper.load_dependencies
20
+
21
+ build = other_action.android_set_version_code(
22
+ version_code: build,
23
+ )
24
+ else
25
+ # ios or osx
26
+ build = other_action.increment_build_number(
27
+ build_number: build,
28
+ )
29
+ end
30
+
31
+ build
32
+ end
33
+
34
+ def self.description
35
+ "Manage your app build for Android and iOS"
36
+ end
37
+
38
+ def self.authors
39
+ ["Felix Rudat"]
40
+ end
41
+
42
+ def self.return_value
43
+ "The new app build"
44
+ end
45
+
46
+ def self.details
47
+ "With this plugin you have a unified way to manage your cross platform app build."
48
+ end
49
+
50
+ def self.available_options
51
+ [
52
+ FastlaneCore::ConfigItem.new(key: :build,
53
+ env_name: "APP_BUILD",
54
+ description: "Build",
55
+ optional: true,
56
+ type: String)
57
+ ]
58
+ end
59
+
60
+ def self.is_supported?(platform)
61
+ true
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,68 @@
1
+ require 'fastlane/action'
2
+ require 'fastlane/action'
3
+ require_relative '../helper/generic_version_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class SetAppVersionAction < Action
8
+ def self.run(params)
9
+ platform = other_action.lane_context[SharedValues::PLATFORM_NAME]
10
+ version = params[:version]
11
+
12
+ unless version
13
+ UI.important("No specific version was given. The current version will be incremented.")
14
+
15
+ # increment current version number
16
+ current_version = Helper::GenericVersionHelper.sanitize_version(other_action.get_app_version)
17
+ version = Helper::GenericVersionHelper.bump_version(current_version)
18
+ end
19
+
20
+ if platform == :android
21
+ # android
22
+ Helper::GenericVersionHelper.load_dependencies
23
+
24
+ version = other_action.android_set_version_name(
25
+ version_name: version,
26
+ )
27
+ else
28
+ # ios or osx
29
+ version = other_action.increment_version_number(
30
+ version_number: version,
31
+ )
32
+ end
33
+
34
+ version
35
+ end
36
+
37
+ def self.description
38
+ "Manage your app version for Android and iOS"
39
+ end
40
+
41
+ def self.authors
42
+ ["Felix Rudat"]
43
+ end
44
+
45
+ def self.return_value
46
+ "The new app version"
47
+ end
48
+
49
+ def self.details
50
+ "With this plugin you have a unified way to manage your cross platform app version."
51
+ end
52
+
53
+ def self.available_options
54
+ [
55
+ FastlaneCore::ConfigItem.new(key: :version,
56
+ env_name: "APP_VERSION",
57
+ description: "Version",
58
+ optional: true,
59
+ type: String),
60
+ ]
61
+ end
62
+
63
+ def self.is_supported?(platform)
64
+ true
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,51 @@
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 GenericVersionHelper
8
+ def self.strip_tags(version)
9
+ # strip tags with regex
10
+ version = version&.sub(/^\D+/, '')
11
+
12
+ if version&.strip&.empty?
13
+ # nil an empty string
14
+ version = nil
15
+ end
16
+
17
+ version
18
+ end
19
+
20
+ def self.sanitize_version(version)
21
+ if version&.strip&.empty?
22
+ version = '0.0.0' # default version
23
+ end
24
+
25
+ version
26
+ end
27
+
28
+ def self.bump_version(current_version)
29
+ # since auto incrementing the version is inconsistent between
30
+ # increment_version_number() and android_set_version_name()
31
+ # we implement our own version bumping here
32
+ version_array = current_version.split(".").map(&:to_i)
33
+ version_array[-1] = version_array[-1] + 1
34
+ next_version_number = version_array.join(".")
35
+
36
+ next_version_number
37
+ end
38
+
39
+ def self.load_dependencies
40
+ # this is a hack to install missing plugins in the host project
41
+ # better solution for @link https://github.com/fastlane/fastlane/issues/16650
42
+ plugin_name = 'fastlane-plugin-versioning_android'
43
+
44
+ unless Fastlane.plugin_manager.plugin_is_added_as_dependency?(plugin_name)
45
+ Fastlane.plugin_manager.add_dependency(plugin_name)
46
+ Fastlane.plugin_manager.load_plugins
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module GenericVersion
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/generic_version/version'
2
+
3
+ module Fastlane
4
+ module GenericVersion
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::GenericVersion.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,206 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-generic_version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Felix Rudat
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-05-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fastlane-plugin-versioning_android
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.1.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.1.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: fastlane
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.205.2
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 2.205.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
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: rspec
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: rspec_junit_formatter
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: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - '='
116
+ - !ruby/object:Gem::Version
117
+ version: 1.12.1
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - '='
123
+ - !ruby/object:Gem::Version
124
+ version: 1.12.1
125
+ - !ruby/object:Gem::Dependency
126
+ name: rubocop-performance
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: rubocop-require_tools
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: simplecov
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description:
168
+ email: frudat@doegel.de
169
+ executables: []
170
+ extensions: []
171
+ extra_rdoc_files: []
172
+ files:
173
+ - LICENSE
174
+ - README.md
175
+ - lib/fastlane/plugin/generic_version.rb
176
+ - lib/fastlane/plugin/generic_version/actions/generic_version_action.rb
177
+ - lib/fastlane/plugin/generic_version/actions/get_app_build_action.rb
178
+ - lib/fastlane/plugin/generic_version/actions/get_app_version_action.rb
179
+ - lib/fastlane/plugin/generic_version/actions/set_app_build_action.rb
180
+ - lib/fastlane/plugin/generic_version/actions/set_app_version_action.rb
181
+ - lib/fastlane/plugin/generic_version/helper/generic_version_helper.rb
182
+ - lib/fastlane/plugin/generic_version/version.rb
183
+ homepage: https://github.com/voydz/fastlane-plugin-generic_version
184
+ licenses:
185
+ - MIT
186
+ metadata: {}
187
+ post_install_message:
188
+ rdoc_options: []
189
+ require_paths:
190
+ - lib
191
+ required_ruby_version: !ruby/object:Gem::Requirement
192
+ requirements:
193
+ - - ">="
194
+ - !ruby/object:Gem::Version
195
+ version: '2.5'
196
+ required_rubygems_version: !ruby/object:Gem::Requirement
197
+ requirements:
198
+ - - ">="
199
+ - !ruby/object:Gem::Version
200
+ version: '0'
201
+ requirements: []
202
+ rubygems_version: 3.2.33
203
+ signing_key:
204
+ specification_version: 4
205
+ summary: Manage your app version for Android and iOS
206
+ test_files: []