Class: TestIds::Git::PathToLocal Private

Inherits:
Object
  • Object
show all
Includes:
Origen::Utility::InputCapture
Defined in:
lib/test_ids/git.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

API:

  • private

Instance Method Summary collapse

Instance Method Details

#find ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/test_ids/git.rb', line 21

def find
  repos = Dir.glob("#{Origen.app.imports_dir}/test_ids/*.git")
  if repos.size == 0
    puts 'No TestIds repositories were found in this application'
  elsif repos.size > 1
    puts
    puts 'Multiple TestIDs repositories found, select the one to rollback:'
    puts
    repos.each_with_index do |repo, i|
      puts "  #{i} - #{Pathname.new(repo).basename}"
    end
    accept = repos.map.with_index { |r, i| i }
    puts
    selection = repos.size + 1
    until repos[selection]
      selection = get_text(single: true, accept: accept).to_i
    end
  else
    selection = 0
  end
  repos[selection]
end