Fix rake task. Refs #282

This commit is contained in:
Pavel Chipiga 2012-03-08 01:47:48 +02:00
parent cb86ae6959
commit f6a91ec006
1 changed files with 5 additions and 5 deletions

View File

@ -5,15 +5,15 @@ namespace :build do
desc "Build projects from list" desc "Build projects from list"
task :projects => :environment do task :projects => :environment do
source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/rebuild_list.txt' source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/rebuild_list.txt'
user = User.find_by_uname(ENV['USER'] || 'warpc') owner = User.find_by_uname!(ENV['OWNER'] || 'warpc')
platform = Platform.find_by_name(ENV['PLATFORM'] || 'rosa2012lts') platform = Platform.find_by_name!(ENV['PLATFORM'] || 'rosa2012lts')
arch = Arch.find_by_name(ENV['ARCH'] || 'i586') arch = Arch.find_by_name!(ENV['ARCH'] || 'i586')
say "START build projects from #{source} for platform=#{platform.name}, user=#{user.uname}, arch=#{arch.name}" say "START build projects from #{source} for platform=#{platform.name}, owner=#{owner.uname}, arch=#{arch.name}"
open(source).readlines.each do |name| open(source).readlines.each do |name|
name.chomp!; name.strip! #; name.downcase! name.chomp!; name.strip! #; name.downcase!
if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name) if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name)
p.build_for(platform, user, arch) p.build_for(platform, owner, arch)
say "== Build #{p.name} ==" say "== Build #{p.name} =="
else else
say "== Not found #{name} ==" say "== Not found #{name} =="