fastlane-plugin-update_provisioning_profile 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: 3976022335039d2026fa602a83c706ff115fab3f
4
+ data.tar.gz: 479543b7a5b584ae1ebb80db7c6e705401ed46cb
5
+ SHA512:
6
+ metadata.gz: 531d5fcf14aeb0f36324fe838af3a3275a06124a667f9df897097884e50b2c5d71b0013babe52df3cdab8c31bb1bc12e15723df6f4244bb4c4f24920d65977b4
7
+ data.tar.gz: 7e8ac697dceafe8aaa5a3d5bb9f9bf0c0661510e6b912ffcece9fa6694f6d3b094b6f6f76f1380fa49514c229c03a2a0f9f176e33a8f3c8c6017e1702c035a1a
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Duy Nguyen <duynb92@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,48 @@
1
+ # update_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-update_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-update_provisioning_profile`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin update_provisioning_profile
11
+ ```
12
+
13
+ ## About update_provisioning_profile
14
+
15
+ This action will update xcodeproj with values extracted from your provisioning profile. Useful when use with `fastlane sigh`.
16
+
17
+ ## Example
18
+
19
+ 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`.
20
+
21
+ ## Run tests for this plugin
22
+
23
+ To run both the tests, and code style validation, run
24
+
25
+ ```
26
+ rake
27
+ ```
28
+
29
+ To automatically fix many of the styling issues, use
30
+ ```
31
+ rubocop -a
32
+ ```
33
+
34
+ ## Issues and Feedback
35
+
36
+ For any other issues and feedback about this plugin, please submit it to this repository.
37
+
38
+ ## Troubleshooting
39
+
40
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
41
+
42
+ ## Using _fastlane_ Plugins
43
+
44
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
45
+
46
+ ## About _fastlane_
47
+
48
+ _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/update_provisioning_profile/version'
2
+
3
+ module Fastlane
4
+ module UpdateProvisioningProfile
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::UpdateProvisioningProfile.all_classes.each do |current|
15
+ require current
16
+ end
@@ -0,0 +1,113 @@
1
+ require "fastlane/action"
2
+ require_relative "../helper/update_provisioning_profile_helper"
3
+
4
+ module Fastlane
5
+ module Actions
6
+ class UpdateProvisioningProfileAction < Action
7
+ def self.run(params)
8
+ require "xcodeproj"
9
+ require "plist"
10
+
11
+ # assign folder from the parameter or search for an .xcodeproj file
12
+ pdir = params[:xcodeproj] || Dir["*.xcodeproj"].first
13
+ target = params[:target]
14
+ configuration = params[:configuration]
15
+
16
+ project_file_path = File.join(pdir, "project.pbxproj")
17
+ UI.user_error!("Could not find path to project config '#{project_file_path}'. Pass the path to your project (NOT workspace!)") unless File.exist?(project_file_path)
18
+
19
+ provisioning_profile = params[:provisioning_profile]
20
+ profile_plist_file = "profile.plist"
21
+ certificate_file = "cert.crt"
22
+ sh("security cms -D -i #{provisioning_profile} > #{profile_plist_file}")
23
+ profile_plist = Plist.parse_xml(profile_plist_file)
24
+ porfile_uuid = profile_plist["UUID"]
25
+ profile_specifier = profile_plist["Name"]
26
+ team_id = profile_plist["TeamIdentifier"].first
27
+
28
+ certificateIO = profile_plist["DeveloperCertificates"].first
29
+ certificateIO.set_encoding("UTF-8")
30
+ File.open(certificate_file, "w:UTF-8") do |f|
31
+ f.puts(certificateIO.read)
32
+ end
33
+ full_certificate_CN = sh("cat #{certificate_file} | openssl x509 -noout -inform DER -subject | sed 's/^.*CN=\\([^\\/]*\\)\\/.*$/\\1/'")
34
+ code_sign_identity = full_certificate_CN.split(":").first
35
+
36
+ project = Xcodeproj::Project.open(pdir)
37
+ project.targets.each do |t|
38
+ if !target || t.name == target
39
+ UI.success("Updating target #{t.name}")
40
+ else
41
+ UI.important("Skipping target #{t.name} as it doesn't match the filter '#{target}'")
42
+ next
43
+ end
44
+ t.build_configurations.each do |config|
45
+ if !configuration || config.name.match(configuration)
46
+ UI.success("Updating configuration #{config.name}")
47
+ else
48
+ UI.important("Skipping configuration #{config.name} as it doesn't match the filter '#{configuration}'")
49
+ next
50
+ end
51
+ config.build_settings["DEVELOPMENT_TEAM"] = team_id
52
+ config.build_settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = code_sign_identity
53
+ config.build_settings["PROVISIONING_PROFILE"] = porfile_uuid
54
+ config.build_settings["PROVISIONING_PROFILE_SPECIFIER"] = profile_specifier
55
+ end
56
+ end
57
+ project.save
58
+
59
+ UI.message("Finish update xcodeproj with extracted values from provisioning profile!")
60
+ end
61
+
62
+ def self.description
63
+ "This action will update xcodeproj with values extracted from your provisioning profile."
64
+ end
65
+
66
+ def self.authors
67
+ ["Duy Nguyen"]
68
+ end
69
+
70
+ def self.return_value
71
+ # If your method provides a return value, you can describe here what it does
72
+ end
73
+
74
+ def self.available_options
75
+ [
76
+ FastlaneCore::ConfigItem.new(
77
+ key: :xcodeproj,
78
+ env_name: "SPECIFIER_XCODEPROJ",
79
+ description: "Path to the .xcodeproj file",
80
+ optional: true,
81
+ verify_block: proc do |value|
82
+ UI.user_error!("Path to Xcode project file is invalid") unless File.exist?(value)
83
+ end,
84
+ ),
85
+ FastlaneCore::ConfigItem.new(
86
+ key: :target,
87
+ env_name: "SPECIFIER_TARGET",
88
+ description: "The target for which to update Provisioning Profile. If unspecified the change will be applied to all targets",
89
+ optional: true,
90
+ ),
91
+ FastlaneCore::ConfigItem.new(
92
+ key: :configuration,
93
+ env_name: "SPECIFIER_CONFIGURATION",
94
+ description: "The configuration for which to update Provisioning Profile. If unspecified the change will be applied to all configurations",
95
+ optional: true,
96
+ ),
97
+ FastlaneCore::ConfigItem.new(key: :provisioning_profile,
98
+ env_name: "PROVISIONING_PROFILE",
99
+ description: "Provisioning profile",
100
+ optional: false,
101
+ type: String),
102
+ ]
103
+ end
104
+
105
+ def self.is_supported?(platform)
106
+ # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
107
+ # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
108
+ #
109
+ [:ios, :mac].include?(platform)
110
+ end
111
+ end
112
+ end
113
+ end
@@ -0,0 +1,16 @@
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 UpdateProvisioningProfileHelper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::UpdateProvisioningProfileHelper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the update_provisioning_profile plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module UpdateProvisioningProfile
3
+ VERSION = "0.1.0"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,176 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-update_provisioning_profile
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Duy Nguyen
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-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: 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: 1.95.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 1.95.0
139
+ description:
140
+ email: duynb92@gmail.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - LICENSE
146
+ - README.md
147
+ - lib/fastlane/plugin/update_provisioning_profile.rb
148
+ - lib/fastlane/plugin/update_provisioning_profile/actions/update_provisioning_profile_action.rb
149
+ - lib/fastlane/plugin/update_provisioning_profile/helper/update_provisioning_profile_helper.rb
150
+ - lib/fastlane/plugin/update_provisioning_profile/version.rb
151
+ homepage: https://github.com/duynb92/fastlane-plugin-update_provisioning_profile
152
+ licenses:
153
+ - MIT
154
+ metadata: {}
155
+ post_install_message:
156
+ rdoc_options: []
157
+ require_paths:
158
+ - lib
159
+ required_ruby_version: !ruby/object:Gem::Requirement
160
+ requirements:
161
+ - - ">="
162
+ - !ruby/object:Gem::Version
163
+ version: '0'
164
+ required_rubygems_version: !ruby/object:Gem::Requirement
165
+ requirements:
166
+ - - ">="
167
+ - !ruby/object:Gem::Version
168
+ version: '0'
169
+ requirements: []
170
+ rubyforge_project:
171
+ rubygems_version: 2.5.2
172
+ signing_key:
173
+ specification_version: 4
174
+ summary: This action will update xcodeproj with values extracted from your provisioning
175
+ profile.
176
+ test_files: []