Sha256: e2bf48f4831da7a3a35c0cd25aba7a9e38319f90f1cadd69177a3bf17aea6014

Contents?: true

Size: 619 Bytes

Versions: 2

Compression:

Stored size: 619 Bytes

Contents

# frozen_string_literal: true

module Envkeeper
  def self.git_remote_list
    @git_remote_list ||= Git.new.remote_list
  end

  class Git
    def remote_list
      git_remote_fetch_list.compact
    end

    private

    def git_remote_fetch_list
      raw_remote_list.map do |remote|
        remote.gsub!(' (fetch)', '').split("\t")[1] if remote.include?('fetch')
      end
    end

    def raw_remote_list
      Dir.chdir(execution_path) do
        `#{git_remote_command}`
      end.split("\n")
    end

    def execution_path
      Dir.pwd
    end

    def git_remote_command
      'git remote -v'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
envkeeper-0.1.2 lib/envkeeper/git.rb
envkeeper-0.1.1 lib/envkeeper/git.rb