#34: rename Project#git_project_address method

This commit is contained in:
Vokhmin Alexey V 2013-05-16 20:00:58 +04:00
parent 26ac9baf5a
commit 994f400af0
2 changed files with 8 additions and 7 deletions

View File

@ -431,7 +431,7 @@ class BuildList < ActiveRecord::Base
urpmi_list(nil, nil, false, save_to_repository.name)["#{build_for_platform.name}"]["#{arch.name}"]
end
git_project_address = project.git_project_address(user)
git_project_address = project.git_url user
# git_project_address.gsub!(/^http:\/\/(0\.0\.0\.0|localhost)\:[\d]+/, 'https://abf.rosalinux.ru') unless Rails.env.production?
{
:id => id,

View File

@ -138,15 +138,20 @@ class Project < ActiveRecord::Base
owner == user
end
def git_project_address(auth_user = nil)
def html_url(auth_user = nil)
host ||= EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
protocol = APP_CONFIG['mailer_https_url'] ? "https" : "http" rescue "http"
opts = {:host => host, :protocol => protocol}
opts.merge!({:user => auth_user.authentication_token, :password => ''}) if auth_user && !self.public?
Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, opts) + ".git"
Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, opts)
#path #share by NFS
end
def git_url(auth_user)
html_url(auth_user) + '.git'
end
def build_for(platform, repository_id, user, arch = Arch.find_by_name('i586'), auto_publish = false, mass_build_id = nil, priority = 0)
# Select main and project platform repository(contrib, non-free and etc)
# If main does not exist, will connect only project platform repository
@ -242,10 +247,6 @@ class Project < ActiveRecord::Base
@archive ||= create_archive treeish, format
end
def html_url
git_project_address.gsub(/.git$/, '')
end
protected
def create_archive(treeish, format)