nod 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/nod/gem_savvy.rb +13 -4
  2. metadata +1 -1
@@ -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
- "#{http_url.gsub('http://', 'git://')}.git"
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
- "#{http_url.gsub('http://', 'git://')}.git"
43
+ get_sub_string(http_url, 'http://')
42
44
  elsif !http_url.nil? && http_url.include?('http://www.github.com')
43
- "#{http_url.gsub('http://www.', 'git://')}.git"
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
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: nod
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.6
5
+ version: 0.0.7
6
6
  platform: ruby
7
7
  authors:
8
8
  - Andrew Glover