nod 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nod/gem_savvy.rb +13 -4
- metadata +1 -1
data/lib/nod/gem_savvy.rb
CHANGED
@@ -33,18 +33,27 @@ class GemSavvy
|
|
33
33
|
|
34
34
|
def git_clone_url(gem_name)
|
35
35
|
http_url = gem_home gem_name
|
36
|
-
if !http_url.nil? && http_url.include?('http://github.com')
|
37
|
-
|
36
|
+
if !http_url.nil? && http_url.include?('http://github.com')
|
37
|
+
get_sub_string(http_url, 'http://')
|
38
|
+
elsif !http_url.nil? && http_url.include?('https://github.com')
|
39
|
+
get_sub_string(http_url, 'https://')
|
38
40
|
else
|
39
41
|
http_url = gem_source_home gem_name
|
40
42
|
if !http_url.nil? && http_url.include?('http://github.com')
|
41
|
-
|
43
|
+
get_sub_string(http_url, 'http://')
|
42
44
|
elsif !http_url.nil? && http_url.include?('http://www.github.com')
|
43
|
-
|
45
|
+
get_sub_string(http_url, 'http://www.')
|
44
46
|
else
|
45
47
|
nil
|
46
48
|
end
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
def get_sub_string(http_url, to_replace)
|
53
|
+
if http_url.end_with?('/')
|
54
|
+
http_url = http_url[0..-2]
|
55
|
+
end
|
56
|
+
"#{http_url.gsub(to_replace, 'git://')}.git"
|
57
|
+
end
|
58
|
+
|
50
59
|
end
|