Add tags ordering, check and fix. Refactor auto_build. Refs #test_prepare
This commit is contained in:
parent
fb6b25bc82
commit
cbfa5858d4
|
@ -128,7 +128,7 @@ class BuildListsController < ApplicationController
|
|||
|
||||
def find_project_versions
|
||||
@git_repository = @project.git_repository
|
||||
@project_versions = @project.project_versions
|
||||
@project_versions = @project.collected_project_versions
|
||||
end
|
||||
|
||||
def find_build_list_by_bs
|
||||
|
|
|
@ -64,21 +64,12 @@ class ProjectsController < ApplicationController
|
|||
uname, unixname = params[:git_repo].split('/')
|
||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
||||
project = Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_unixname!(unixname)
|
||||
auto_build_list = AutoBuildList.find_by_project_id(project.id)
|
||||
project.auto_build
|
||||
|
||||
# p = params.delete_if{|k,v| k == 'controller' or k == 'action'}
|
||||
# ActiveSupport::Notifications.instrument("event_log.observer", :object => project, :message => p.inspect)
|
||||
logger.info "Git hook recieved from #{params[:git_user]} to #{params[:git_repo]}"
|
||||
|
||||
BuildList.create!(
|
||||
:project => project,
|
||||
:pl => auto_build_list.pl,
|
||||
:bpl => auto_build_list.bpl,
|
||||
:arch => auto_build_list.arch,
|
||||
:project_version => project.collected_project_versions.last.try(:first),
|
||||
:build_requires => true,
|
||||
:update_type => 'bugfix') if auto_build_list
|
||||
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
|
|
@ -42,18 +42,30 @@ class Project < ActiveRecord::Base
|
|||
after_destroy :destroy_git_repo
|
||||
after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||
|
||||
def auto_build
|
||||
auto_build_lists.each do |auto_build_list|
|
||||
build_lists.create(
|
||||
:pl => auto_build_list.pl,
|
||||
:bpl => auto_build_list.bpl,
|
||||
:arch => auto_build_list.arch,
|
||||
:project_version => collected_project_versions.last,
|
||||
:build_requires => true,
|
||||
:update_type => 'bugfix')
|
||||
end
|
||||
end
|
||||
|
||||
def project_versions
|
||||
res = tags.select { |tag| tag.name =~ /^v\./ }
|
||||
res = tags.select{|tag| tag.name =~ /^v\./}
|
||||
return res if res and res.size > 0
|
||||
tags
|
||||
end
|
||||
|
||||
|
||||
def collected_project_versions
|
||||
project_versions.collect { |tag| new_tag = tag.name.gsub(/^\w+\./, ""); [new_tag, new_tag] }
|
||||
project_versions.collect{|tag| tag.name.gsub(/^\w+\./, "")}
|
||||
end
|
||||
|
||||
def tags
|
||||
self.git_repository.tags
|
||||
self.git_repository.tags.sort_by(&:name)
|
||||
end
|
||||
|
||||
def members
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
- if @project_versions
|
||||
.group
|
||||
= f.label :project_version, t("activerecord.attributes.build_list.project_version"), :class => :label
|
||||
= f.select :project_version, @project_versions.collect{|project_version| [project_version.name, project_version.name]}, :include_blank => true, :selected => @filter.project_version
|
||||
= f.select :project_version, @project_versions, :include_blank => true, :selected => @filter.project_version
|
||||
|
||||
.group
|
||||
= f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label
|
||||
|
|
Loading…
Reference in New Issue