Merge branch 'master' into smart_http

Conflicts:
	app/controllers/projects_controller.rb
	app/models/build_list.rb
	app/models/project.rb
This commit is contained in:
Pavel Chipiga 2011-11-18 11:59:21 +02:00
commit 5f39e76b12
7 changed files with 30 additions and 27 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

@ -65,7 +65,7 @@ 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)
project.auto_build
project.delay.auto_build # TODO don't queue duplicates
# p = params.delete_if{|k,v| k == 'controller' or k == 'action'}
# ActiveSupport::Notifications.instrument("event_log.observer", :object => project, :message => p.inspect)

View File

@ -25,8 +25,8 @@ class BuildList < ActiveRecord::Base
WAITING_FOR_RESPONSE = 4000
BUILD_PENDING = 2000
BUILD_STARTED = 3000
TEST_FAILD = 2
BUILD_PUBLISHED = 6000
TEST_FAILD = 21
STATUSES = [WAITING_FOR_RESPONSE,
BuildServer::SUCCESS,

View File

@ -51,19 +51,21 @@ class Platform < ActiveRecord::Base
def urpmi_list(host, pair = nil)
blank_pair = {:login => 'login', :pass => 'password'}
pair = blank_pair if pair.blank?
urpmi_commands = []
urpmi_commands = ActiveSupport::OrderedHash.new
pls = Platform.main.open
#pls << self
pls.each do |pl|
Platform.main.open.each do |pl|
urpmi_commands[pl.name] = []
local_pair = pl.id != self.id ? blank_pair : pair
#tail = (pl.id != self.id && pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : ""
tail = (pl.distrib_type == APP_CONFIG['distr_types'].first) ? "/$ARCH/main/release" : ""
head = self.hidden? ? "http://#{ local_pair[:login] }@#{ local_pair[:pass] }:#{ host }/private/" : "http://#{ host }/downloads/"
urpmi_commands << [
"urpmi.addmedia #{ head }#{ self.unixname }/repository/#{ pl.unixname }#{ tail }",
pl.name
]
head = hidden? ? "http://#{local_pair[:login]}@#{local_pair[:pass]}:#{host}/private/" : "http://#{host}/downloads/"
if pl.distrib_type == APP_CONFIG['distr_types'].first
Arch.all.each do |arch|
tail = "/#{arch.name}/main/release"
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
end
else
tail = ''
urpmi_commands[pl.name] << "urpmi.addmedia #{unixname} #{head}#{unixname}/repository/#{pl.unixname}#{tail}"
end
end
return urpmi_commands

View File

@ -45,24 +45,24 @@ class Project < ActiveRecord::Base
:pl => auto_build_list.pl,
:bpl => auto_build_list.bpl,
:arch => auto_build_list.arch,
:project_version => collected_project_versions.last.try(:first),
:project_version => collected_project_versions.last,
:build_requires => true,
:update_type => 'bugfix')
:update_type => 'bugfix') unless build_lists.for_creation_date_period(Time.current - 15.seconds, Time.current).present?
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{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i}
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

View File

@ -1,9 +1,10 @@
.group
%span Данные для подключения:
.group{:style => 'padding-left: 10px'}
- urpmi_commands.each do |urpmi_command|
= urpmi_command[1] + ":"
- urpmi_commands.each do |platform, commands|
#{platform}:
.group{:style => 'padding-left: 20px'}
%span= urpmi_command[0]
%br
- commands.each do |command|
%span= command
%br
%br