Method: Match::GitHelper.commit_changes

Defined in:
lib/match/git_helper.rb

.commit_changes(path, message, git_url, branch = "master") ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/match/git_helper.rb', line 55

def self.commit_changes(path, message, git_url, branch = "master")
  Dir.chdir(path) do
    return if `git status`.include?("nothing to commit")

    Encrypt.new.encrypt_repo(path: path, git_url: git_url)
    File.write("match_version.txt", Match::VERSION) # unencrypted

    commands = []
    commands << "git add -A"
    commands << "git commit -m #{message.shellescape}"
    commands << "git push origin #{branch.shellescape}"

    UI.message "Pushing changes to remote git repo..."

    commands.each do |command|
      FastlaneCore::CommandExecutor.execute(command: command,
                                          print_all: $verbose,
                                      print_command: $verbose)
    end
  end
  FileUtils.rm_rf(path)
  @dir = nil
end