Merge branch 'master' of github.com:warpc/rosa-build

This commit is contained in:
Vladimir Sharshov 2011-11-18 02:34:43 +04:00
commit b307043ee2
4 changed files with 19 additions and 16 deletions

View File

@ -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

View File

@ -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

View File

@ -42,6 +42,18 @@ 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\./}
return res if res and res.size > 0
@ -49,11 +61,11 @@ class Project < ActiveRecord::Base
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

View File

@ -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