checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 41e1fcbc676fede7d89674400c2a137287c8e2b2
4
+ data.tar.gz: 41aa0af6925ac7f043f419479483ab1631305b9e
5
+ SHA512:
6
+ metadata.gz: df69fdc24d01d4b5782e563ab50c7c1bb2b0df49cf3645d2fb2eadd7e3632bc1f7e4bdf16066cfdcf1d796784221f823ea4aff656fa5883b4ad9df998d0f75ed
7
+ data.tar.gz: 653f6ceb0e8b15fc45c6c1fa56eb7f21312234cd2eb9b0da1d4c4e51d7894844dbbd27c6a187b7fd94181a6fe2cbed11b6f19df4a021e26cf208a1f0c13b5fb0
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Pavlo Pakholka <pavlo.pakholka@bolt.eu>
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,68 @@
1
+ # properties plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-properties)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-properties`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin properties
11
+ ```
12
+
13
+ ## About properties
14
+
15
+ Adds 2 actions to fastlane to read and update properties files.
16
+ Adds 2 more actions to increase versionCode and versionName fast.
17
+
18
+ ## Example
19
+
20
+ ```ruby
21
+ lane :test do
22
+
23
+ # Read VERSION_NAME value from Configs/versions.properties
24
+ version_name = get_properties_value(
25
+ key: "VERSION_NAME",
26
+ path: "./Configs/versions.properties"
27
+ )
28
+
29
+ # Set VERSION_NAME value to '0.2.0' in Configs/versions.properties
30
+ # VERSION_NAME will be added if it doesn't exist
31
+ set_properties_value(
32
+ path: "./Configs/versions.properties",
33
+ name: "VERSION_NAME",
34
+ value: "0.2.0"
35
+ )
36
+
37
+ # Increase VERSION_CODE value in Configs/versions.properties by 1
38
+ increment_version_code_in_properties_file(
39
+ key: "VERSION_CODE",
40
+ path: "./Configs/versions.properties"
41
+ )
42
+
43
+ # Increase VERSION_NAME's minor value in Configs/versions.properties by 1
44
+ # update_type can be one of ['major', 'minor', 'patch']. Default to 'minor'
45
+ increment_version_name_in_properties_file(
46
+ key: "VERSION_NAME",
47
+ path: "./Configs/versions.properties",
48
+ update_type: "minor"
49
+ )
50
+
51
+ end
52
+ ```
53
+
54
+ ## Issues and Feedback
55
+
56
+ For any other issues and feedback about this plugin, please submit it to this repository.
57
+
58
+ ## Troubleshooting
59
+
60
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
61
+
62
+ ## Using _fastlane_ Plugins
63
+
64
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
65
+
66
+ ## About _fastlane_
67
+
68
+ _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).
data/lib/fastlane/plugin/properties.rb ADDED
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/properties/version'
2
+
3
+ module Fastlane
4
+ module Properties
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::Properties.all_classes.each do |current|
15
+ require current
16
+ end
data/lib/fastlane/plugin/properties/actions/get_properties_value.rb ADDED
@@ -0,0 +1,57 @@
1
+ require 'fastlane/action'
2
+ require 'java-properties'
3
+ require_relative '../helper/properties_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class GetPropertiesValueAction < Action
8
+ def self.run(params)
9
+ content = JavaProperties.load(params[:path])
10
+ return content[params[:key].to_sym]
11
+ end
12
+
13
+ def self.description
14
+ "Reads a value of a setting from .properties file."
15
+ end
16
+
17
+ def self.authors
18
+ ["Pavlo Pakholka"]
19
+ end
20
+
21
+ def self.return_value
22
+ 'Value of a setting.'
23
+ end
24
+
25
+ def self.details
26
+ # Optional:
27
+ ""
28
+ end
29
+
30
+ def self.available_options
31
+ [
32
+ FastlaneCore::ConfigItem.new(key: :key,
33
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
34
+ description: "Key of properie in .properties file",
35
+ optional: false,
36
+ type: String),
37
+ FastlaneCore::ConfigItem.new(key: :path,
38
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
39
+ description: "Path to .properies file you want to update",
40
+ type: String,
41
+ optional: false,
42
+ verify_block: proc do |value|
43
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
44
+ end)
45
+ ]
46
+ end
47
+
48
+ def self.is_supported?(platform)
49
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
50
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
51
+ #
52
+ # [:ios, :mac, :android].include?(platform)
53
+ true
54
+ end
55
+ end
56
+ end
57
+ end
data/lib/fastlane/plugin/properties/actions/increment_version_code_in_properties_file.rb ADDED
@@ -0,0 +1,60 @@
1
+ require 'fastlane/action'
2
+ require 'java-properties'
3
+ require_relative '../helper/properties_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class IncrementVersionCodeInPropertiesFileAction < Action
8
+ def self.run(params)
9
+ content = JavaProperties.load(params[:path])
10
+ value = content[params[:key].to_sym].to_i + 1
11
+ content[params[:key].to_sym] = value
12
+ JavaProperties.write(content, params[:path])
13
+ return value
14
+ end
15
+
16
+ def self.description
17
+ "Increase version code inside .properties file."
18
+ end
19
+
20
+ def self.authors
21
+ ["Pavlo Pakholka"]
22
+ end
23
+
24
+ def self.return_value
25
+ "New version code."
26
+ end
27
+
28
+ def self.details
29
+ # Optional:
30
+ ""
31
+ end
32
+
33
+ def self.available_options
34
+ [
35
+ FastlaneCore::ConfigItem.new(key: :key,
36
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
37
+ description: "Key of properie in .properties file",
38
+ optional: false,
39
+ type: String),
40
+ FastlaneCore::ConfigItem.new(key: :path,
41
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
42
+ description: "Path to .properies file you want to update",
43
+ type: String,
44
+ optional: false,
45
+ verify_block: proc do |value|
46
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
47
+ end)
48
+ ]
49
+ end
50
+
51
+ def self.is_supported?(platform)
52
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
53
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
54
+ #
55
+ # [:ios, :mac, :android].include?(platform)
56
+ true
57
+ end
58
+ end
59
+ end
60
+ end
data/lib/fastlane/plugin/properties/actions/increment_version_name_in_properties_file.rb ADDED
@@ -0,0 +1,66 @@
1
+ require 'fastlane/action'
2
+ require 'java-properties'
3
+ require_relative '../helper/properties_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class IncrementVersionNameInPropertiesFileAction < Action
8
+ def self.run(params)
9
+ content = JavaProperties.load(params[:path])
10
+ value = content[params[:key].to_sym]
11
+ new_value = Helper::PropertiesHelper.update_semver_version(params[:update_type], value)
12
+ content[params[:key].to_sym] = new_value
13
+ JavaProperties.write(content, params[:path])
14
+ return new_value
15
+ end
16
+
17
+ def self.description
18
+ "Sets a value of a setting in .properties file."
19
+ end
20
+
21
+ def self.authors
22
+ ["Pavlo Pakholka"]
23
+ end
24
+
25
+ def self.return_value
26
+ "New version name."
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ ""
32
+ end
33
+
34
+ def self.available_options
35
+ [
36
+ FastlaneCore::ConfigItem.new(key: :key,
37
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
38
+ description: "Key of properie in .properties file",
39
+ optional: false,
40
+ type: String),
41
+ FastlaneCore::ConfigItem.new(key: :path,
42
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
43
+ description: "Path to .properies file you want to update",
44
+ type: String,
45
+ optional: false,
46
+ verify_block: proc do |value|
47
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
48
+ end),
49
+ FastlaneCore::ConfigItem.new(key: :update_type,
50
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
51
+ description: "Key of properie in .properties file",
52
+ optional: true,
53
+ type: String)
54
+ ]
55
+ end
56
+
57
+ def self.is_supported?(platform)
58
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
59
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
60
+ #
61
+ # [:ios, :mac, :android].include?(platform)
62
+ true
63
+ end
64
+ end
65
+ end
66
+ end
data/lib/fastlane/plugin/properties/actions/set_properties_value.rb ADDED
@@ -0,0 +1,64 @@
1
+ require 'fastlane/action'
2
+ require 'java-properties'
3
+ require_relative '../helper/properties_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class SetPropertiesValueAction < Action
8
+ def self.run(params)
9
+ content = JavaProperties.load(params[:path])
10
+ content[params[:key].to_sym] = params[:value]
11
+ JavaProperties.write(content, params[:path])
12
+ end
13
+
14
+ def self.description
15
+ "Sets a value of a setting in .properties file."
16
+ end
17
+
18
+ def self.authors
19
+ ["Pavlo Pakholka"]
20
+ end
21
+
22
+ def self.return_value
23
+ nil
24
+ end
25
+
26
+ def self.details
27
+ # Optional:
28
+ ""
29
+ end
30
+
31
+ def self.available_options
32
+ [
33
+ FastlaneCore::ConfigItem.new(key: :key,
34
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
35
+ description: "Key of properie in .properties file",
36
+ optional: false,
37
+ type: String),
38
+ FastlaneCore::ConfigItem.new(key: :value,
39
+ env_name: "PROPERIES_SET_VALUE_PARAM_VALUE",
40
+ description: "Value to set",
41
+ skip_type_validation: true, # skipping type validation as fastlane converts YES/NO/true/false strings into booleans
42
+ type: String,
43
+ optional: false),
44
+ FastlaneCore::ConfigItem.new(key: :path,
45
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
46
+ description: "Path to .properies file you want to update",
47
+ type: String,
48
+ optional: false,
49
+ verify_block: proc do |value|
50
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
51
+ end)
52
+ ]
53
+ end
54
+
55
+ def self.is_supported?(platform)
56
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
57
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
58
+ #
59
+ # [:ios, :mac, :android].include?(platform)
60
+ true
61
+ end
62
+ end
63
+ end
64
+ end
data/lib/fastlane/plugin/properties/helper/properties_helper.rb ADDED
@@ -0,0 +1,35 @@
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 PropertiesHelper
8
+ # Available in actions as `Helper::PropertiesHelper.update_semver_version`
9
+ def self.update_semver_version(type, version_name)
10
+ type ||= 'minor'
11
+ version = version_name.split(".")
12
+ major = version[0].to_i
13
+ minor = version[1].to_i
14
+ patch = version[2].to_i
15
+
16
+ if type == 'major'
17
+ major += 1
18
+ minor = 0
19
+ patch = 0
20
+ end
21
+
22
+ if type == 'minor'
23
+ minor += 1
24
+ patch = 0
25
+ end
26
+
27
+ if type == 'patch'
28
+ patch += 1
29
+ end
30
+
31
+ return "#{major}.#{minor}.#{patch}"
32
+ end
33
+ end
34
+ end
35
+ end
data/lib/fastlane/plugin/properties/version.rb ADDED
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Properties
3
+ VERSION = "1.0.2"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,192 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-properties
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.2
5
+ platform: ruby
6
+ authors:
7
+ - Pavlo Pakholka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: java-properties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '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'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
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: bundler
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
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: rspec_junit_formatter
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: rake
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: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '='
102
+ - !ruby/object:Gem::Version
103
+ version: 0.49.1
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '='
109
+ - !ruby/object:Gem::Version
110
+ version: 0.49.1
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop-require_tools
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: simplecov
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: fastlane
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 2.130.0
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 2.130.0
153
+ description:
154
+ email: pavlo.pakholka@bolt.eu
155
+ executables: []
156
+ extensions: []
157
+ extra_rdoc_files: []
158
+ files:
159
+ - LICENSE
160
+ - README.md
161
+ - lib/fastlane/plugin/properties.rb
162
+ - lib/fastlane/plugin/properties/actions/get_properties_value.rb
163
+ - lib/fastlane/plugin/properties/actions/increment_version_code_in_properties_file.rb
164
+ - lib/fastlane/plugin/properties/actions/increment_version_name_in_properties_file.rb
165
+ - lib/fastlane/plugin/properties/actions/set_properties_value.rb
166
+ - lib/fastlane/plugin/properties/helper/properties_helper.rb
167
+ - lib/fastlane/plugin/properties/version.rb
168
+ homepage: https://github.com/Kerizer/fastlane-plugin-properties
169
+ licenses:
170
+ - MIT
171
+ metadata: {}
172
+ post_install_message:
173
+ rdoc_options: []
174
+ require_paths:
175
+ - lib
176
+ required_ruby_version: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
181
+ required_rubygems_version: !ruby/object:Gem::Requirement
182
+ requirements:
183
+ - - ">="
184
+ - !ruby/object:Gem::Version
185
+ version: '0'
186
+ requirements: []
187
+ rubyforge_project:
188
+ rubygems_version: 2.5.2.3
189
+ signing_key:
190
+ specification_version: 4
191
+ summary: Adds 4 actions to fastlane to read and update properties files.
192
+ test_files: []