Sha256: f12e73857ba24ca3f4cb8c0dad216b7e426f15eaae0848bbb973a29b8dc2f9f2

Contents?: true

Size: 736 Bytes

Versions: 69

Compression:

Stored size: 736 Bytes

Contents

class KuberKit::Shell::Commands::GitCommands
  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

  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

  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
end

Version data entries

69 entries across 69 versions & 1 rubygems

Version Path
kuber_kit-0.6.4 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.6.3 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.6.2 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.6.1 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.6.0 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.10 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.9 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.8 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.7 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.6 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.5 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.4 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.3 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.2 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.1 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.5.0 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.4.9 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.4.8 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.4.7 lib/kuber_kit/shell/commands/git_commands.rb
kuber_kit-0.4.6 lib/kuber_kit/shell/commands/git_commands.rb