Top Level Namespace

Instance Method Summary collapse

Instance Method Details

#clone_gem_repository(spec) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/rubygems_plugin.rb', line 3

def clone_gem_repository(spec)
  return unless spec

  urls = [spec.homepage, spec.["source_code_uri"]].compact

  git_urls = urls.select do |url|
    url && !url.empty? && url.match?(/github\.com|gitlab\.com/) && !url.match?(/\/tree/)
  end.uniq

  git_urls.each do |git_url|
    puts "#{spec.name}: #{git_url}"
    
    # Check if git-goget is available, if so use git goget instead of ghq get
    if system("which git-goget > /dev/null 2>&1")
      system("git goget #{git_url}")
    else
      system("ghq get #{git_url}")
    end
  end
end