fastlane-plugin-teak 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +52 -0
- data/lib/fastlane/plugin/teak/actions/teak_action.rb +47 -0
- data/lib/fastlane/plugin/teak/actions/teak_extensions.rb +203 -0
- data/lib/fastlane/plugin/teak/actions/teak_sdk_action.rb +116 -0
- data/lib/fastlane/plugin/teak/helper/teak_helper.rb +72 -0
- data/lib/fastlane/plugin/teak/version.rb +5 -0
- data/lib/fastlane/plugin/teak.rb +16 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0a4dd73bb24c835779318b7bfa0d83d2cc608a812f0881854625d04060b46204
|
4
|
+
data.tar.gz: 42b3b757bb538c842f72ecb983d78bd64ba0c3fc247eb64acfb0a04890ea9071
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 23f7825293dd3ef90cfb871ef686eb497e00cc06eb413726da04150bb041460286089f8a87419c92a9099e6b72081cc095fde40ab3ac631d66b931e868b7d635
|
7
|
+
data.tar.gz: 565695186905d237e5b6cc2c08a6a2d9e1360287a73577fb0add1999de05af11a05ce81ce99b91c991e66a27e30987d26cef015a26f9bbc7490e6f84ac4572f7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 Teak.io, Inc.
|
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,52 @@
|
|
1
|
+
# teak plugin
|
2
|
+
|
3
|
+
[![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-teak)
|
4
|
+
|
5
|
+
## Getting Started
|
6
|
+
|
7
|
+
This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-teak`, add it to your project by running:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
fastlane add_plugin teak
|
11
|
+
```
|
12
|
+
|
13
|
+
## About teak
|
14
|
+
|
15
|
+
Fastlane plugins for the Teak SDK
|
16
|
+
|
17
|
+
**Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
|
18
|
+
|
19
|
+
## Example
|
20
|
+
|
21
|
+
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`.
|
22
|
+
|
23
|
+
**Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
|
24
|
+
|
25
|
+
## Run tests for this plugin
|
26
|
+
|
27
|
+
To run both the tests, and code style validation, run
|
28
|
+
|
29
|
+
```
|
30
|
+
rake
|
31
|
+
```
|
32
|
+
|
33
|
+
To automatically fix many of the styling issues, use
|
34
|
+
```
|
35
|
+
rubocop -a
|
36
|
+
```
|
37
|
+
|
38
|
+
## Issues and Feedback
|
39
|
+
|
40
|
+
For any other issues and feedback about this plugin, please submit it to this repository.
|
41
|
+
|
42
|
+
## Troubleshooting
|
43
|
+
|
44
|
+
If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
|
+
|
46
|
+
## Using _fastlane_ Plugins
|
47
|
+
|
48
|
+
For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
49
|
+
|
50
|
+
## About _fastlane_
|
51
|
+
|
52
|
+
_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,47 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/teak_helper'
|
3
|
+
|
4
|
+
module Fastlane
|
5
|
+
module Actions
|
6
|
+
class TeakAction < Action
|
7
|
+
def self.run(params)
|
8
|
+
UI.message("The teak plugin is working!")
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.description
|
12
|
+
"Fastlane plugins for the Teak SDK"
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.authors
|
16
|
+
["Pat Wilson"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.return_value
|
20
|
+
# If your method provides a return value, you can describe here what it does
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.details
|
24
|
+
# Optional:
|
25
|
+
"A collection of plugins to make your life easier when working with the Teak SDK."
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.available_options
|
29
|
+
[
|
30
|
+
# FastlaneCore::ConfigItem.new(key: :your_option,
|
31
|
+
# env_name: "TEAK_YOUR_OPTION",
|
32
|
+
# description: "A description of your option",
|
33
|
+
# optional: false,
|
34
|
+
# type: String)
|
35
|
+
]
|
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,203 @@
|
|
1
|
+
require "xcodeproj"
|
2
|
+
require "fileutils"
|
3
|
+
require "tmpdir"
|
4
|
+
|
5
|
+
TEAK_EXTENSIONS = [
|
6
|
+
["TeakNotificationService", ["MobileCoreServices", "UserNotifications", "UIKit", "SystemConfiguration"]],
|
7
|
+
["TeakNotificationContent", ["UserNotifications", "UserNotificationsUI", "AVFoundation", "UIKit", "ImageIO", "CoreGraphics"]]
|
8
|
+
]
|
9
|
+
|
10
|
+
module Fastlane
|
11
|
+
module Actions
|
12
|
+
class TeakExtensionsAction < Action
|
13
|
+
def self.run(params)
|
14
|
+
FastlaneCore::PrintTable.print_values(config: params, title: "Summary for Teak Extensions")
|
15
|
+
teak_extensions_project_path = params[:xcodeproj]
|
16
|
+
teak_extensions_source = params[:source]
|
17
|
+
teak_extensions_source_path = params[:source_path]
|
18
|
+
teak_extensions_branch = params[:branch]
|
19
|
+
teak_extensions_team_id = params[:team_id]
|
20
|
+
teak_extensions_bundle_identifier = params[:app_identifier]
|
21
|
+
|
22
|
+
# Open Xcode project
|
23
|
+
xcode_proj = Xcodeproj::Project.open(teak_extensions_project_path)
|
24
|
+
|
25
|
+
temp_path = nil
|
26
|
+
begin
|
27
|
+
# Clone Teak Extensions if needed
|
28
|
+
if teak_extensions_source.start_with?("git@", "http")
|
29
|
+
repo_name = teak_extensions_source.split("/").last.split(".").first
|
30
|
+
checkout_param = teak_extensions_branch
|
31
|
+
|
32
|
+
temp_path = Dir.mktmpdir("fl_teak_extensions_clone")
|
33
|
+
clone_folder = File.join(temp_path, repo_name)
|
34
|
+
|
35
|
+
branch_option = "--branch #{teak_extensions_branch}" if teak_extensions_branch != 'HEAD'
|
36
|
+
|
37
|
+
UI.message("Cloning git repo for Teak Extensions (#{teak_extensions_source})...")
|
38
|
+
Actions.sh("GIT_TERMINAL_PROMPT=0 git clone '#{teak_extensions_source}' '#{clone_folder}' --depth 1 -n #{branch_option}")
|
39
|
+
|
40
|
+
# TODO: Versions?
|
41
|
+
|
42
|
+
Actions.sh("cd '#{clone_folder}' && git checkout #{checkout_param} '#{teak_extensions_source_path}'")
|
43
|
+
|
44
|
+
# Reassign teak_extensions_source to be the temp directory
|
45
|
+
teak_extensions_source = clone_folder
|
46
|
+
end
|
47
|
+
|
48
|
+
# Expand path
|
49
|
+
teak_extensions_source = File.join(File.expand_path(teak_extensions_source), teak_extensions_source_path)
|
50
|
+
|
51
|
+
# Make sure teak_extensions_source exists
|
52
|
+
UI.user_error!("Teak Extensions not found in: #{teak_extensions_source}") unless File.exist?(teak_extensions_source)
|
53
|
+
|
54
|
+
# TODO: Ensure the files we need are located in teak_extensions_source
|
55
|
+
Actions.sh("cd '#{teak_extensions_source}' && ls")
|
56
|
+
|
57
|
+
# Destination path for copied files
|
58
|
+
extension_destination_path = File.dirname(teak_extensions_project_path)
|
59
|
+
|
60
|
+
# Copy the files, and add to Xcode project
|
61
|
+
TEAK_EXTENSIONS.each do |service, deps|
|
62
|
+
target_path = File.join(extension_destination_path, service)
|
63
|
+
FileUtils.mkdir_p(target_path)
|
64
|
+
|
65
|
+
# Find or create PBXGroup
|
66
|
+
product_group = xcode_proj[service] || xcode_proj.new_group(service, service)
|
67
|
+
|
68
|
+
# Get or create target
|
69
|
+
target = xcode_proj.native_targets.detect { |e| e.name == service } ||
|
70
|
+
xcode_proj.new_target(:app_extension, service, :ios, nil, xcode_proj.products_group, :objc)
|
71
|
+
|
72
|
+
# Add target dependencies
|
73
|
+
deps.each do |framework|
|
74
|
+
file_ref = xcode_proj.frameworks_group.new_reference("System/Library/Frameworks/#{framework}.framework")
|
75
|
+
file_ref.name = "#{framework}.framework"
|
76
|
+
file_ref.source_tree = 'SDKROOT'
|
77
|
+
target.frameworks_build_phase.add_file_reference(file_ref, true)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Add dependency on libTeak.a
|
81
|
+
teak_framework_ref = xcode_proj.frameworks_group.new_reference("libTeak.a")
|
82
|
+
teak_framework_ref.name = "libTeak.a"
|
83
|
+
teak_framework_ref.source_tree = 'SOURCE_ROOT'
|
84
|
+
target.frameworks_build_phase.add_file_reference(teak_framework_ref, true)
|
85
|
+
|
86
|
+
# Copy files
|
87
|
+
Dir.glob(File.expand_path("#{service}/**/*", teak_extensions_source)).map(&File.method(:realpath)).each do |file|
|
88
|
+
target_file = File.join(target_path, File.basename(file))
|
89
|
+
FileUtils.rm_f(target_file)
|
90
|
+
FileUtils.cp(file, target_file)
|
91
|
+
|
92
|
+
# Find or add file to Xcode project
|
93
|
+
file_ref = product_group[File.basename(file)] || product_group.new_reference(File.basename(file))
|
94
|
+
|
95
|
+
# Add *.m files to build phase
|
96
|
+
if File.extname(file) == ".m"
|
97
|
+
target.source_build_phase.add_file_reference(file_ref, true)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
# Add Resources build phase
|
102
|
+
target.resources_build_phase
|
103
|
+
|
104
|
+
# Assign build configurations
|
105
|
+
target.build_configurations.each do |config|
|
106
|
+
config.build_settings = {
|
107
|
+
ARCHS: "arm64", # armv7 and armv7s do not support Notification Content Extensions
|
108
|
+
IPHONEOS_DEPLOYMENT_TARGET: 10.0,
|
109
|
+
DEVELOPMENT_TEAM: teak_extensions_team_id,
|
110
|
+
LIBRARY_SEARCH_PATHS: [
|
111
|
+
"$(SRCROOT)/Libraries/Teak/Plugins/iOS" # Unity path
|
112
|
+
],
|
113
|
+
INFOPLIST_FILE: "#{service}/Info.plist",
|
114
|
+
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks",
|
115
|
+
PRODUCT_BUNDLE_IDENTIFIER: "#{teak_extensions_bundle_identifier}.#{service}",
|
116
|
+
PRODUCT_NAME: "$(TARGET_NAME)",
|
117
|
+
SKIP_INSTALL: :YES,
|
118
|
+
TARGETED_DEVICE_FAMILY: "1,2",
|
119
|
+
VALID_ARCHS: "arm64"
|
120
|
+
}
|
121
|
+
end
|
122
|
+
|
123
|
+
# Add to native targets
|
124
|
+
xcode_proj.native_targets.each do |native_target|
|
125
|
+
next if native_target.to_s != xcode_proj.root_object.name
|
126
|
+
|
127
|
+
native_target.add_dependency(target)
|
128
|
+
|
129
|
+
copy_phase = native_target.build_phases.detect { |e| e.respond_to?(:name) && e.name == "Embed Teak App Extensions" } || native_target.new_copy_files_build_phase("Embed Teak App Extensions")
|
130
|
+
copy_phase.dst_subfolder_spec = '13'
|
131
|
+
copy_phase.add_file_reference(target.product_reference, true)
|
132
|
+
end
|
133
|
+
end
|
134
|
+
ensure
|
135
|
+
# Remove temporary directory (from cloning repo) if it exists
|
136
|
+
FileUtils.remove_entry_secure(temp_path) unless temp_path.nil?
|
137
|
+
end
|
138
|
+
|
139
|
+
# Done, save it
|
140
|
+
xcode_proj.save
|
141
|
+
UI.message("Successfully saved project: #{xcode_proj.root_object.name}")
|
142
|
+
end
|
143
|
+
|
144
|
+
def self.description
|
145
|
+
'Add App Extension'
|
146
|
+
end
|
147
|
+
|
148
|
+
def self.available_options
|
149
|
+
[
|
150
|
+
FastlaneCore::ConfigItem.new(key: :xcodeproj,
|
151
|
+
env_name: "FL_TEAK_EXTENSIONS_PROJECT_PATH",
|
152
|
+
description: "Path to your Xcode project",
|
153
|
+
code_gen_sensitive: true,
|
154
|
+
default_value: Dir['*.xcodeproj'].first,
|
155
|
+
default_value_dynamic: true,
|
156
|
+
verify_block: proc do |value|
|
157
|
+
UI.user_error!("Please pass the path to the project, not the workspace") unless value.end_with?(".xcodeproj")
|
158
|
+
UI.user_error!("Could not find Xcode project") unless File.exist?(value)
|
159
|
+
end),
|
160
|
+
FastlaneCore::ConfigItem.new(key: :app_identifier,
|
161
|
+
env_name: "FL_TEAK_EXTENSIONS_BUNDLE_IDENTIFIER",
|
162
|
+
description: 'The app Identifier you want to set',
|
163
|
+
code_gen_sensitive: true,
|
164
|
+
default_value: ENV['PRODUCE_APP_IDENTIFIER'] || CredentialsManager::AppfileConfig.try_fetch_value(:app_identifier),
|
165
|
+
default_value_dynamic: true),
|
166
|
+
FastlaneCore::ConfigItem.new(key: :source,
|
167
|
+
env_name: "FL_TEAK_EXTENSIONS_SOURCE",
|
168
|
+
description: "Path to a local checkout of the `teak-ios` repository, or git URL",
|
169
|
+
default_value: "https://github.com/GoCarrot/teak-ios.git",
|
170
|
+
optional: true),
|
171
|
+
FastlaneCore::ConfigItem.new(key: :source_path,
|
172
|
+
env_name: "FL_TEAK_EXTENSIONS_SOURCE_PATH",
|
173
|
+
description: "If `teak_extensions_source` is a git URL, the path to the extensions inside that repository",
|
174
|
+
default_value: "TeakExtensions/",
|
175
|
+
optional: true),
|
176
|
+
FastlaneCore::ConfigItem.new(key: :branch,
|
177
|
+
env_name: "FL_TEAK_EXTENSIONS_SOURCE_BRANCH",
|
178
|
+
description: "If `teak_extensions_source` is a git URL, the branch to use in that repository",
|
179
|
+
default_value: "HEAD",
|
180
|
+
optional: true),
|
181
|
+
FastlaneCore::ConfigItem.new(key: :team_id,
|
182
|
+
env_name: "FL_TEAK_EXTENSIONS_TEAM_ID",
|
183
|
+
description: "The ID of your Developer Portal team if you're in multiple teams",
|
184
|
+
default_value: CredentialsManager::AppfileConfig.try_fetch_value(:team_id),
|
185
|
+
optional: true)
|
186
|
+
]
|
187
|
+
end
|
188
|
+
|
189
|
+
def self.output
|
190
|
+
[
|
191
|
+
]
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.authors
|
195
|
+
["Pat Wilson"]
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.is_supported?(platform)
|
199
|
+
[:ios].include?(platform)
|
200
|
+
end
|
201
|
+
end
|
202
|
+
end
|
203
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
require_relative '../helper/teak_helper'
|
3
|
+
|
4
|
+
TEAK_SDKS = {
|
5
|
+
'air' => {
|
6
|
+
basename: 'io.teak.sdk.Teak',
|
7
|
+
extension: 'ane',
|
8
|
+
s3dir: 'air',
|
9
|
+
local_subdirectory: 'bin'
|
10
|
+
},
|
11
|
+
'unity' => {
|
12
|
+
basename: 'Teak',
|
13
|
+
extension: 'unitypackage',
|
14
|
+
s3dir: 'unity',
|
15
|
+
local_subdirectory: nil
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
module Fastlane
|
20
|
+
module Actions
|
21
|
+
class TeakSdkAction < Action
|
22
|
+
def self.run(params)
|
23
|
+
FastlaneCore::PrintTable.print_values(config: params, title: "Summary for Teak SDK")
|
24
|
+
|
25
|
+
teak_sdk = TEAK_SDKS[params[:sdk].to_s.downcase]
|
26
|
+
out_sdk_path = File.join(params[:destination], "#{teak_sdk[:basename]}.#{teak_sdk[:extension]}")
|
27
|
+
|
28
|
+
# Copy or Download
|
29
|
+
if params[:source]
|
30
|
+
FileUtils.cp(File.join(params[:source], teak_sdk[:local_subdirectory], "#{teak_sdk[:basename]}.#{teak_sdk[:extension]}"), out_sdk_path)
|
31
|
+
else
|
32
|
+
version = params[:version] ? "-#{params[:version]}" : ""
|
33
|
+
|
34
|
+
Actions.sh("curl", "--fail", "-o", out_sdk_path,
|
35
|
+
"https://sdks.teakcdn.com/#{params[:sdk].to_s.downcase}/#{teak_sdk[:basename]}#{version}.#{teak_sdk[:extension]}",
|
36
|
+
error_callback: proc do
|
37
|
+
UI.user_error!("Could not download version #{params[:version]}")
|
38
|
+
end)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Figure out the version of the SDK
|
42
|
+
teak_sdk_version = nil
|
43
|
+
Dir.mktmpdir do |tmpdir|
|
44
|
+
case params[:sdk]
|
45
|
+
when :air
|
46
|
+
Actions.sh("unzip", out_sdk_path, "-d", tmpdir, log: false)
|
47
|
+
teak_sdk_version = File.read(File.join(tmpdir, "META-INF", "ANE", "extension.xml")).match(%r[<versionNumber>(.*)<\/versionNumber>]).captures.first
|
48
|
+
when :unity
|
49
|
+
Actions.sh("tar", "-xf", out_sdk_path, "-C", tmpdir, log: false)
|
50
|
+
teak_version_dir = Dir.glob("#{tmpdir}/*").find do |f|
|
51
|
+
pathname = File.join(f, "pathname")
|
52
|
+
File.directory?(f) && File.exist?(pathname) && File.read(pathname) == "Assets/Teak/TeakVersion.cs"
|
53
|
+
end
|
54
|
+
teak_sdk_version = File.read(File.join(teak_version_dir, "asset")).match(/return "(.*)"/).captures.first
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
# Return SDK version
|
59
|
+
teak_sdk_version
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.description
|
63
|
+
"Download the Teak SDK"
|
64
|
+
end
|
65
|
+
|
66
|
+
def self.return_value
|
67
|
+
"The version of the Teak SDK which was downloaded or copied"
|
68
|
+
end
|
69
|
+
|
70
|
+
def self.authors
|
71
|
+
["Pat Wilson"]
|
72
|
+
end
|
73
|
+
|
74
|
+
def self.available_options
|
75
|
+
[
|
76
|
+
FastlaneCore::ConfigItem.new(key: :sdk,
|
77
|
+
env_name: "FL_TEAK_SDK_TYPE",
|
78
|
+
description: "The type of Teak SDK, one of: #{TEAK_SDKS.keys.inspect}",
|
79
|
+
optional: false,
|
80
|
+
type: Object,
|
81
|
+
verify_block: proc do |value|
|
82
|
+
UI.user_error!("Value should be a String or Symbol") unless value.kind_of?(String) || value.kind_of?(Symbol)
|
83
|
+
UI.user_error!("Value should be one of: #{TEAK_SDKS.keys.inspect}") unless TEAK_SDKS.keys.include?(value.to_s.downcase)
|
84
|
+
end),
|
85
|
+
FastlaneCore::ConfigItem.new(key: :destination,
|
86
|
+
env_name: "FL_TEAK_SDK_DESTINATION",
|
87
|
+
description: "The destination path for the Teak SDK",
|
88
|
+
optional: false,
|
89
|
+
type: String,
|
90
|
+
verify_block: proc do |value|
|
91
|
+
UI.user_error!("Directory does not exist (#{value})") unless File.exist?(value)
|
92
|
+
end),
|
93
|
+
FastlaneCore::ConfigItem.new(key: :version,
|
94
|
+
env_name: "FL_TEAK_SDK_VERSION",
|
95
|
+
description: "The version of the Teak SDK to install, defaults to latest",
|
96
|
+
default_value: nil,
|
97
|
+
optional: true,
|
98
|
+
type: String),
|
99
|
+
FastlaneCore::ConfigItem.new(key: :source,
|
100
|
+
env_name: "FL_TEAK_SDK_SOURCE",
|
101
|
+
description: "Local source for the Teak SDK repository",
|
102
|
+
default_value: nil,
|
103
|
+
optional: true,
|
104
|
+
verify_block: proc do |value|
|
105
|
+
UI.user_error!("Directory does not exist (#{value})") unless File.exist?(value)
|
106
|
+
UI.user_error!("'Teak.unitypackage' or 'io.teak.sdk.Teak.ane' SDK not found in (#{value})") unless File.exist?(File.join(value, 'Teak.unitypackage')) || File.exist?(File.join(value, 'bin', 'Teak.unitypackage'))
|
107
|
+
end)
|
108
|
+
]
|
109
|
+
end
|
110
|
+
|
111
|
+
def self.is_supported?(platform)
|
112
|
+
true
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'fastlane_core/ui/ui'
|
2
|
+
require 'securerandom'
|
3
|
+
require 'match'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
module Fastlane
|
7
|
+
UI = FastlaneCore::UI unless Fastlane.const_defined?("UI")
|
8
|
+
|
9
|
+
module Helper
|
10
|
+
class TeakHelper
|
11
|
+
# class methods that you define here become available in your action
|
12
|
+
# as `Helper::TeakHelper.your_method`
|
13
|
+
#
|
14
|
+
def self.show_message
|
15
|
+
UI.message("Hello from the teak plugin helper!")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Execute a block that will be provided with a path to a p12, a provisioning profile, and a passphrase
|
19
|
+
def self.with_credentials_for(app_id, type: 'development')
|
20
|
+
keychain_name = SecureRandom.hex
|
21
|
+
|
22
|
+
# Create temporary keychain
|
23
|
+
Actions::CreateKeychainAction.run(
|
24
|
+
name: keychain_name,
|
25
|
+
default_keychain: false,
|
26
|
+
unlock: true,
|
27
|
+
timeout: 10,
|
28
|
+
lock_when_sleeps: true,
|
29
|
+
password: SecureRandom.hex
|
30
|
+
)
|
31
|
+
|
32
|
+
# Download the certificates
|
33
|
+
params = FastlaneCore::Configuration.create(Match::Options.available_options, {
|
34
|
+
app_identifier: app_id,
|
35
|
+
type: type,
|
36
|
+
readonly: true,
|
37
|
+
keychain_name: keychain_name
|
38
|
+
})
|
39
|
+
Actions::MatchAction.run(params)
|
40
|
+
|
41
|
+
# Get the location of the provisioning profile
|
42
|
+
provisioning_profile_path_env = Match::Utils.environment_variable_name_profile_path(
|
43
|
+
app_identifier: app_id,
|
44
|
+
type: type
|
45
|
+
)
|
46
|
+
|
47
|
+
# Export p12
|
48
|
+
Dir.mktmpdir do |tmpdir|
|
49
|
+
p12_password = SecureRandom.hex
|
50
|
+
p12_file = File.join(tmpdir, "temp.p12")
|
51
|
+
Actions.sh("security", "export", "-k", keychain_name, "-t", "identities",
|
52
|
+
"-f", "pkcs12", "-P", p12_password, "-o", p12_file, log: false)
|
53
|
+
|
54
|
+
# Call block
|
55
|
+
yield(p12_file, p12_password, ENV[provisioning_profile_path_env])
|
56
|
+
end
|
57
|
+
ensure
|
58
|
+
# Cleanup temporary keychain
|
59
|
+
Actions::DeleteKeychainAction.run(name: keychain_name)
|
60
|
+
end
|
61
|
+
|
62
|
+
def self.with_kms_for(file, ciphertext)
|
63
|
+
Dir.mktmpdir do |tmpdir|
|
64
|
+
temp_file = File.join(tmpdir, SecureRandom.hex)
|
65
|
+
Actions.sh("openssl", "enc", "-d", "-aes-256-cbc", "-in", file, "-out", temp_file, "-k",
|
66
|
+
`aws kms decrypt --ciphertext-blob fileb://#{ciphertext} --output text --query Plaintext | base64 --decode`.force_encoding('BINARY'), log: false)
|
67
|
+
yield(temp_file)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fastlane/plugin/teak/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Teak
|
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::Teak.all_classes.each do |current|
|
15
|
+
require current
|
16
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-teak
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pat Wilson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: xcodeproj
|
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.92.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.92.1
|
153
|
+
description:
|
154
|
+
email: pat@teak.io
|
155
|
+
executables: []
|
156
|
+
extensions: []
|
157
|
+
extra_rdoc_files: []
|
158
|
+
files:
|
159
|
+
- LICENSE
|
160
|
+
- README.md
|
161
|
+
- lib/fastlane/plugin/teak.rb
|
162
|
+
- lib/fastlane/plugin/teak/actions/teak_action.rb
|
163
|
+
- lib/fastlane/plugin/teak/actions/teak_extensions.rb
|
164
|
+
- lib/fastlane/plugin/teak/actions/teak_sdk_action.rb
|
165
|
+
- lib/fastlane/plugin/teak/helper/teak_helper.rb
|
166
|
+
- lib/fastlane/plugin/teak/version.rb
|
167
|
+
homepage: https://github.com/GoCarrot/fastlane-plugin-teak
|
168
|
+
licenses:
|
169
|
+
- MIT
|
170
|
+
metadata: {}
|
171
|
+
post_install_message:
|
172
|
+
rdoc_options: []
|
173
|
+
require_paths:
|
174
|
+
- lib
|
175
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
requirements:
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '0'
|
185
|
+
requirements: []
|
186
|
+
rubyforge_project:
|
187
|
+
rubygems_version: 2.7.3
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: Fastlane plugins for the Teak SDK
|
191
|
+
test_files: []
|