fastlane-plugin-match_import 0.1.2

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
+ SHA256:
3
+ metadata.gz: ede6c852854eb0a20a38ee12ad9ad55a79c93fb7f6551196e1656a402b256205
4
+ data.tar.gz: c0b38782fe1a90ff32dffa2dcce0dbb21866c213374276c0868b7472c2b06f4a
5
+ SHA512:
6
+ metadata.gz: cc8e2c7ce9c0b227962e01c344c2bd3eb086f33cd375057c54ec8f5515cc2d2faaded8a38623c20440524a7c8c684b71414d252691f40d521c48505042a6fa79
7
+ data.tar.gz: cc921e3c53377693767c3cf6d3576cccff7260f7d299e9b5c4ecd34051fef0e75cd8c48e5c3224cdacdc87d510852db1b2e41d68d8d3ec26939ae72e9300b4c4
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2020 Serhii Batsevych <serbats@ukr.net>
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,149 @@
1
+ # match_import plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-match_import)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-match_import`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin match_import
11
+ ```
12
+
13
+ ## About match_import
14
+
15
+ Match repository custom import
16
+
17
+ * all kinds of files - with "match_import import --file_name='*.txt'"
18
+ * APNS certs and p12 - with "match_import import_apns"
19
+ * easy export to keychain APNS certs with p12 - with "match_import export_apns --type='adhoc'"
20
+ * easy export of custom files to some directory - with "match_export export --file_name='*.txt' --destination_path='myTestDir'"
21
+ * `ENV` variables
22
+
23
+ ## Example
24
+
25
+ ```ruby
26
+
27
+ lane :test_apns_import do
28
+ # Import APNS development certificate into match repo if certificate exist on Dev Portal and is not expired. Takes './test/DevPush.cer' and check if it is not expired and present on Dev Portal under Development Push Certificates and if present and not expired copies both './test/DevPush.cer' and './test/DevPush.p12' into match repo 'customImport/customImport/customImport/apns/development/' and encrypts
29
+ match_import_apns(type: "development", cert_file_name: 'DevPush.cer', p12_file_name: 'DevPush.p12', source_path: 'test', verbose: true)
30
+ end
31
+
32
+ lane :test_apns_import2 do
33
+ # Import APNS production certificate into match repo if certificate exist on Dev Portal and is not expired. Takes './test/ProdPush.cer' and check if it is not expired and present on Dev Portal under Production Push Certificates and if present and not expired copies both './test/ProdPush.cer' and './test/ProdPush.p12' into match repo 'customImport/customImport/customImport/apns/production/' and encrypts
34
+ match_import_apns(type: "adhoc", cert_file_name: 'ProdPush.cer', p12_file_name: 'ProdPush.p12', source_path: 'test', verbose: true)
35
+ end
36
+
37
+ lane :test_apns_export do
38
+ # Export APNS production certs from match repo into keychain. Takes from repo 'customImport/customImport/customImport/apns/production/*' and install them into 'login' keychain
39
+ match_export_apns(type: "adhoc", verbose: true)
40
+ end
41
+
42
+ lane :test_apns_export2 do
43
+ # Export APNS development certs from match repo into keychain. Takes from repo 'customImport/customImport/customImport/apns/development/*' and install them into 'login' keychain
44
+ match_export_apns(type: "development", verbose: true)
45
+ end
46
+
47
+ lane :test_apns_export3 do
48
+ # Export APNS production certs from match repo into keychain. Takes from repo 'customImport/customImport/customImport/apns/production/*' and install them into 'Fastlane' keychain
49
+ match_export_apns(type: "adhoc", keychain_name: "Fastlane", keychain_password: "qwerty", verbose: true)
50
+ end
51
+
52
+ lane :test_apns_export4 do
53
+ # Export APNS production certs from match repo into keychain. Takes from repo 'customImport/customImport/customImport/apns/production/*' and install them into 'login' keychain. Also copy it together with p12 into './testDir/'
54
+ match_export_apns(type: "adhoc", destination_path: "testDir", verbose: true)
55
+ end
56
+
57
+ lane :test_apns_remove_invalid do
58
+ # Remove expired or revoked certs from match repo. Takes from repo 'customImport/customImport/customImport/apns/production/*' and remove all expired or revoked from Dev Portal
59
+ match_remove_invalid_apns(type: "adhoc", verbose: true)
60
+ end
61
+
62
+ lane :test_apns_remove_invalid2 do
63
+ # Remove expired or revoked certs from match repo. Takes from repo 'customImport/customImport/customImport/apns/development/*' and remove all expired or revoked from Dev Portal
64
+ match_remove_invalid_apns(type: "development", verbose: true)
65
+ end
66
+
67
+ lane :test_import do
68
+ # Import custom files into encrypted match repo. Takes 'myDirWithFiles/*.txt' and copy them to repo with path 'customImport/customImport/customImport/custom/testPath/' and encrypts
69
+ match_import(file_name: '*.txt', destination_path: "testPath", source_path: 'myDirWithFiles', verbose: true)
70
+ end
71
+
72
+ lane :test_import2 do
73
+ # Import custom file into encrypted match repo. Takes './Gemfile' and copy it to repo with path 'customImport/customImport/customImport/custom/' and encrypts
74
+ match_import(file_name: 'Gemfile', verbose: true)
75
+ end
76
+
77
+ lane :test_export do
78
+ # Decrypts and export files from match repo. Decrypts match repo and takes all files from repo 'customImport/customImport/customImport/custom/testPath/*.txt' into './testDir/'
79
+ match_export(file_name: '*.txt', destination_path: "testDir/", source_path: 'testPath', verbose: true)
80
+ end
81
+
82
+ lane :test_export2 do
83
+ # Decrypts and export file from match repo. Decrypts match repo and take file from repo 'customImport/customImport/customImport/custom/Gemfile' into './'
84
+ match_export(file_name: 'Gemfile', verbose: true)
85
+ end
86
+
87
+ lane :test_remove do
88
+ # Removes files from match repo. Removes files from repo 'customImport/customImport/customImport/custom/testPath/*.txt'
89
+ match_remove(file_name: '*.txt', source_path: 'testPath/', verbose: true)
90
+ end
91
+
92
+ lane :test_remove2 do
93
+ # Removes file from match repo. Removes 'customImport/customImport/customImport/custom/Gemfile' from repo
94
+ match_remove(file_name: 'Gemfile', verbose: true)
95
+ end
96
+
97
+ ```
98
+
99
+ ## Commandline Examples:
100
+
101
+ ```bash
102
+ # Import custom files
103
+ match_import import --file_name='*.txt' --source_path='testDir' --destination_path='repoDir'
104
+
105
+ # Export custom files
106
+ match_import export --file_name='*.txt' --source_path='repoDir' --destination_path='testDir'
107
+
108
+ # Remove custom files
109
+ match_import remove --file_name='*.txt' --source_path='repoDir'
110
+
111
+ # Import APNS file
112
+ match_import import_apns --type='development' --cert_file_name='PushDev.cer' --p12_file_name='PushDev.p12'
113
+
114
+ # Export APNS file into keychain and directory
115
+ match_import export_apns --type='development' --keychain_name='FastlaneKeychain' --keychain_password='password' --destination_path='testDir'
116
+
117
+ # Remove invalid APNS development certs
118
+ match_import remove_invalid_apns --type='development'
119
+
120
+ ```
121
+
122
+ ## Run tests for this plugin
123
+
124
+ To run both the tests, and code style validation, run
125
+
126
+ ```
127
+ rake
128
+ ```
129
+
130
+ To automatically fix many of the styling issues, use
131
+ ```
132
+ rubocop -a
133
+ ```
134
+
135
+ ## Issues and Feedback
136
+
137
+ For any other issues and feedback about this plugin, please submit it to this repository.
138
+
139
+ ## Troubleshooting
140
+
141
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
142
+
143
+ ## Using _fastlane_ Plugins
144
+
145
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
146
+
147
+ ## About _fastlane_
148
+
149
+ _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,49 @@
1
+ require 'fastlane/action'
2
+ require 'match'
3
+ require_relative '../helper/match_import_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class MatchExportAction < Action
8
+ def self.run(params)
9
+ UI.message("The match_export plugin is working!")
10
+
11
+ params.load_configuration_file("Matchfile")
12
+
13
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
14
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
15
+
16
+ Fastlane::MatchImport::Runner.new.run_export(params)
17
+ end
18
+
19
+ def self.description
20
+ "Match repository custom export"
21
+ end
22
+
23
+ def self.authors
24
+ ["Serhii Batsevych"]
25
+ end
26
+
27
+ def self.return_value
28
+ # If your method provides a return value, you can describe here what it does
29
+ end
30
+
31
+ def self.details
32
+ # Optional:
33
+ "Import custom files into match encrypted repository. Including APNS certs/p12 and other."
34
+ end
35
+
36
+ def self.available_options
37
+ Fastlane::MatchImport::CustomFileOptions.available_options
38
+ end
39
+
40
+ def self.is_supported?(platform)
41
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
42
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
43
+ #
44
+ # [:ios, :mac, :android].include?(platform)
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,47 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/match_import_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class MatchExportApnsAction < Action
7
+ def self.run(params)
8
+ UI.message("The match_import_apns plugin is working!")
9
+ params.load_configuration_file("Matchfile")
10
+
11
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
12
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
13
+
14
+ Fastlane::MatchImport::RunnerAPNS.new.run_export(params)
15
+ end
16
+
17
+ def self.description
18
+ "Match repository apns certs export"
19
+ end
20
+
21
+ def self.authors
22
+ ["Serhii Batsevych"]
23
+ end
24
+
25
+ def self.return_value
26
+ # If your method provides a return value, you can describe here what it does
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ "Import apns certs from match encrypted repository into keychain(and folder if specified)"
32
+ end
33
+
34
+ def self.available_options
35
+ Fastlane::MatchImport::APNSExportFileOptions.available_options
36
+ end
37
+
38
+ def self.is_supported?(platform)
39
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
40
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
41
+ #
42
+ # [:ios, :mac, :android].include?(platform)
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ require 'fastlane/action'
2
+ require 'match'
3
+ require_relative '../helper/match_import_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class MatchImportAction < Action
8
+ def self.run(params)
9
+ UI.message("The match_import plugin is working!")
10
+
11
+ params.load_configuration_file("Matchfile")
12
+
13
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
14
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
15
+
16
+ Fastlane::MatchImport::Runner.new.run(params)
17
+ end
18
+
19
+ def self.description
20
+ "Match repository custom import"
21
+ end
22
+
23
+ def self.authors
24
+ ["Serhii Batsevych"]
25
+ end
26
+
27
+ def self.return_value
28
+ # If your method provides a return value, you can describe here what it does
29
+ end
30
+
31
+ def self.details
32
+ # Optional:
33
+ "Import custom files into match encrypted repository."
34
+ end
35
+
36
+ def self.available_options
37
+ Fastlane::MatchImport::CustomFileOptions.available_options
38
+ end
39
+
40
+ def self.is_supported?(platform)
41
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
42
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
43
+ #
44
+ # [:ios, :mac, :android].include?(platform)
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,47 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/match_import_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class MatchImportApnsAction < Action
7
+ def self.run(params)
8
+ UI.message("The match_import_apns plugin is working!")
9
+ params.load_configuration_file("Matchfile")
10
+
11
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
12
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
13
+
14
+ Fastlane::MatchImport::RunnerAPNS.new.run(params)
15
+ end
16
+
17
+ def self.description
18
+ "Match repository apns certs import"
19
+ end
20
+
21
+ def self.authors
22
+ ["Serhii Batsevych"]
23
+ end
24
+
25
+ def self.return_value
26
+ # If your method provides a return value, you can describe here what it does
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ "Import apns certs into match encrypted repository."
32
+ end
33
+
34
+ def self.available_options
35
+ Fastlane::MatchImport::APNSFileOptions.available_options
36
+ end
37
+
38
+ def self.is_supported?(platform)
39
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
40
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
41
+ #
42
+ # [:ios, :mac, :android].include?(platform)
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,49 @@
1
+ require 'fastlane/action'
2
+ require 'match'
3
+ require_relative '../helper/match_import_helper'
4
+
5
+ module Fastlane
6
+ module Actions
7
+ class MatchRemoveAction < Action
8
+ def self.run(params)
9
+ UI.message("The match_remove plugin is working!")
10
+
11
+ params.load_configuration_file("Matchfile")
12
+
13
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
14
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
15
+
16
+ Fastlane::MatchImport::Runner.new.run_remove(params)
17
+ end
18
+
19
+ def self.description
20
+ "Match repository custom export"
21
+ end
22
+
23
+ def self.authors
24
+ ["Serhii Batsevych"]
25
+ end
26
+
27
+ def self.return_value
28
+ # If your method provides a return value, you can describe here what it does
29
+ end
30
+
31
+ def self.details
32
+ # Optional:
33
+ "Import custom files into match encrypted repository. Including APNS certs/p12 and other."
34
+ end
35
+
36
+ def self.available_options
37
+ Fastlane::MatchImport::CustomFileOptions.available_options
38
+ end
39
+
40
+ def self.is_supported?(platform)
41
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
42
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
43
+ #
44
+ # [:ios, :mac, :android].include?(platform)
45
+ true
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,47 @@
1
+ require 'fastlane/action'
2
+ require_relative '../helper/match_import_helper'
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class MatchRemoveInvalidApnsAction < Action
7
+ def self.run(params)
8
+ UI.message("The match_remove_invalid_apns plugin is working!")
9
+ params.load_configuration_file("Matchfile")
10
+
11
+ Match::Encryption.register_backend(type: "git", encryption_class: MatchImport::Encryption::OpenSSL)
12
+ Match::Encryption.register_backend(type: "s3", encryption_class: MatchImport::Encryption::OpenSSL)
13
+
14
+ Fastlane::MatchImport::RunnerAPNS.new.run_remove_invalid(params)
15
+ end
16
+
17
+ def self.description
18
+ "Match repository apns certs remove invalid"
19
+ end
20
+
21
+ def self.authors
22
+ ["Serhii Batsevych"]
23
+ end
24
+
25
+ def self.return_value
26
+ # If your method provides a return value, you can describe here what it does
27
+ end
28
+
29
+ def self.details
30
+ # Optional:
31
+ "Remove expired or revoked apns certs from match encrypted repository"
32
+ end
33
+
34
+ def self.available_options
35
+ Fastlane::MatchImport::APNSRemoveInvalidFileOptions.available_options
36
+ end
37
+
38
+ def self.is_supported?(platform)
39
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
40
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
41
+ #
42
+ # [:ios, :mac, :android].include?(platform)
43
+ true
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,34 @@
1
+
2
+ require 'fastlane_core'
3
+
4
+ module Fastlane
5
+ module MatchImport
6
+ class APNSExportFileOptions
7
+ def self.exclude_options
8
+ # [:keychain_name, :keychain_password]
9
+ # Don't know how to exclude unused options and don't get error like:
10
+ # Could not find option 'type' in the list of available options
11
+ []
12
+ end
13
+
14
+ def self.available_options
15
+ all = Fastlane::MatchImport::Options.available_options
16
+
17
+ exclude_options.each do |key|
18
+ (i = all.find_index { |item| item.key == key }) && all.delete_at(i)
19
+ end
20
+
21
+ return all + custom_options
22
+ end
23
+
24
+ def self.custom_options
25
+ destination_path_index = Fastlane::MatchImport::CustomFileOptions.available_options.find_index { |item| item.key == :destination_path }
26
+ destination_path = Fastlane::MatchImport::CustomFileOptions.available_options[destination_path_index] if destination_path_index
27
+ destination_path_array = destination_path.nil? ? [] : [destination_path]
28
+
29
+ [
30
+ ] + destination_path_array
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,42 @@
1
+
2
+ require 'fastlane_core'
3
+
4
+ module Fastlane
5
+ module MatchImport
6
+ class APNSFileOptions
7
+ def self.exclude_options
8
+ # [:keychain_name, :keychain_password]
9
+ # Don't know how to exclude unused options and don't get error like:
10
+ # Could not find option 'type' in the list of available options
11
+ []
12
+ end
13
+
14
+ def self.available_options
15
+ all = Fastlane::MatchImport::Options.available_options
16
+
17
+ exclude_options.each do |key|
18
+ (i = all.find_index { |item| item.key == key }) && all.delete_at(i)
19
+ end
20
+
21
+ return all + custom_options
22
+ end
23
+
24
+ def self.custom_options
25
+ source_path_index = Fastlane::MatchImport::CustomFileOptions.available_options.find_index { |item| item.key == :source_path }
26
+ source_path = Fastlane::MatchImport::CustomFileOptions.available_options[source_path_index] if source_path_index
27
+ source_path_array = source_path.nil? ? [] : [source_path]
28
+
29
+ [
30
+ FastlaneCore::ConfigItem.new(key: :cert_file_name,
31
+ env_name: "MATCH_IMPORT_CERT_FILENAME",
32
+ description: "Certificare .cer to import",
33
+ optional: false),
34
+ FastlaneCore::ConfigItem.new(key: :p12_file_name,
35
+ env_name: "MATCH_IMPORT_P12_FILENAME",
36
+ description: "Private key .p12 to import. Should have empty password for correct export to keychain",
37
+ optional: false)
38
+ ] + source_path_array
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,30 @@
1
+
2
+ require 'fastlane_core'
3
+
4
+ module Fastlane
5
+ module MatchImport
6
+ class APNSRemoveInvalidFileOptions
7
+ def self.exclude_options
8
+ # [:keychain_name, :keychain_password]
9
+ # Don't know how to exclude unused options and don't get error like:
10
+ # Could not find option 'type' in the list of available options
11
+ []
12
+ end
13
+
14
+ def self.available_options
15
+ all = Fastlane::MatchImport::Options.available_options
16
+
17
+ exclude_options.each do |key|
18
+ (i = all.find_index { |item| item.key == key }) && all.delete_at(i)
19
+ end
20
+
21
+ return all + custom_options
22
+ end
23
+
24
+ def self.custom_options
25
+ [
26
+ ]
27
+ end
28
+ end
29
+ end
30
+ end