class KuberKit::Shell::Commands::GitCommands
Public Instance Methods
download_repo(shell, remote_url:, path:, branch:)
click to toggle source
# File lib/kuber_kit/shell/commands/git_commands.rb, line 11 def download_repo(shell, remote_url:, path:, branch:) shell.exec! [ "rm -rf #{path}", "mkdir -p #{path}", "git clone -b #{branch} --depth 1 #{remote_url} #{path}", ].join(" && ") end
force_pull_repo(shell, path:, branch:)
click to toggle source
# File lib/kuber_kit/shell/commands/git_commands.rb, line 19 def force_pull_repo(shell, path:, branch:) shell.exec! [ "cd #{path}", "git add .", "git reset HEAD --hard", "git checkout #{branch}", "git pull --force", ].join(" && ") end
get_remote_url(shell, git_repo_path, remote_name: "origin")
click to toggle source
# File lib/kuber_kit/shell/commands/git_commands.rb, line 2 def get_remote_url(shell, git_repo_path, remote_name: "origin") shell.exec! [ "cd #{git_repo_path}", "git config --get remote.#{remote_name}.url", ].join(" && ") rescue KuberKit::Shell::AbstractShell::ShellError return nil end