Sha256: 33b087b56a112994e60ebb20832fc3a177bd2d7882e13a53381fa80cb0e39ffa

Contents?: true

Size: 885 Bytes

Versions: 27

Compression:

Stored size: 885 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(dir = _git_check_workspace_get_dir)
    log.debug "Check if \"#{dir}\" is a git workspace"
    status_repo = _git_check_workspace_get_status_repo(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(dir)
    cmd_git_repo = format(
      config.active['cmd_git_check_workspace_git_repo'],
      dir: dir
    )
    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).chomp
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
takelage-0.28.11 lib/takelage/git/check/workspace.rb
takelage-0.28.8 lib/takelage/git/check/workspace.rb
takelage-0.28.7 lib/takelage/git/check/workspace.rb
takelage-0.28.5 lib/takelage/git/check/workspace.rb
takelage-0.27.1 lib/takelage/git/check/workspace.rb
takelage-0.27.0 lib/takelage/git/check/workspace.rb
takelage-0.26.7 lib/takelage/git/check/workspace.rb