Commit 5f6131b
Changed files (1)
lib
jive
lib/jive/repo.rb
@@ -12,12 +12,7 @@ module Jive
remote = @repo.remotes.find { |x| x.name == "origin" }
return if remote.nil?
- if (match = remote.url.match(SSH_REGEX))
- ["https:/", match[:host], match[:account], match[:repo], @repo.head.name].join("/")
- else
- uri = URI.parse(remote.url)
- [uri.host, uri.path, @repo.head.name].join("/")
- end
+ ssh?(remote) ? url_for_ssh(remote) : url_for(remote)
end
class << self
@@ -25,5 +20,27 @@ module Jive
@current ||= new(Pathname.pwd)
end
end
+
+ private
+
+ def ssh?(remote)
+ remote.url.match?(SSH_REGEX)
+ end
+
+ def url_for_ssh(remote)
+ match = remote.url.match(SSH_REGEX)
+ [
+ "https:/",
+ match[:host],
+ match[:account],
+ match[:repo],
+ @repo.head.name
+ ].join("/")
+ end
+
+ def url_for(remote)
+ uri = URI.parse(remote.url)
+ [uri.host, uri.path, @repo.head.name].join("/")
+ end
end
end