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.33.1 lib/takelage/git/check/workspace.rb
takelage-0.32.4 lib/takelage/git/check/workspace.rb
takelage-0.32.3 lib/takelage/git/check/workspace.rb
takelage-0.32.1 lib/takelage/git/check/workspace.rb
takelage-0.32.0 lib/takelage/git/check/workspace.rb
takelage-0.31.0 lib/takelage/git/check/workspace.rb
takelage-0.30.6 lib/takelage/git/check/workspace.rb
takelage-0.30.5 lib/takelage/git/check/workspace.rb
takelage-0.30.1 lib/takelage/git/check/workspace.rb
takelage-0.30.0 lib/takelage/git/check/workspace.rb
takelage-0.29.14 lib/takelage/git/check/workspace.rb
takelage-0.29.13 lib/takelage/git/check/workspace.rb
takelage-0.29.11 lib/takelage/git/check/workspace.rb
takelage-0.29.10 lib/takelage/git/check/workspace.rb
takelage-0.29.8 lib/takelage/git/check/workspace.rb
takelage-0.29.6 lib/takelage/git/check/workspace.rb
takelage-0.29.0 lib/takelage/git/check/workspace.rb
takelage-0.28.26 lib/takelage/git/check/workspace.rb
takelage-0.28.24 lib/takelage/git/check/workspace.rb
takelage-0.28.14 lib/takelage/git/check/workspace.rb