Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion lib/rubygems_plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,27 @@ def use_ghq?
ENV['GEMSRC_USE_GHQ'] || Gem.configuration[:gemsrc_use_ghq]
end

def cloned?
if use_ghq?
candidates = [
installer.spec.homepage,
github_url(installer.spec.homepage),
source_code_uri,
homepage_uri,
github_url(homepage_uri),
github_organization_uri(installer.spec.name)
].compact.map do |uri|
uri.gsub(%r|https?://|, '')
end
cloned_repos = `ghq list`.split
!(cloned_repos & candidates).empty?
else
File.exist? clone_dir
end
end

def git_clone_homepage_or_source_code_uri_or_homepage_uri_or_github_organization_uri
return false if File.exist? clone_dir
return false if cloned?
git_clone(installer.spec.homepage) ||
git_clone(github_url(installer.spec.homepage)) ||
git_clone(source_code_uri) ||
Expand Down