+
+ def ssh_clone_url
+ _clone_url Rails.configuration.Services.GitSSH.andand.ExternalURL, 'ssh://git@git.%s.arvadosapi.com'
+ end
+
+ def https_clone_url
+ _clone_url Rails.configuration.Services.GitHTTP.andand.ExternalURL, 'https://git.%s.arvadosapi.com/'
+ end
+
+ def _clone_url config_var, default_base_fmt
+ if not config_var
+ return ""
+ end
+ prefix = new_record? ? Rails.configuration.ClusterID : uuid[0,5]
+ if prefix == Rails.configuration.ClusterID and config_var != URI("")
+ base = config_var
+ else
+ base = URI(default_base_fmt % prefix)
+ end
+ if base.path == ""
+ base.path = "/"
+ end
+ if base.scheme == "ssh"
+ '%s@%s:%s.git' % [base.user, base.host, name]
+ else
+ '%s%s.git' % [base, name]
+ end
+ end