fastlane-plugin-properties 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0a8ac1e69cf133ac155ad591626f376fef45a7c2
4
+ data.tar.gz: 92885864e9474af63971a90cc378920ca410b1f5
5
+ SHA512:
6
+ metadata.gz: 8e2e199f5baee8a0c5cce5fdf50f6529c18e9ba98cd2c244f88952e6975292c126ade7fbe1c216445744cbf2b28dcf3807a9a0692a388c4d03db1cc32157bf38
7
+ data.tar.gz: b05b000e8e878d4639148031e944884201c32a156ff4d38f8c7b8fd5c506a1fdb01c944764cc7d14f0013d04656e351e3449e5fadfc339ec87a79fc61297e89d
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,81 @@
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
+ ## Run tests for this plugin
55
+
56
+ To run both the tests, and code style validation, run
57
+
58
+ ```
59
+ rake
60
+ ```
61
+
62
+ To automatically fix many of the styling issues, use
63
+ ```
64
+ rubocop -a
65
+ ```
66
+
67
+ ## Issues and Feedback
68
+
69
+ For any other issues and feedback about this plugin, please submit it to this repository.
70
+
71
+ ## Troubleshooting
72
+
73
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
74
+
75
+ ## Using _fastlane_ Plugins
76
+
77
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
78
+
79
+ ## About _fastlane_
80
+
81
+ _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/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
@@ -0,0 +1,59 @@
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
+ ),
38
+ FastlaneCore::ConfigItem.new(key: :path,
39
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
40
+ description: "Path to .properies file you want to update",
41
+ type: String,
42
+ optional: false,
43
+ verify_block: proc do |value|
44
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
45
+ end
46
+ )
47
+ ]
48
+ end
49
+
50
+ def self.is_supported?(platform)
51
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
52
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
53
+ #
54
+ # [:ios, :mac, :android].include?(platform)
55
+ true
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,62 @@
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
+ ),
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
+ )
50
+ ]
51
+ end
52
+
53
+ def self.is_supported?(platform)
54
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
55
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
56
+ #
57
+ # [:ios, :mac, :android].include?(platform)
58
+ true
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,69 @@
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
+ ),
42
+ FastlaneCore::ConfigItem.new(key: :path,
43
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
44
+ description: "Path to .properies file you want to update",
45
+ type: String,
46
+ optional: false,
47
+ verify_block: proc do |value|
48
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
49
+ end
50
+ ),
51
+ FastlaneCore::ConfigItem.new(key: :update_type,
52
+ env_name: "PROPERIES_GET_VALUE_PARAM_KEY",
53
+ description: "Key of properie in .properties file",
54
+ optional: true,
55
+ type: String
56
+ )
57
+ ]
58
+ end
59
+
60
+ def self.is_supported?(platform)
61
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
62
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
63
+ #
64
+ # [:ios, :mac, :android].include?(platform)
65
+ true
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,67 @@
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
+ ),
39
+ FastlaneCore::ConfigItem.new(key: :value,
40
+ env_name: "PROPERIES_SET_VALUE_PARAM_VALUE",
41
+ description: "Value to set",
42
+ skip_type_validation: true, # skipping type validation as fastlane converts YES/NO/true/false strings into booleans
43
+ type: String,
44
+ optional: false
45
+ ),
46
+ FastlaneCore::ConfigItem.new(key: :path,
47
+ env_name: "PROPERIES_GET_VALUE_PARAM_PATH",
48
+ description: "Path to .properies file you want to update",
49
+ type: String,
50
+ optional: false,
51
+ verify_block: proc do |value|
52
+ UI.user_error!("Couldn't find .properties file at path '#{value}'") unless File.exist?(File.expand_path(value))
53
+ end
54
+ )
55
+ ]
56
+ end
57
+
58
+ def self.is_supported?(platform)
59
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
60
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
61
+ #
62
+ # [:ios, :mac, :android].include?(platform)
63
+ true
64
+ end
65
+ end
66
+ end
67
+ end
@@ -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 = 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
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module Properties
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,178 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-properties
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Pavlo Pakholka
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-08-12 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.128.1
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 2.128.1
139
+ description:
140
+ email: pavlo.pakholka@bolt.eu
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/properties.rb
148
+ - lib/fastlane/plugin/properties/actions/get_properties_value.rb
149
+ - lib/fastlane/plugin/properties/actions/increment_version_code_in_properties_file.rb
150
+ - lib/fastlane/plugin/properties/actions/increment_version_name_in_properties_file.rb
151
+ - lib/fastlane/plugin/properties/actions/set_properties_value.rb
152
+ - lib/fastlane/plugin/properties/helper/properties_helper.rb
153
+ - lib/fastlane/plugin/properties/version.rb
154
+ homepage:
155
+ licenses:
156
+ - MIT
157
+ metadata: {}
158
+ post_install_message:
159
+ rdoc_options: []
160
+ require_paths:
161
+ - lib
162
+ required_ruby_version: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ required_rubygems_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ requirements: []
173
+ rubyforge_project:
174
+ rubygems_version: 2.5.2.3
175
+ signing_key:
176
+ specification_version: 4
177
+ summary: Adds 4 actions to fastlane to read and update properties files.
178
+ test_files: []