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

This commit is contained in:
George Vinogradov 2011-10-24 14:48:07 +04:00
commit 51ed1f3bab
34 changed files with 421 additions and 239 deletions

1
.gitignore vendored
View File

@ -13,3 +13,4 @@ config/initializers/local.rb
public/system/*
.rvmrc
*.swp
*.tmproj

View File

@ -26,6 +26,10 @@ gem 'delayed_job'
gem 'whenever', :require => false
gem 'unicorn'
# XML-RPC support
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
gem "rails-xmlrpc"
group :production do
gem "airbrake"
# gem 'newrelic_rpm', '~> 3.1.1'

View File

@ -182,6 +182,7 @@ GEM
activesupport (= 3.0.10)
bundler (~> 1.0)
railties (= 3.0.10)
rails-xmlrpc (0.3.2)
rails3-generators (0.17.4)
railties (>= 3.0.0)
railties (3.0.10)
@ -270,6 +271,7 @@ DEPENDENCIES
paperclip (~> 2.3)
pg (~> 0.11.0)
rails (= 3.0.10)
rails-xmlrpc
rails3-generators
rspec-rails (~> 2.7.0)
ruby-debug

View File

@ -1,118 +1,133 @@
class BuildListsController < ApplicationController
before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :find_platform, :only => [:index, :filter, :show, :publish]
before_filter :find_repository, :only => [:index, :filter, :show, :publish]
before_filter :find_project, :only => [:index, :filter, :show, :publish]
before_filter :find_arches, :only => [:index, :filter]
before_filter :find_branches, :only => [:index, :filter]
before_filter :authenticate_user!, :except => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :authenticate_build_service!, :only => [:status_build, :pre_build, :post_build, :circle_build, :new_bbdt]
before_filter :find_project, :only => [:index, :filter, :show, :publish]
before_filter :find_arches, :only => [:index, :filter, :all]
before_filter :find_project_versions, :only => [:index, :filter]
before_filter :find_build_list_by_bs, :only => [:status_build, :pre_build, :post_build]
before_filter :find_build_list_by_bs, :only => [:status_build, :pre_build, :post_build]
def index
@build_lists = @project.build_lists.recent.paginate :page => params[:page]
@filter = BuildList::Filter.new(@project)
end
def filter
@filter = BuildList::Filter.new(@project, params[:filter])
@build_lists = @filter.find.paginate :page => params[:page]
render :action => "index"
end
def show
@build_list = @project.build_lists.find(params[:id])
@item_groups = @build_list.items.group_by_level
end
def publish
@build_list = @project.build_lists.find(params[:id])
@build_list.publish
def all
if params[:filter]
@filter = BuildList::Filter.new(nil, params[:filter])
@build_lists = @filter.find.paginate :page => params[:page]
else
@filter = BuildList::Filter.new(nil)
@build_lists = BuildList.paginate :page => params[:page]
end
@action_url = all_build_lists_path
redirect_to platform_repository_project_build_lists_path(@platform, @repository, @project)
end
render :action => 'index'
end
def cancel
build_list = BuildList.find(params[:id])
if build_list.delete_build_list
redirect_to :back, :notice => t('layout.build_lists.cancel_successed')
else
redirect_to :back, :notice => t('layout.build_lists.cancel_failed')
end
end
def status_build
@item = @build_list.items.find_by_name!(params[:package_name])
@item.status = params[:status]
@item.save
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
def index
@build_lists = @project.build_lists.recent.paginate :page => params[:page]
@filter = BuildList::Filter.new(@project)
@action_url = project_build_lists_path(@project)
end
@build_list.save
def filter
@filter = BuildList::Filter.new(@project, params[:filter])
@build_lists = @filter.find.paginate :page => params[:page]
@action_url = project_build_lists_path(@project)
render :nothing => true, :status => 200
end
render :action => "index"
end
def pre_build
@build_list.status = BuildList::BUILD_STARTED
@build_list.notified_at = Time.now
def show
@build_list = @project.build_lists.find(params[:id])
@item_groups = @build_list.items.group_by_level
end
def publish
@build_list = @project.build_lists.find(params[:id])
@build_list.publish
redirect_to project_build_lists_path(@project)
end
@build_list.save
def status_build
@item = @build_list.items.find_by_name!(params[:package_name])
@item.status = params[:status]
@item.save
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
render :nothing => true, :status => 200
end
@build_list.save
def post_build
@build_list.status = params[:status]
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
render :nothing => true, :status => 200
end
@build_list.save
def pre_build
@build_list.status = BuildList::BUILD_STARTED
@build_list.notified_at = Time.now
render :nothing => true, :status => 200
end
@build_list.save
def circle_build
@build_list.is_circle = true
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
render :nothing => true, :status => 200
end
@build_list.save
def post_build
@build_list.status = params[:status]
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
render :nothing => true, :status => 200
end
@build_list.save
def new_bbdt
@build_list = BuildList.find_by_id!(params[:web_id])
@build_list.name = params[:name]
@build_list.additional_repos = ActiveSupport::JSON.decode(params[:additional_repos])
@build_list.set_items(ActiveSupport::JSON.decode(params[:items]))
@build_list.notified_at = Time.now
@build_list.is_circle = (params[:is_circular] != "0")
@build_list.bs_id = params[:id]
params[:arch]
@build_list.save
render :nothing => true, :status => 200
end
render :nothing => true, :status => 200
end
def circle_build
@build_list.is_circle = true
@build_list.container_path = params[:container_path]
@build_list.notified_at = Time.now
protected
def find_platform
@platform = Platform.find params[:platform_id]
end
@build_list.save
def find_repository
@repository = @platform.repositories.find(params[:repository_id])
end
render :nothing => true, :status => 200
end
def find_project
@project = @repository.projects.find params[:project_id]
end
def new_bbdt
@build_list = BuildList.find_by_id!(params[:web_id])
@build_list.name = params[:name]
@build_list.additional_repos = ActiveSupport::JSON.decode(params[:additional_repos])
@build_list.set_items(ActiveSupport::JSON.decode(params[:items]))
@build_list.notified_at = Time.now
@build_list.is_circle = (params[:is_circular] != "0")
@build_list.bs_id = params[:id]
params[:arch]
@build_list.save
def find_arches
@arches = Arch.recent
end
render :nothing => true, :status => 200
end
def find_branches
@git_repository = @project.git_repository
@branches = @git_repository.branches
end
protected
def find_project
@project = Project.find params[:project_id]
end
def find_build_list_by_bs
@build_list = BuildList.find_by_bs_id!(params[:id])
end
def find_arches
@arches = Arch.recent
end
def find_project_versions
@git_repository = @project.git_repository
@project_versions = @project.project_versions
end
def find_build_list_by_bs
@build_list = BuildList.find_by_bs_id!(params[:id])
end
end

View File

@ -1,8 +1,6 @@
class Git::BaseController < ApplicationController
before_filter :authenticate_user!
before_filter :find_platform
before_filter :find_repository
before_filter :find_project
before_filter :find_git_repository
before_filter :find_tags
@ -12,16 +10,8 @@ class Git::BaseController < ApplicationController
before_filter :set_current_branch
protected
def find_platform
@platform = Platform.find(params[:platform_id])
end
def find_repository
@repository = @platform.repositories.find(params[:repository_id])
end
def find_project
@project = @repository.projects.find(params[:project_id])
@project = Project.find(params[:project_id])
end
def find_git_repository

View File

@ -1,7 +1,5 @@
class ProjectsController < ApplicationController
before_filter :authenticate_user!
# before_filter :find_platform
# before_filter :find_repository
before_filter :find_project, :only => [:show, :destroy, :build, :process_build]
before_filter :get_paths, :only => [:new, :create]
@ -14,33 +12,48 @@ class ProjectsController < ApplicationController
end
def build
@branches = @project.git_repository.branches
@arches = Arch.recent
@pls = Platform.main
@bpls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
@project_versions = @project.project_versions.collect { |tag| [tag.name.gsub(/^\w+\./, ""), tag.name] }.select { |pv| pv[1] =~ /^v\./ }
end
def process_build
@arch_ids = params[:build][:arches].select{|_,v| v == "1"}.collect{|x| x[0].to_i }
@arches = Arch.where(:id => @arch_ids)
@branches = @project.git_repository.branches
@branch = @branches.select{|branch| branch.name == params[:build][:branch] }.first
@project_version = params[:build][:project_version]
if !check_arches || !check_branches
pls_ids = params[:build][:pl].blank? ? [] : params[:build][:pl].select{|_,v| v == "1"}.collect{|x| x[0].to_i }
pls = Platform.where(:id => pls_ids)
bpl = Platform.find params[:build][:bpl]
update_type = params[:build][:update_type]
build_requires = params[:build][:build_requires]
@project_versions = @project.project_versions.collect { |tag| [tag.name.gsub(/^\w+\./, ""), tag.name] }.select { |pv| pv[1] =~ /^v\./ }
if !check_arches || !check_project_versions
@arches = Arch.recent
@pls = Platform.main
@bpls = @project.repositories.collect { |rep| ["#{rep.platform.name}/#{rep.unixname}", rep.platform.id] }
render :action => "build"
else
flash[:notice], flash[:error] = "", ""
@arches.each do |arch|
build_list = @project.build_lists.new(:arch => arch, :branch_name => @branch.name)
pls.each do |pl|
build_list = @project.build_lists.new(:arch => arch, :project_version => @project_version, :pl => pl, :bpl => bpl, :update_type => update_type, :build_requires => build_requires)
if build_list.save
flash[:notice] += t("flash.build_list.saved", :branch_name => @branch.name, :arch => arch.name)
else
flash[:error] += t("flash.build_list.save_error", :branch_name => @branch.name, :arch => arch.name)
if build_list.save
flash[:notice] += t("flash.build_list.saved", :project_version => @project_version, :arch => arch.name, :pl => pl.name, :bpl => bpl)
else
flash[:error] += t("flash.build_list.save_error", :project_version => @project_version, :arch => arch.name, :pl => pl.name, :bpl => bpl)
end
end
end
redirect_to platform_repository_project_path(@platform, @repository, @project)
redirect_to project_path(@project)
end
end
@ -62,7 +75,8 @@ class ProjectsController < ApplicationController
@project.destroy
flash[:notice] = t("flash.project.destroyed")
redirect_to platform_repository_path(@platform, @repository)
#redirect_to platform_repository_path(@platform, @repository)
redirect_to root_path
end
protected
@ -82,14 +96,6 @@ class ProjectsController < ApplicationController
end
end
def find_platform
@platform = Platform.find params[:platform_id]
end
def find_repository
@repository = @platform.repositories.find(params[:repository_id])
end
def find_project
@project = Project.find params[:id]
end
@ -106,12 +112,12 @@ class ProjectsController < ApplicationController
end
end
def check_branches
if @branch.blank?
flash[:error] = t("flash.build_list.no_branch_selected")
def check_project_versions
if @project_version.blank?
flash[:error] = t("flash.build_list.no_project_version_selected")
false
elsif !@branches.include?(@branch)
flash[:error] = t("flash.build_list.no_branch_found")
elsif !@project_versions.flatten.include?(@project_version)
flash[:error] = t("flash.build_list.no_project_version_found", :project_version => @project_version)
false
else
true

View File

@ -0,0 +1,36 @@
class RpcController < ApplicationController
exposes_xmlrpc_methods
before_filter :authenticate_user!
## Usage example:
#
# require 'xmlrpc/client'
# client = XMLRPC::Client.new("127.0.0.1", '/api/xmlrpc', 3000, nil, nil, 'user@email', 'password', false, 900)
# client.call("project_versions", 1)
def platforms
return Platform.select('id, unixname').where("platform_type = ?", 'main').map(&:attributes)
end
def user_projects
current_user.projects.map{|pr| { :id => pr.id, :unixname => pr.unixname } }
end
def project_versions id
pr = Project.findby_id(id)
return nil if pr.blank?
pr.project_versions.collect { |tag| [tag.name.gsub(/^\w+\./, ""), tag.name] }.select { |pv| pv[1] =~ /^v\./ }
end
def build_status id
BuildList.find_by_id(id).try(:status)
end
def build_packet project_id, repo_id
# TODO: build packet
end
end

View File

@ -4,25 +4,25 @@ module GitHelper
# TODO: Looks ugly, rewrite with clear mind.
if @path.present?
if @treeish == "master"
res = "#{link_to @project.name, tree_path(@platform, @repository, @project)} / "
res = "#{link_to @project.name, tree_path(@project)} / "
else
res = "#{link_to @project.name, tree_path(@platform, @repository, @project, @treeish)} / "
res = "#{link_to @project.name, tree_path(@project, @treeish)} / "
end
parts = @path.split("/")
current_path = parts.first
res += parts.length == 1 ? parts.first : link_to(parts.first, tree_path(@platform, @repository, @project, @treeish, current_path)) + " / "
res += parts.length == 1 ? parts.first : link_to(parts.first, tree_path(@project, @treeish, current_path)) + " / "
parts[1..-2].each do |part|
current_path = File.join([current_path, part].compact)
res += link_to(part, tree_path(@platform, @repository, @project, @treeish, current_path))
res += link_to(part, tree_path(@project, @treeish, current_path))
res += " / "
end
res += parts.last if parts.length > 1
else
res = "#{link_to @project.name, tree_path(@platform, @repository, @project)} /"
res = "#{link_to @project.name, tree_path(@project)} /"
end
res.html_safe

View File

@ -1,11 +1,23 @@
class BuildList < ActiveRecord::Base
belongs_to :project
belongs_to :arch
belongs_to :pl, :class_name => 'Platform'
belongs_to :bpl, :class_name => 'Platform'
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
validates :project_id, :presence => true
validates :branch_name, :presence => true
validates :project_version, :presence => true
#validates_inclusion_of :update_type, :in => UPDATE_TYPES#, :message => "extension %s is not included in the list"
UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage]
validates :update_type, :inclusion => UPDATE_TYPES
validate lambda {
errors.add(:pl, I18n.t('flash.build_list.wrong_platform')) if bpl.platform_type == 'main' && pl_id != bpl_id
}
BUILD_CANCELED = 5000
WAITING_FOR_RESPONSE = 4000
BUILD_PENDING = 2000
BUILD_STARTED = 3000
@ -18,7 +30,7 @@ class BuildList < ActiveRecord::Base
BuildServer::PLATFORM_NOT_FOUND,
BuildServer::PLATFORM_PENDING,
BuildServer::PROJECT_NOT_FOUND,
BuildServer::BRANCH_NOT_FOUND]
BuildServer::PROJECT_VERSION_NOT_FOUND]
HUMAN_STATUSES = { BuildServer::BUILD_ERROR => :build_error,
BUILD_PENDING => :build_pending,
@ -28,17 +40,17 @@ class BuildList < ActiveRecord::Base
BuildServer::PLATFORM_NOT_FOUND => :platform_not_found,
BuildServer::PLATFORM_PENDING => :platform_pending,
BuildServer::PROJECT_NOT_FOUND => :project_not_found,
BuildServer::BRANCH_NOT_FOUND => :branch_not_found
BuildServer::PROJECT_VERSION_NOT_FOUND => :project_version_not_found
}
scope :recent, order("created_at DESC")
scope :current, lambda {
outdatable_statuses = [BuildServer::SUCCESS, BuildServer::ERROR, BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_PENDING, BuildServer::PROJECT_NOT_FOUND, BuildServer::BRANCH_NOT_FOUND]
outdatable_statuses = [BuildServer::SUCCESS, BuildServer::ERROR, BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_PENDING, BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND]
where(["status in (?) OR (status in (?) AND notified_at >= ?)", [WAITING_FOR_RESPONSE, BUILD_PENDING, BUILD_STARTED], outdatable_statuses, Time.now - 2.days])
}
scope :for_status, lambda {|status| where(:status => status) }
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
scope :scoped_to_branch, lambda {|branch| where(:branch_name => branch) }
scope :scoped_to_project_version, lambda {|project_version| where(:project_version => project_version) }
scope :scoped_to_is_circle, lambda {|is_circle| where(:is_circle => is_circle) }
scope :for_creation_date_period, lambda{|start_date, end_date|
if start_date && end_date
@ -93,6 +105,18 @@ class BuildList < ActiveRecord::Base
self.status == BuildServer::SUCCESS
end
def delete_build_list
has_canceled = BuildServer.delete_build_list bs_id
update_attribute(:status, BUILD_CANCELED) if has_canceled
return has_canceled == 0
end
#TODO: Share this checking on product owner.
def can_canceled?
self.status == BUILD_PENDING
end
private
def set_default_status
self.status = WAITING_FOR_RESPONSE unless self.status.present?
@ -100,10 +124,11 @@ class BuildList < ActiveRecord::Base
end
def place_build
self.status = BuildServer.add_build_list project.name, branch_name, project.repository.platform.name, arch.name, id
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web
self.status = BuildServer.add_build_list project.name, project_version, pl.unixname, arch.name, bpl.unixname, update_type, build_requires, id
self.status = BUILD_PENDING if self.status == 0
save
end
#handle_asynchronously :place_build
end
end

View File

@ -7,11 +7,15 @@ class BuildList::Filter
end
def find
build_lists = @project.build_lists.recent
if @project.nil?
build_lists = BuildList.scoped
else
build_lists = @project.build_lists.recent
end
build_lists = build_lists.for_status(@options[:status]) if @options[:status]
build_lists = build_lists.scoped_to_arch(@options[:arch_id]) if @options[:arch_id]
build_lists = build_lists.scoped_to_branch(@options[:branch_name]) if @options[:branch_name]
build_lists = build_lists.scoped_to_project_version(@options[:project_version]) if @options[:project_version]
build_lists = build_lists.scoped_to_is_circle(@options[:is_circle]) if @options[:is_circle].present?
if @options[:created_at_start] || @options[:created_at_end]
@ -44,7 +48,7 @@ class BuildList::Filter
:notified_at_end => nil,
:arch_id => nil,
:is_circle => nil,
:branch_name => nil
:project_version => nil
}))
@options[:status] = @options[:status].present? ? @options[:status].to_i : nil
@ -52,7 +56,7 @@ class BuildList::Filter
@options[:created_at_end] = build_date_from_params(:created_at_end, @options)
@options[:notified_at_start] = build_date_from_params(:notified_at_start, @options)
@options[:notified_at_end] = build_date_from_params(:notified_at_end, @options)
@options[:branch_name] = @options[:branch_name].present? ? @options[:branch_name] : nil
@options[:project_version] = @options[:project_version].present? ? @options[:project_version] : nil
@options[:arch_id] = @options[:arch_id].present? ? @options[:arch_id].to_i : nil
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
end

View File

@ -27,6 +27,7 @@ class Platform < ActiveRecord::Base
scope :by_visibilities, lambda {|v| {:conditions => ['visibility in (?)', v.join(',')]}}
attr_accessible :visibility
scope :main, where(:platform_type => 'main')
def path
build_path(unixname)

View File

@ -33,6 +33,9 @@ class Project < ActiveRecord::Base
# before_destroy :xml_rpc_destroy
attr_accessible :visibility
def project_versions
self.git_repository.tags
end
def members
collaborators + groups
@ -40,7 +43,7 @@ class Project < ActiveRecord::Base
# Redefining a method from Project::HasRepository module to reflect current situation
def git_repo_path
@git_repo_path ||= File.join(repository.platform.path, "projects", unixname + ".git")
@git_repo_path ||= File.join("#{APP_CONFIG['git_projects_path']}/#{owner.uname}/#{self.unixname}.git")
end
def path
@ -72,8 +75,10 @@ class Project < ActiveRecord::Base
end
end
#TODO: Remove it from code if git_repo_path and build_path (or path) have the same purpose
def build_path(dir)
File.join(APP_CONFIG['root_path'], 'projects', dir)
#File.join(APP_CONFIG['root_path'], 'projects', dir)
File.join("#{APP_CONFIG['git_projects_path']}/#{owner.uname}/#{dir}.git")
end
def create_directory

View File

@ -2,20 +2,24 @@
%tr
%th.first= t("activerecord.attributes.build_list.bs_id")
%th= t("activerecord.attributes.build_list.status")
%th= t("activerecord.attributes.build_list.branch_name")
%th= t("activerecord.attributes.build_list.project_version")
%th= t("activerecord.attributes.build_list.project")
%th= t("activerecord.attributes.build_list.arch")
%th= t("activerecord.attributes.build_list.is_circle")
- if controller.action_name = 'all'
%th= t("layout.build_lists.cancel_button_header")
%th.last= t("activerecord.attributes.build_list.notified_at")
- build_lists.each do |build_list|
%tr{:class => cycle("odd", "even")}
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), platform_repository_project_build_list_path(@platform, @repository, @project, build_list)
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), project_build_list_path(build_list.project, build_list)
%td= build_list.human_status
%td= link_to build_list.branch_name, "#"
%td= link_to build_list.project.name, platform_repository_project_path(@platform, @repository, @project)
%td= link_to build_list.project_version, "#"
%td= link_to build_list.project.name, project_path(build_list.project)
%td= build_list.arch.name
%td= t("layout.#{build_list.is_circle?}_")
- if controller.action_name = 'all'
%td= link_to t("layout.build_lists.cancel_button"), build_list_cancel_path(build_list) if build_list.can_canceled?
%td.last= build_list.notified_at
= will_paginate build_lists

View File

@ -1,6 +1,6 @@
%h2.title= t("layout.build_lists.filter_header")
= form_for :filter, :url => filter_platform_repository_project_build_lists_path(@platform, @repository, @project) , :html => { :method => :post, :class => :form } do |f|
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|
.columns.wat-cf
.column.left
@ -13,10 +13,10 @@
= f.select :arch_id, @arches.collect{|arch| [arch.name, arch.id]}, :include_blank => true, :selected => @filter.arch_id
.column.right
.group
= f.label :branch_name, "Branch", :class => :label
= f.select :branch_name, @branches.collect{|branch| [branch.name, branch.name]}, :include_blank => true, :selected => @filter.branch_name
- 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
.group
= f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label

View File

@ -1,15 +1,16 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.build_lists.current"), platform_repository_project_path(@platform, @repository, @project) + "#build_lists"
%li.active= link_to t("layout.build_lists.all"), platform_repository_project_build_lists_path(@platform, @repository, @project)
- if controller.action_name != 'all'
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.build_lists.current"), project_path(@project) + "#build_lists"
%li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project)
.content
.inner
= render :partial => "build_lists/filter"
= render :partial => "build_lists/filter", :action_url => @action_url
.inner
= render :partial => "build_lists/build_lists", :object => @build_lists
- content_for :sidebar, render(:partial => 'sidebar')
- content_for :sidebar, render(:partial => 'sidebar') if controller.action_name != 'all'

View File

@ -1,9 +1,9 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.build_lists.current"), platform_repository_project_path(@platform, @repository, @project) + "#build_lists"
%li= link_to t("layout.build_lists.all"), platform_repository_project_build_lists_path(@platform, @repository, @project)
%li.active= link_to t("layout.build_lists.show"), platform_repository_project_build_list_path(@platform, @repository, @project, @build_list)
%li.first= link_to t("layout.build_lists.current"), project_path(@project) + "#build_lists"
%li= link_to t("layout.build_lists.all"), project_build_lists_path(@project)
%li.active= link_to t("layout.build_lists.show"), project_build_list_path(@project, @build_list)
.content
.inner
@ -29,9 +29,9 @@
= @build_list.human_status
%p
%b
= t("activerecord.attributes.build_list.branch_name")
= t("activerecord.attributes.build_list.project_version")
\:
= @build_list.branch_name
= @build_list.project_version
%p
%b
= t("activerecord.attributes.build_list.project")
@ -60,7 +60,7 @@
= @build_list.additional_repos
- if @build_list.can_published?
.wat-cf
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.publish")) + " " + t("layout.publish"), publish_platform_repository_project_build_list_path(@platform, @repository, @project, @build_list), :method => "post", :class => "button", :confirm => t("layout.build_lists.confirm_publish")
= link_to image_tag("web-app-theme/icons/cross.png", :alt => t("layout.publish")) + " " + t("layout.publish"), publish_project_build_list_path(@project, @build_list), :method => "post", :class => "button", :confirm => t("layout.build_lists.confirm_publish")
.block
.content

View File

@ -16,7 +16,7 @@
.blob_header
.size #{(@blob.size / 1024.0).round(3)} Kb
.buttons
#{link_to "Raw", raw_commit_path(@platform, @repository, @project, @commit_hash, @path)} #{link_to "Normal", blob_path(@platform, @repository, @project, @treeish, @path)} #{link_to "History", commits_path(@platform, @repository, @project, @treeish, @path)}
#{link_to "Raw", raw_commit_path(@project, @commit_hash, @path)} #{link_to "Normal", blob_path(@project, @treeish, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
.clear
.blame_data
%table.table.blame
@ -24,7 +24,7 @@
- @blame.each do |elem|
%tr
%td.message{ :rowspan => elem[1].length }
.commit #{link_to shortest_hash_id(elem[0].id), commit_path(@platform, @repository, @project, elem[0].id)} by #{elem[0].author} #{elem[0].author != elem[0].committer ? "(#{elem[0].committer})" : "" }
.commit #{link_to shortest_hash_id(elem[0].id), commit_path(@project, elem[0].id)} by #{elem[0].author} #{elem[0].author != elem[0].committer ? "(#{elem[0].committer})" : "" }
.message
%span.date= commit_date(elem[0].committed_date)
%span.message= short_commit_message(elem[0].message)

View File

@ -18,9 +18,9 @@
.size #{(@blob.size / 1024.0).round(3)} Kb
.buttons
- if @commit_hash
#{link_to "Raw", raw_commit_path(@platform, @repository, @project, @commit_hash, @path)} #{link_to "Blame", blame_commit_path(@platform, @repository, @project, @commit_hash, @path)} #{link_to "History", commits_path(@platform, @repository, @project, @treeish, @path)}
#{link_to "Raw", raw_commit_path(@project, @commit_hash, @path)} #{link_to "Blame", blame_commit_path(@project, @commit_hash, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
- else
#{link_to "Raw", raw_path(@platform, @repository, @project, @treeish, @path)} #{link_to "Blame", blame_path(@platform, @repository, @project, @treeish, @path)} #{link_to "History", commits_path(@platform, @repository, @project, @treeish, @path)}
#{link_to "Raw", raw_path(@project, @treeish, @path)} #{link_to "Blame", blame_path(@project, @treeish, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
.clear
%table.table.blob
%tr

View File

@ -8,7 +8,7 @@
.size= h(commit_diff.a_path)
- if commit_diff.b_path.present?
.buttons
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@platform, @repository, @project, @commit.id, commit_diff.b_path))
= link_to("view file @ #{short_hash_id(@commit.id)}", blob_commit_path(@project, @commit.id, commit_diff.b_path))
.clear
.diff_data

View File

@ -9,18 +9,18 @@
.committer
(committed by: #{commit.committer}, #{commit_date(commit.committed_date)})
%td.message
%p= link_to commit.message, commit_path(@platform, @repository, @project, commit.id)
%p= link_to commit.message, commit_path(@project, commit.id)
%td.trees
.commit
Commit:
%span{ :style => "float: right;"}
#{link_to short_hash_id(commit.id), commit_path(@platform, @repository, @project, commit.id)}
#{link_to short_hash_id(commit.id), commit_path(@project, commit.id)}
.tree
Tree:
%span{ :style => "float: right;"}
#{link_to short_hash_id(commit.tree.id), tree_path(@platform, @repository, @project, :treeish => commit.tree.id)}
#{link_to short_hash_id(commit.tree.id), tree_path(@project, :treeish => commit.tree.id)}
- commit.parents.each do |parent|
.parent
Parent:
%span{ :style => "float: right;"}
#{link_to short_hash_id(parent.id), tree_path(@platform, @repository, @project, :treeish => parent.id)}
#{link_to short_hash_id(parent.id), tree_path(@project, :treeish => parent.id)}

View File

@ -1,9 +1,9 @@
- if @page == 1
%span.prev_page.disabled « Previous
- else
%a.next_page{ :rel => "prev", :href => commits_path(@platform, @repository, @project, :treeish => @treeish, :page => (@page - 1)) } « Previous
%a.next_page{ :rel => "prev", :href => commits_path(@project, :treeish => @treeish, :page => (@page - 1)) } « Previous
- if @last_page
%span.next_page.disabled Next »
- else
%a.next_page{ :rel => "next", :href => commits_path(@platform, @repository, @project, :treeish => @treeish, :page => (@page + 1)) } Next »
%a.next_page{ :rel => "next", :href => commits_path(@project, :treeish => @treeish, :page => (@page + 1)) } Next »

View File

@ -13,7 +13,7 @@
.content
.inner
.patch_and_diff
#{link_to "raw diff", commit_path(@platform, @repository, @project, @commit.id, :diff)} | #{link_to "patch", commit_path(@platform, @repository, @project, @commit.id, :patch)}
#{link_to "raw diff", commit_path(@project, @commit.id, :diff)} | #{link_to "patch", commit_path(@project, @commit.id, :patch)}
.clear

View File

@ -25,7 +25,7 @@
%tr.odd
%td
%td.icon
= link_to "..", tree_path(@platform, @repository, @project, @treeish, File.join([@path, ".."].compact))
= link_to "..", tree_path(@project, @treeish, File.join([@path, ".."].compact))
%td== &nbsp;
%td.last== &nbsp;
- (@tree.trees + @tree.blobs).each do |entry|
@ -37,9 +37,9 @@
= image_tag("git/icons/folder_16.png")
%td.tree_element
- if entry.is_a?(Grit::Blob)
= link_to entry.name, blob_path(@platform, @repository, @project, @treeish, File.join([@path, entry.name].compact))
= link_to entry.name, blob_path(@project, @treeish, File.join([@path, entry.name].compact))
- else
= link_to "#{entry.name}/", tree_path(@platform, @repository, @project, @treeish, File.join([@path, entry.name].compact))
= link_to "#{entry.name}/", tree_path(@project, @treeish, File.join([@path, entry.name].compact))
%td== &nbsp;
%td.last== &nbsp;

View File

@ -10,10 +10,10 @@
%p
%b Tag:
= link_to @current_tag.name, tree_path(@platform, @repository, @project, :treeish => @current_tag.name)
= link_to @current_tag.name, tree_path(@project, :treeish => @current_tag.name)
- if @current_branch.present?
%p
%b Branch:
= link_to @current_branch.name, tree_path(@platform, @repository, @project, :treeish => @current_branch.name)
= link_to @current_branch.name, tree_path(@project, :treeish => @current_branch.name)

View File

@ -1,7 +1,7 @@
.secondary-navigation
%ul.wat-cf
%li.first.active= link_to t("layout.git.repositories.source"), platform_repository_project_repo_path(@platform, @repository, @project)
%li= link_to t("layout.git.repositories.commits"), commits_path(@platform, @repository, @project, :treeish => @treeish)
%li.first.active= link_to t("layout.git.repositories.source"), project_repo_path(@project)
%li= link_to t("layout.git.repositories.commits"), commits_path(@project, :treeish => @treeish)
%ul#git_submenu.sub-wat-cf.wat-cf
%li
@ -11,7 +11,7 @@
- if branch.name == @treesh
%span.current= branch.name
- else
= link_to branch.name, tree_path(@platform, @repository, @project, :treeish => branch.name)
= link_to branch.name, tree_path(@project, :treeish => branch.name)
%li
%a{ :href => "#", :onmouseover => "menu.open('tags')", :onmouseout => "menu.close_time()" } Tags
@ -20,5 +20,5 @@
- if tag.name == @treeish
%span.current= tag.name
- else
= link_to tag.name, tree_path(@platform, @repository, @project, :treeish => tag.name)
= link_to tag.name, tree_path(@project, :treeish => tag.name)
.clear

View File

@ -1,14 +1,4 @@
.block.notice
%h3= t("layout.platforms.current_platform_header")
.content
%p= link_to @platform.name, platform_path(@platform)
.block.notice
%h3= t("layout.repositories.current_repository_header")
.content
%p= link_to @repository.name + repository_name_postfix(@platform), platform_repository_path(@platform, @repository)
.block.notice
%h3= t("layout.projects.current_project_header")
.content
%p= link_to @project.name, platform_repository_path(@platform, @repository) + "#projects"
%p= link_to @project.name, project_path(@project)

View File

@ -1,22 +1,38 @@
.block
.secondary-navigation
%ul.wat-cf
%li.first= link_to t("layout.projects.list"), platform_repository_path(@platform, @repository) + "#projects"
%li= link_to t("layout.projects.new"), new_platform_repository_project_path(@platform, @repository)
%li= link_to t("layout.projects.show"), platform_repository_project_path(@platform, @repository, @project)
%li= link_to "git-repo", platform_repository_project_repo_path(@platform, @repository, @project)
%li.active= link_to t("layout.projects.build"), build_platform_repository_project_path(@platform, @repository, @project)
%li.first=# link_to t("layout.projects.list"), platform_repository_path(@platform, @repository) + "#projects"
%li= link_to t("layout.projects.new"), new_project_path
%li= link_to t("layout.projects.show"), project_path(@project)
%li=# link_to "git-repo", project_repo_path(@platform, @repository, @project)
%li.active= link_to t("layout.projects.build"), build_project_path(@project)
.content
%h2.title= t("layout.projects.new_build")
.inner
= form_for :build, :url => process_build_platform_repository_project_path(@platform, @repository, @project), :html => { :class => :form, :method => :post } do |f|
= form_for :build, :url => process_build_project_path(@project), :html => { :class => :form, :method => :post } do |f|
.columns.wat-cf
.column.left
.group
= f.label :branch, "Branch", :class => :label
= f.select :branch, @branches.collect{|branch| [branch.name, branch.name]}
= f.label :project_version, t("activerecord.attributes.build_list.project_version"), :class => :label
= f.select :project_version, @project_versions
.group.pl_ids_container
= f.label :pl, t("activerecord.attributes.build_list.pl"), :class => :label
- @pls.each do |pl|
= f.check_box "pl[#{pl.id}]", :pl_id => pl.id, :class => 'build_pl_ids'
= pl.name
%br
.group
= f.label :update_type, t("activerecord.attributes.build_list.update_type"), :class => :label
= f.select :update_type, BuildList::UPDATE_TYPES.collect { |ut| [ut, ut] }
.group
= f.check_box :build_requires
= t("activerecord.attributes.build_list.build_requires")
.column.right
.group
@ -25,13 +41,16 @@
= f.check_box "arches[#{arch.id}]"
= arch.name
%br
.group
= f.label :bpl, t("activerecord.attributes.build_list.bpl"), :class => :label
= f.select :bpl, @bpls
.group.navform.wat-cf
%button.button{:type => "submit"}
= image_tag("web-app-theme/icons/tick.png", :alt => t("layout.projects.build_button"))
= t("layout.projects.build_button")
%span.text_button_padding= t("layout.or")
= link_to t("layout.cancel"), platform_repository_path(@platform, @repository), :class => "text_button_padding link_button"
= link_to t("layout.cancel"), root_path, :class => "text_button_padding link_button"
- content_for :sidebar, render(:partial => 'sidebar')
-# content_for :sidebar, render(:partial => 'sidebar')

View File

@ -4,8 +4,8 @@
%li.first= link_to t("layout.projects.list"), projects_path
%li= link_to t("layout.projects.new"), new_project_path
%li.active= link_to t("layout.projects.show"), project_path(@project)
%li= link_to "git-repo", '#'#platform_repository_project_repo_path(@platform, @repository, @project)
%li= link_to t("layout.projects.build"), '#'#build_platform_repository_project_path(@platform, @repository, @project)
%li= link_to "git-repo", project_repo_path(@project)
%li= link_to t("layout.projects.build"), build_project_path(@project)
.content
.inner

View File

@ -187,6 +187,7 @@ ru:
commits: Commits
tags: Tags
branches: Branches
project_versions: Версии
build_lists:
filter_header: Фильтр
@ -201,7 +202,11 @@ ru:
no_items_data: Данных нет
show: Просмотр
confirm_publish: Вы уверены, что хотите опубликовать контейнер?
cancel_button_header: Действие
cancel_button: Отмена
cancel_successed: 'Сборка отменена.'
cancel_failed: 'При отмене сборки произошла ошибка!'
items:
statuses:
build_error: ошибка сборки
@ -223,7 +228,7 @@ ru:
platform_not_found: платформа не найдена
platform_pending: платформа в процессе создания
project_not_found: проект не найден
branch_not_found: бранч не найден
project_version_not_found: версия не найден
flash:
category:
@ -271,12 +276,13 @@ ru:
destroyed: Платформа успешно удалена
build_list:
saved: Билд лист для бранча '%{branch_name}' и архитектуры '%{arch}' создан успешно
save_error: Не удалось сохранить билд лист для бранча '%{branch_name}' и архитектуры '%{arch}'
no_branch_selected: Выберите какой-нибудь бранч
no_branch_found: Выбранный бранч '%{branch_name}' не найден
saved: Билд лист для версии '%{project_version}', платформу '%{pl}' и архитектуры '%{arch}' создан успешно
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформу '%{pl}' и архитектуры '%{arch}'
no_project_version_selected: Выберите какую-нибудь версию
no_project_version_found: Выбранная версия '%{project_version}' не найдена
no_arch_selected: Выберите хотя бы одну ахритектуру
no_arch_found: Выбранные ахритектуры не найдены
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
attributes:
password: Пароль
@ -415,7 +421,6 @@ ru:
name: Название
container_path: Путь до контейнера
status: Статус
branch_name: Branch
project_id: Проект
project: Проект
arch_id: Архитектура
@ -425,6 +430,13 @@ ru:
additional_repos: Дополнительные репозитории
updated_at: Обновлен
created_at: Создан
bpl: Репозиторий для сохранения пакетов
bpl_id: Репозиторий для сохранения пакетов
pl: Платформа
pl_id: Платформа
update_type: Критичность обновления
build_requires: Пересборка с зависимостями
project_version: Версия
build_list/item:
name: Название

View File

@ -1,14 +1,20 @@
Rosa::Application.routes.draw do
# XML RPC
match 'api/xmlrpc' => 'rpc#xe_index'
devise_for :users, :controllers => {:omniauth_callbacks => 'users/omniauth_callbacks'} do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
end
resources :users
resources :roles
resources :event_logs, :only => :index
resources :downloads, :only => :index
#resources :downloads, :only => :index
match 'statistics/' => 'downloads#index', :as => :downloads
resources :categories do
get :platforms, :on => :collection
@ -16,6 +22,9 @@ Rosa::Application.routes.draw do
match '/private/:platform_name/*file_path' => 'privates#show'
match 'build_lists/' => 'build_lists#all', :as => :all_build_lists
match 'build_lists/:id/cancel/' => 'build_lists#cancel', :as => :build_list_cancel
resources :platforms do
resources :private_users
@ -39,6 +48,7 @@ Rosa::Application.routes.draw do
end
resources :projects do
resource :repo, :controller => "git/repositories", :only => [:show]
resources :build_lists, :only => [:index, :show] do
collection do
get :recent
@ -48,6 +58,11 @@ Rosa::Application.routes.draw do
post :publish
end
end
member do
get :build
post :process_build
end
end
resources :repositories do
@ -74,23 +89,23 @@ Rosa::Application.routes.draw do
match 'product_status', :to => 'products#product_status'
# Tree
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
match '/projects/:project_id/git/tree/:treeish(/*path)', :controller => "git/trees", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :tree
# Commits
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commits/:treeish(/*path)', :controller => "git/commits", :action => :index, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :commits
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/:id(.:format)', :controller => "git/commits", :action => :show, :defaults => { :format => :html }, :as => :commit
match '/projects/:project_id/git/commits/:treeish(/*path)', :controller => "git/commits", :action => :index, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :commits
match '/projects/:project_id/git/commit/:id(.:format)', :controller => "git/commits", :action => :show, :defaults => { :format => :html }, :as => :commit
# Blobs
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :platform_name => /[0-9a-zA-Z_.\-]*/, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit
match '/projects/:project_id/git/blob/:treeish/*path', :controller => "git/blobs", :action => :show, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blob
match '/projects/:project_id/git/commit/blob/:commit_hash/*path', :controller => "git/blobs", :action => :show, :project_name => /[0-9a-zA-Z_.\-]*/, :as => :blob_commit
# Blame
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/blame/:commit_hash/*path', :controller => "git/blobs", :action => :blame, :as => :blame_commit
# Raw
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/raw/:treeish/*path', :controller => "git/blobs", :action => :raw, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :raw
match 'platforms/:platform_id/repositories/:repository_id/projects/:project_id/git/commit/raw/:commit_hash/*path', :controller => "git/blobs", :action => :raw, :as => :raw_commit
match '/projects/:project_id/git/blame/:treeish/*path', :controller => "git/blobs", :action => :blame, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :blame
match '/projects/:project_id/git/commit/blame/:commit_hash/*path', :controller => "git/blobs", :action => :blame, :as => :blame_commit
# Raw
match '/projects/:project_id/git/raw/:treeish/*path', :controller => "git/blobs", :action => :raw, :treeish => /[0-9a-zA-Z_.\-]*/, :defaults => { :treeish => :master }, :as => :raw
match '/projects/:project_id/git/commit/raw/:commit_hash/*path', :controller => "git/blobs", :action => :raw, :as => :raw_commit
root :to => "platforms#index"
end

View File

@ -0,0 +1,17 @@
class AddNewFieldsToBuildLists < ActiveRecord::Migration
def self.up
add_column :build_lists, :build_requires, :boolean
add_column :build_lists, :update_type, :string
add_column :build_lists, :bpl_id, :integer
add_column :build_lists, :pl_id, :integer
rename_column :build_lists, :branch_name, :project_version
end
def self.down
rename_column :build_lists, :project_version, :branch_name
remove_column :build_lists, :bpl_id
remove_column :build_lists, :pl_id
remove_column :build_lists, :update_type
remove_column :build_lists, :build_requires
end
end

View File

@ -46,7 +46,7 @@ ActiveRecord::Schema.define(:version => 20111023195205) do
t.integer "bs_id"
t.string "container_path"
t.integer "status"
t.string "branch_name"
t.string "project_version"
t.integer "project_id"
t.integer "arch_id"
t.datetime "notified_at"
@ -55,6 +55,10 @@ ActiveRecord::Schema.define(:version => 20111023195205) do
t.boolean "is_circle", :default => false
t.text "additional_repos"
t.string "name"
t.boolean "build_requires"
t.string "update_type"
t.integer "bpl_id"
t.integer "pl_id"
end
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"

View File

@ -7,7 +7,7 @@ class BuildServer
PLATFORM_NOT_FOUND = 1
PLATFORM_PENDING = 2
PROJECT_NOT_FOUND = 3
BRANCH_NOT_FOUND = 4
PROJECT_VERSION_NOT_FOUND = 4
BUILD_ERROR = 2500
MOCK_NOT_FOUND = 256
@ -68,8 +68,12 @@ class BuildServer
self.client.call('add_to_repo', name, repo_name)
end
def self.add_build_list project_name, branch_name, platform_name, arch_name, web_id
self.client.call('add_build_list', project_name, branch_name, platform_name, arch_name, web_id)
def self.add_build_list project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web
self.client.call('add_build_list', project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web)
end
def self.delete_build_list idlist
self.client.call('delete_build_list', idlist)
end
def self.freeze platform_name, new_repo_name = nil

View File

@ -11,3 +11,30 @@ function uncheck_by_ids(ids) {
}
return false;
}
$(document).ready(function() {
$('.pl_ids_container input[type="hidden"]').remove();
$('select#build_bpl').change(function() {
var is_bpl_main = false;
var granted_pl_id = '';
var bpl_id = $('select#build_bpl').val();
$('input.build_pl_ids').each(function(i,el) {
var pl_id = $(el).attr('pl_id');
if (pl_id == bpl_id) {
is_bpl_main = true;
//granted_pl_id = $(el).attr('pl_id');
}
});
if (is_bpl_main) {
$('input.build_pl_ids').attr('disabled', 'disabled');
$('input.build_pl_ids[pl_id="'+bpl_id+'"]').removeAttr('disabled');
} else {
$('input.build_pl_ids').removeAttr('disabled');
}
});
$('select#build_bpl').trigger('change');
});