add local storage (project folder) type for match
This commit is contained in:
parent
be9bbb971e
commit
d0f6f7d6a8
|
|
@ -2,6 +2,14 @@ $appName = File.basename(Dir['../*.xcworkspace'].first, '.*')
|
|||
|
||||
require_relative 'fastlane/touchlane/lib/touchlane'
|
||||
|
||||
# ugly hack to add support for custom storage
|
||||
|
||||
Match.module_eval do
|
||||
def self.storage_modes
|
||||
return %w(git google_cloud s3 local)
|
||||
end
|
||||
end
|
||||
|
||||
private_lane :installDependencies do |options|
|
||||
podsReposPath = File.expand_path "~/.cocoapods/repos/master/"
|
||||
lockFilePath = "#{podsReposPath}/.git/index.lock"
|
||||
|
|
@ -339,21 +347,23 @@ lane :ManuallyUpdateCodeSigning do |options|
|
|||
end
|
||||
|
||||
def sync_code_signing_using_options(options)
|
||||
Match::Storage.register_backend(type: 'local', storage_class: Touchlane::LocalStorage)
|
||||
Match::Encryption.register_backend(type: 'local', encryption_class: Match::Encryption::OpenSSL)
|
||||
|
||||
signing_identities_path = File.expand_path "../EncryptedSigningIdentities"
|
||||
|
||||
match(
|
||||
app_identifier: options[:app_identifier],
|
||||
username: options[:username] || options[:apple_id],
|
||||
team_id: options[:team_id],
|
||||
type: options[:type],
|
||||
readonly: options[:readonly].nil? ? true : options[:readonly],
|
||||
storage_mode: "git",
|
||||
git_url: options[:git_url],
|
||||
git_branch: "fastlane_certificates",
|
||||
shallow_clone: true,
|
||||
clone_branch_directly: true,
|
||||
keychain_name: options[:keychain_name],
|
||||
keychain_password: options[:keychain_password],
|
||||
storage_mode: "local",
|
||||
# we can't pass signing_identities_path as parameter name since params is hardcoded in match/runner.rb
|
||||
git_url: signing_identities_path,
|
||||
skip_docs: true,
|
||||
platform: "ios"
|
||||
keychain_name: options[:keychain_name],
|
||||
keychain_password: options[:keychain_password]
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,82 @@
|
|||
require 'match'
|
||||
require 'fileutils'
|
||||
require 'fastlane_core/ui/ui'
|
||||
|
||||
module Touchlane
|
||||
class LocalStorage < Match::Storage::Interface
|
||||
attr_accessor :signing_identities_path
|
||||
|
||||
def self.configure(params)
|
||||
return self.new(
|
||||
# we can't pass signing_identities_path since params is hardcoded in match/runner.rb
|
||||
signing_identities_path: params[:git_url]
|
||||
)
|
||||
end
|
||||
|
||||
def initialize(signing_identities_path: nil)
|
||||
self.signing_identities_path = signing_identities_path
|
||||
end
|
||||
|
||||
def prefixed_working_directory
|
||||
return working_directory
|
||||
end
|
||||
|
||||
def download
|
||||
# Check if we already have a functional working_directory
|
||||
return if @working_directory
|
||||
|
||||
# No existing working directory, creating a new one now
|
||||
self.working_directory = Dir.mktmpdir
|
||||
|
||||
Dir.mkdir(self.signing_identities_path) unless File.exists?(self.signing_identities_path)
|
||||
|
||||
FileUtils.cp_r("#{self.signing_identities_path}/.", self.working_directory)
|
||||
end
|
||||
|
||||
def human_readable_description
|
||||
"Local folder [#{self.signing_identities_path}]"
|
||||
end
|
||||
|
||||
def upload_files(files_to_upload: [], custom_message: nil)
|
||||
# `files_to_upload` is an array of files that need to be moved to signing identities dir
|
||||
# Those doesn't mean they're new, it might just be they're changed
|
||||
# Either way, we'll upload them using the same technique
|
||||
|
||||
Dir.mkdir(self.signing_identities_path) unless File.exists?(self.signing_identities_path)
|
||||
|
||||
files_to_upload.each do |current_file|
|
||||
# Go from
|
||||
# "/var/folders/px/bz2kts9n69g8crgv4jpjh6b40000gn/T/d20181026-96528-1av4gge/profiles/development/Development_me.mobileprovision"
|
||||
# to
|
||||
# "profiles/development/Development_me.mobileprovision"
|
||||
#
|
||||
|
||||
# We also have to remove the trailing `/` as Google Cloud doesn't handle it nicely
|
||||
target_path = current_file.gsub(self.working_directory + "/", "")
|
||||
FileUtils.cp_r(current_file, File.join(self.signing_identities_path, target_path), remove_destination: true)
|
||||
end
|
||||
end
|
||||
|
||||
def delete_files(files_to_delete: [], custom_message: nil)
|
||||
files_to_delete.each do |file_name|
|
||||
target_path = current_file.gsub(self.working_directory + "/", "")
|
||||
File.delete(File.join(self.signing_identities_path, target_path))
|
||||
end
|
||||
end
|
||||
|
||||
def skip_docs
|
||||
false
|
||||
end
|
||||
|
||||
def list_files(file_name: "", file_ext: "")
|
||||
Dir[File.join(working_directory, "**", file_name, "*.#{file_ext}")]
|
||||
end
|
||||
|
||||
def generate_matchfile_content
|
||||
path = Fastlane::UI.input("Path to the signing identities folder: ")
|
||||
|
||||
return "git_url(\"#{path}\")"
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
module Touchlane
|
||||
require_relative "configuration_type"
|
||||
require_relative "configuration"
|
||||
require_relative "touchlane/configuration_type"
|
||||
require_relative "touchlane/configuration"
|
||||
require_relative "match/storage/local_storage"
|
||||
end
|
||||
Loading…
Reference in New Issue