fastlane-plugin-remove_provisioning_profile 1.0.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: efe31afba7e6fb11b2787c9434d8519e3afa304a
4
+ data.tar.gz: a704551ef7010ff0f42495ca3a2be459f2bebf9a
5
+ SHA512:
6
+ metadata.gz: c19431ebbf94c2c0f0243a4b7c2ca2537dd38d91793c1d536d8781cfc5126c648ba9b20a3bce6177af4a3d8eea3a46b540e34cb6ef2f7e25f4d69ee7384d09f2
7
+ data.tar.gz: b939350f4a4cf508ff932c54e29b471c65f98af36f8899cc447e24df0ee182d6146e2f0a1733d95fca8f91cad73e23712694c88bf5306fc16cfc5460796576ee
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Anton Domashnev <antondomashnev@gmail.com>
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,70 @@
1
+ # remove_provisioning_profile plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-remove_provisioning_profile)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [fastlane](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-remove_provisioning_profile`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin remove_provisioning_profile
11
+ ```
12
+
13
+ ## About remove_provisioning_profile
14
+
15
+ The initial use case for the plugin has been discussed in [fastlane issue](https://github.com/fastlane/fastlane/issues/5601).
16
+ When `match` or developer adds new provision profile Xcode still keeps the old one even if the developer doesn't need it anymore. In that case this plugin could help by removing these old or unused provisioning profiles.
17
+
18
+ Available options
19
+
20
+ * `:app_identifier` - the app identifier
21
+ * `:type` - provisioning profile type, supported values `["development", "adhoc", "appstore"]`
22
+
23
+ ## Example
24
+
25
+ Example to run the action
26
+ ```
27
+ remove_provision_profiles(app_identifier: "com.antondomashnev.fastlane-plugin-remove-provisioning-profile", type: "development")
28
+ ```
29
+
30
+ Example `lane` from our team's `fastfile`. The lane removes the old provisioning profiles of all types and then runs `match` to create and load new
31
+ ```
32
+ desc "Recreate the provisioning profiles so you can deploy to your device, release on fabric and push to app store"
33
+ lane :renew_certificates do
34
+ types = ["development", "adhoc", "appstore"]
35
+ app_identifier = "com.antondomashnev.fastlane-plugin-remove-provisioning-profile"
36
+ types.each do |type|
37
+ remove_provision_profiles(app_identifier: app_identifier, type: type)
38
+ match(app_identifier: app_identifier, type: type, force: true)
39
+ end
40
+ end
41
+ ```
42
+
43
+ ## Run tests for this plugin
44
+
45
+ To run both the tests, and code style validation, run
46
+
47
+ ```
48
+ rake
49
+ ```
50
+
51
+ To automatically fix many of the styling issues, use
52
+ ```
53
+ rubocop -a
54
+ ```
55
+
56
+ ## Issues and Feedback
57
+
58
+ For any other issues and feedback about this plugin, please submit it to this repository.
59
+
60
+ ## Troubleshooting
61
+
62
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/PluginsTroubleshooting.md) doc in the main `fastlane` repo.
63
+
64
+ ## Using `fastlane` Plugins
65
+
66
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Plugins.md).
67
+
68
+ ## About `fastlane`
69
+
70
+ `fastlane` is the easiest way to automate building and releasing your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,16 @@
1
+ require 'fastlane/plugin/remove_provisioning_profile/version'
2
+
3
+ module Fastlane
4
+ module RemoveProvisioningProfile
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::RemoveProvisioningProfile.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,88 @@
1
+ module Fastlane
2
+ module Actions
3
+ class RemoveProvisioningProfileAction < Action
4
+ require 'fastlane/plugin/remove_provisioning_profile/extensions/file_include_extension'
5
+
6
+ def self.run(params)
7
+ app_identifier = params[:app_identifier]
8
+ type = params[:type]
9
+ provisioning_profiles_folder = params[:provisioning_profiles_folder] ? params[:provisioning_profiles_folder] : "#{Dir.home}/Library/MobileDevice/Provisioning Profiles"
10
+ UI.message("Looking for '#{type}' provisioning profile of '#{app_identifier}' in '#{provisioning_profiles_folder}'") if $verbose
11
+
12
+ provisioning_profiles = []
13
+ Dir.foreach(provisioning_profiles_folder) do |file|
14
+ next unless file.end_with?(".mobileprovision")
15
+ file_path = "#{provisioning_profiles_folder}/#{file}"
16
+ puts file_path
17
+ puts self.mobileprovision_of_app_identifier?(file_path, app_identifier)
18
+ puts self.mobileprovision_of_type?(file_path, type)
19
+ if self.mobileprovision_of_app_identifier?(file_path, app_identifier) && self.mobileprovision_of_type?(file_path, type)
20
+ provisioning_profiles << file_path
21
+ UI.message("Found matched provisioning profile at '#{file_path}'") if $verbose
22
+ end
23
+ end
24
+
25
+ FileUtils.rm(provisioning_profiles)
26
+ if provisioning_profiles.count > 0
27
+ UI.success("Successfully removed #{provisioning_profiles.count} provisioning profiles")
28
+ else
29
+ UI.success("Doesn't find any '#{type}' provisioning profile to remove")
30
+ end
31
+ end
32
+
33
+ def self.mobileprovision_of_app_identifier?(mobileprovision, app_identifier)
34
+ return File.include_string?(mobileprovision, "#{app_identifier}</string>")
35
+ end
36
+
37
+ def self.mobileprovision_of_type?(mobileprovision, type)
38
+ if type == "development"
39
+ return File.include_two_lines?(mobileprovision, "<key>get-task-allow</key>", "<true/>")
40
+ elsif type == "adhoc"
41
+ return File.include_line?(mobileprovision, "<key>ProvisionedDevices</key>") && File.include_two_lines?(mobileprovision, "<key>get-task-allow</key>", "<false/>")
42
+ elsif type == "appstore"
43
+ return !File.include_line?(mobileprovision, "<key>ProvisionedDevices</key>")
44
+ end
45
+ raise "Unknown mobileprovision type '#{type}'. Possible values: 'development', 'adhoc', 'appstore'".red
46
+ end
47
+
48
+ #####################################################
49
+ # @!group Documentation
50
+ #####################################################
51
+
52
+ def self.description
53
+ "Remove the provisioning profile for the given app_identifier and type from local machine"
54
+ end
55
+
56
+ def self.authors
57
+ ["antondomashnev"]
58
+ end
59
+
60
+ def self.available_options
61
+ [
62
+ FastlaneCore::ConfigItem.new(key: :app_identifier,
63
+ description: "The app identifier",
64
+ optional: false,
65
+ type: String,
66
+ verify_block: proc do |value|
67
+ UI.user_error!("No app identifier") if value.to_s.length == 0
68
+ end),
69
+ FastlaneCore::ConfigItem.new(key: :type,
70
+ description: "Provisioning profile type",
71
+ optional: false,
72
+ type: String,
73
+ verify_block: proc do |value|
74
+ UI.user_error!("Invalid provisioning profile type '#{value}'. Supported types are: 'development', 'adhoc', 'appstore'") unless ["development", "adhoc", "appstore"].include?(value)
75
+ end),
76
+ FastlaneCore::ConfigItem.new(key: :provisioning_profiles_folder,
77
+ description: "Folder with provisioning profiles",
78
+ optional: true,
79
+ type: String)
80
+ ]
81
+ end
82
+
83
+ def self.is_supported?(platform)
84
+ platform == :ios
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,28 @@
1
+ class File
2
+ def self.include_string?(file_path, included_string)
3
+ File.foreach(file_path).any? do |line|
4
+ line.include?(included_string)
5
+ end
6
+ end
7
+
8
+ def self.include_line?(file_path, included_line)
9
+ stripped_included_line = included_line.strip
10
+ File.foreach(file_path).any? do |line|
11
+ line.strip == stripped_included_line
12
+ end
13
+ end
14
+
15
+ def self.include_two_lines?(file_path, included_line_1, included_line_2)
16
+ stripped_included_line_1 = included_line_1.strip
17
+ stripped_included_line_2 = included_line_2.strip
18
+ previous_line = ""
19
+ File.foreach(file_path).any? do |line|
20
+ if previous_line.strip == stripped_included_line_1 && line.strip == stripped_included_line_2
21
+ true
22
+ else
23
+ previous_line = line
24
+ false
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,6 @@
1
+ module Fastlane
2
+ module Helper
3
+ class RemoveProvisioningProfileHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module RemoveProvisioningProfile
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,135 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-remove_provisioning_profile
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Anton Domashnev
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-08-14 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: rake
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: rubocop
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: fastlane
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: 1.100.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 1.100.0
97
+ description:
98
+ email: antondomashnev@gmail.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - LICENSE
104
+ - README.md
105
+ - lib/fastlane/plugin/remove_provisioning_profile.rb
106
+ - lib/fastlane/plugin/remove_provisioning_profile/actions/remove_provisioning_profile_action.rb
107
+ - lib/fastlane/plugin/remove_provisioning_profile/extensions/file_include_extension.rb
108
+ - lib/fastlane/plugin/remove_provisioning_profile/helper/remove_provisioning_profile_helper.rb
109
+ - lib/fastlane/plugin/remove_provisioning_profile/version.rb
110
+ homepage: https://github.com/Antondomashnev/fastlane-plugin-remove-provisioning-profile
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.8
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: Remove provision profile from your local machine
134
+ test_files: []
135
+ has_rdoc: