Sha256: 887945f7d73392d78de2c8b56197cff1c7f65131e27f24f675cdf0239bff9a18

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

# frozen_string_literal: true

# takelage git check workspace
module GitCheckWorkspace
  # Backend method for git check workspace.
  # @return [Boolean] is this a git workspace?
  def git_check_workspace
    log.debug 'Check if this is a git workspace'
    status_repo = _git_check_workspace_get_status_repo
    dir = _git_check_workspace_get_dir
    unless status_repo.exitstatus.zero?
      log.debug "No git workspace found in \"#{dir}\""
      return false
    end
    true
  end

  private

  # Get git repository status.
  def _git_check_workspace_get_status_repo
    cmd_git_repo = config.active['cmd_git_check_workspace_git_repo']
    try cmd_git_repo
  end

  # Get current working directory.
  def _git_check_workspace_get_dir
    cmd_pwd =
      config.active['cmd_git_check_workspace_pwd']
    (run cmd_pwd).strip
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
takelage-0.26.4 lib/takelage/git/check/workspace.rb
takelage-0.26.3 lib/takelage/git/check/workspace.rb
takelage-0.26.2 lib/takelage/git/check/workspace.rb