Redo project versions to use tags and branches for build. Refs #2261

This commit is contained in:
Pavel Chipiga 2011-11-30 02:22:26 +02:00
parent 4f46b82914
commit 3a2215d0ee
3 changed files with 14 additions and 6 deletions

View File

@ -126,7 +126,7 @@ class BuildListsController < ApplicationController
def find_project_versions
@git_repository = @project.git_repository
@project_versions = @project.collected_project_versions
@project_versions = @project.versions
end
def find_build_list_by_bs

View File

@ -99,7 +99,7 @@ class ProjectsController < ApplicationController
@arches = Arch.recent
@bpls = Platform.main
@pls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.name}", rep.platform.id] }
@project_versions = @project.collected_project_versions
@project_versions = @project.versions
end
def process_build
@ -115,7 +115,7 @@ class ProjectsController < ApplicationController
update_type = params[:build][:update_type]
build_requires = params[:build][:build_requires]
@project_versions = @project.collected_project_versions
@project_versions = @project.versions
if !check_arches || !check_project_versions
@arches = Arch.recent

View File

@ -48,18 +48,26 @@ class Project < ActiveRecord::Base
end
end
# TODO deprecate and remove project_versions and collected_project_versions ?
def project_versions
res = tags.select{|tag| tag.name =~ /^v\./}
return res if res and res.size > 0
tags
end
end
def collected_project_versions
project_versions.collect{|tag| tag.name.gsub(/^\w+\./, "")}
end
def tags
self.git_repository.tags.sort_by{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i}
self.git_repository.tags #.sort_by{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i}
end
def branches
self.git_repository.branches
end
def versions
tags.map(&:name) + branches.map{|b| "latest_#{b.name}"}
end
def members