class Fastlane::Helper::GitHelper

Public Class Methods

clone_repo_in_tmp(repo_url, branch = 'master', create_branch_if_needed = false) { |pwd| ... } click to toggle source
# File lib/fastlane/plugin/yalantis_ci/helper/git_helper.rb, line 9
def self.clone_repo_in_tmp(repo_url, branch = 'master', create_branch_if_needed = false)
  temp_directory = `mktemp -d`.tr("\n", "")

  begin 
      Dir.chdir(temp_directory) do
          Actions.sh("git clone -b #{branch} #{repo_url} #{Dir.pwd}") do |status, result, cmd|
              if status.success? != true && create_branch_if_needed
                  Actions.sh("git clone #{repo_url} #{Dir.pwd} && git checkout -b #{branch}") do |status, result, cmd |
                      if status.success? != true 
                          raise StandardError.new result
                      end
                  end
              elsif status.success? != true 
                  raise StandardError.new result
              end
          end
          yield(Dir.pwd)
      end
  ensure 
      Actions.sh("rm -rf #{temp_directory}")
  end
end
show_message() click to toggle source
# File lib/fastlane/plugin/yalantis_ci/helper/git_helper.rb, line 32
def self.show_message
  UI.message("Hello from the yalantis_ci plugin helper!")
end