Class: Fastlane::Helper::GitHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/fastlane/plugin/yalantis_ci/helper/git_helper.rb

Class Method Summary collapse

Class Method Details

.clone_repo_in_tmp(repo_url:, branch: 'master', create_branch: false) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/fastlane/plugin/yalantis_ci/helper/git_helper.rb', line 8

def self.clone_repo_in_tmp(repo_url:, branch: 'master', create_branch: 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
                  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_messageObject



31
32
33
# File 'lib/fastlane/plugin/yalantis_ci/helper/git_helper.rb', line 31

def self.show_message
  UI.message("Hello from the yalantis_ci plugin helper!")
end