Skip to content

Commit 76eb46b

Browse files
committed
Check cloneable by git
Case in using ghq. gem-src many send requests to the hompage when execute `gem i bundler` but that is not url for git. It takes many time. So I want to check it is git url before execute `git clone #{repository}`.
1 parent cdaab79 commit 76eb46b

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ This requires ghq (https://github.com/motemen/ghq) to be installed, and either o
8888

8989
1) `GEMSRC_USE_GHQ` environment variable
9090
2) add `gemsrc_use_ghq` configuration in your .gemrc
91+
3) Install nmap command needed for checking that URL is cloneable by git
9192

9293
The directory structure should be like below in this mode.
9394

lib/rubygems_plugin.rb

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ def git_clone(repository)
121121
return if @tested_repositories.include? repository
122122
@tested_repositories << repository
123123
return if github?(repository) && !github_page_exists?(repository)
124+
return unless `nmap -sT -p 9418 #{URI.parse(repository).host}` =~ /open/
124125

125126
puts "gem-src: #{installer.spec.name} - Cloning from #{repository}..." if verbose?
126127

0 commit comments

Comments
 (0)