Last active
May 23, 2018 11:24
-
-
Save MSavisko/af5321b5cd4cc6e5376eb890167b3466 to your computer and use it in GitHub Desktop.
Script for manually decrypt and encrypt match repo via fastlane and ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Decrypt match repo" | |
lane :match_decrypt_repo do |values| | |
require 'match' | |
git_url = values[:git_url] ? ENV["MATCH_GIT_URL"] : nil | |
#Check git_url name | |
if git_url == nil | |
git_url = UI.input("Provide git_url for match repo: ") | |
if git_url == nil | |
UI.crash! "git_url parameter is empty. Define MATCH_GIT_URL" | |
end | |
end | |
shallow_clone = false | |
#Check password | |
password = values[:password] ? ENV["MATCH_PASSWORD"] : nil | |
if password == nil | |
password = UI.password("Provide password for match repo: ") | |
if password == nil | |
UI.crash! "password parameter is empty. Define MATCH_PASSWORD" | |
end | |
end | |
#Check git_branch | |
git_branch = values[:git_branch] ? values[:git_branch] : nil | |
if git_branch == nil | |
git_branch = UI.input("Provide git_branch for match repo: ") | |
if git_branch == nil | |
git_branch = "master" | |
end | |
end | |
workspace = Match::GitHelper.clone(git_url, shallow_clone, manual_password: password, branch: git_branch) | |
UI.success("Decrypted repo") | |
UI.success("Url: #{git_url}") | |
UI.success("Branch: #{git_branch}") | |
UI.success("Path: #{workspace}") | |
workspace | |
end | |
desc "Encrypt match repo on path" | |
lane :match_encrypt_repo do |values| | |
require 'match' | |
path = values[:path] | |
message = values[:message] | |
git_url = values[:git_url] | |
git_branch = values[:git_branch] | |
#Check path | |
if path == nil | |
path = UI.input("Provide local repo path to encrypt: ") | |
if path == nil | |
UI.crash! "path parameter is empty." | |
end | |
end | |
#Check message | |
if message == nil | |
message = UI.input("Provide commit message: ") | |
if message == nil | |
UI.crash! "message parameter is empty." | |
end | |
end | |
#Check git_url | |
if git_url == nil | |
git_url = UI.input("Provide git_url to push changes: ") | |
if git_url == nil | |
UI.crash! "git_url parameter is empty." | |
end | |
end | |
if git_branch == nil | |
git_branch = UI.input("Provide git_branch to push changes: ") | |
if git_branch == nil | |
git_branch = "master" | |
end | |
end | |
Match::GitHelper.commit_changes(path, message, git_url, git_branch) | |
UI.success("Encrypt and push repo") | |
UI.success("Url: #{git_url}") | |
UI.success("Branch: #{git_branch}") | |
UI.success("Path: #{path}") | |
UI.success("Message: #{message}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment