diff --git a/.gitignore b/.gitignore index 24b5d17bf..ec01ff18f 100644 --- a/.gitignore +++ b/.gitignore @@ -13,3 +13,4 @@ config/initializers/local.rb public/system/* .rvmrc *.swp +*.tmproj diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index 2fcd2b272..c1bc30ac4 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -1,118 +1,142 @@ 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_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, :all] + before_filter :find_branches, :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 = filter_platform_repository_project_build_lists_path(@platform, @repository, @project) + end - @build_list.save + def filter + @filter = BuildList::Filter.new(@project, params[:filter]) + @build_lists = @filter.find.paginate :page => params[:page] + @action_url = filter_platform_repository_project_build_lists_path(@platform, @repository, @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 platform_repository_project_build_lists_path(@platform, @repository, @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_platform + @platform = Platform.find params[:platform_id] + end - def find_build_list_by_bs - @build_list = BuildList.find_by_bs_id!(params[:id]) - end + def find_repository + @repository = @platform.repositories.find(params[:repository_id]) + end + + def find_project + @project = @repository.projects.find params[:project_id] + end + + def find_arches + @arches = Arch.recent + end + + def find_branches + @git_repository = @project.git_repository + @branches = @git_repository.branches + end + + def find_build_list_by_bs + @build_list = BuildList.find_by_bs_id!(params[:id]) + end end diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 171aea246..9491c616b 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -16,6 +16,8 @@ class ProjectsController < ApplicationController 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] } end def process_build @@ -25,22 +27,29 @@ class ProjectsController < ApplicationController @branches = @project.git_repository.branches @branch = @branches.select{|branch| branch.name == params[:build][:branch] }.first + @pls_ids = params[:build][:pls].select{|_,v| v == "1"}.collect{|x| x[0].to_i } + @pls = Platform.where(:id => @pls_ids) + + @bpl = Platform.find params[:bpl] + if !check_arches || !check_branches @arches = Arch.recent 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 => @branch.name, :pl => pl, :bpl => @bpl) - 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", :branch_name => @branch.name, :arch => arch.name, :pl => pl, :bpl => @bpl) + else + flash[:error] += t("flash.build_list.save_error", :branch_name => @branch.name, :arch => arch.name, :pl => pl, :bpl => @bpl) + end end end - redirect_to platform_repository_project_path(@platform, @repository, @project) + redirect_to project_path(@project) end end @@ -62,7 +71,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 +92,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 diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 5cd7129f1..56095ae8c 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -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 @@ -38,7 +50,7 @@ class BuildList < ActiveRecord::Base } 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_branch, lambda {|branch| where(:project_version => branch) } 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 \ No newline at end of file diff --git a/app/models/build_list/filter.rb b/app/models/build_list/filter.rb index 25d4b9f8f..a21529dce 100644 --- a/app/models/build_list/filter.rb +++ b/app/models/build_list/filter.rb @@ -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_branch(@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 diff --git a/app/models/platform.rb b/app/models/platform.rb index 4a14012a7..616ad27f2 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -21,6 +21,7 @@ class Platform < ActiveRecord::Base # before_destroy :xml_rpc_destroy # before_update :check_freezing + scope :main, where(:platform_type => 'main') def path build_path(unixname) diff --git a/app/models/project.rb b/app/models/project.rb index 27d9e3601..5dc1c685f 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -32,7 +32,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 @@ -64,8 +64,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 diff --git a/app/views/build_lists/_build_lists.html.haml b/app/views/build_lists/_build_lists.html.haml index 3f4142409..b7763cce6 100644 --- a/app/views/build_lists/_build_lists.html.haml +++ b/app/views/build_lists/_build_lists.html.haml @@ -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 \ No newline at end of file diff --git a/app/views/build_lists/_filter.html.haml b/app/views/build_lists/_filter.html.haml index 06282b901..b8bf7ea3e 100644 --- a/app/views/build_lists/_filter.html.haml +++ b/app/views/build_lists/_filter.html.haml @@ -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 @branches + .group + = f.label :project_version, "Branch", :class => :label + = f.select :project_version, @branches.collect{|branch| [branch.name, branch.name]}, :include_blank => true, :selected => @filter.project_version .group = f.label :is_circle, t("activerecord.attributes.build_list.is_circle"), :class => :label diff --git a/app/views/build_lists/index.html.haml b/app/views/build_lists/index.html.haml index 3e369ecb2..58dd95e93 100644 --- a/app/views/build_lists/index.html.haml +++ b/app/views/build_lists/index.html.haml @@ -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"), 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) .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') \ No newline at end of file +- content_for :sidebar, render(:partial => 'sidebar') if controller.action_name != 'all' \ No newline at end of file diff --git a/app/views/build_lists/show.html.haml b/app/views/build_lists/show.html.haml index 21a2f023d..62ac6b45a 100644 --- a/app/views/build_lists/show.html.haml +++ b/app/views/build_lists/show.html.haml @@ -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") diff --git a/app/views/projects/build.html.haml b/app/views/projects/build.html.haml index e50f2fd32..2e8b01f13 100644 --- a/app/views/projects/build.html.haml +++ b/app/views/projects/build.html.haml @@ -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]} + + .group + = 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,24 @@ = 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" +-# + :javascript + var pl_counter = 0; + var bpl_id = $('select#build_bpl').val(); + $('input.build_pl_ids').each(function(i,el) { + var pl_id = $(el).attr('pl_id'); + }); -- content_for :sidebar, render(:partial => 'sidebar') +-# content_for :sidebar, render(:partial => 'sidebar') diff --git a/app/views/projects/show.html.haml b/app/views/projects/show.html.haml index 9ae1c755a..84d7c6da8 100644 --- a/app/views/projects/show.html.haml +++ b/app/views/projects/show.html.haml @@ -5,7 +5,7 @@ %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 t("layout.projects.build"), build_project_path(@project) .content .inner diff --git a/config/locales/ru.yml b/config/locales/ru.yml index add473eec..713743c11 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -192,7 +192,11 @@ ru: no_items_data: Данных нет show: Просмотр confirm_publish: Вы уверены, что хотите опубликовать контейнер? - + cancel_button_header: Действие + cancel_button: Отмена + cancel_successed: 'Сборка отменена.' + cancel_failed: 'При отмене сборки произошла ошибка!' + items: statuses: build_error: ошибка сборки @@ -262,12 +266,13 @@ ru: destroyed: Платформа успешно удалена build_list: - saved: Билд лист для бранча '%{branch_name}' и архитектуры '%{arch}' создан успешно - save_error: Не удалось сохранить билд лист для бранча '%{branch_name}' и архитектуры '%{arch}' + saved: Билд лист для бранча '%{branch_name}', платформу '#{pl}' и архитектуры '%{arch}' создан успешно + save_error: Не удалось сохранить билд лист для бранча '%{branch_name}', платформу '#{pl}' и архитектуры '%{arch}' no_branch_selected: Выберите какой-нибудь бранч no_branch_found: Выбранный бранч '%{branch_name}' не найден no_arch_selected: Выберите хотя бы одну ахритектуру no_arch_found: Выбранные ахритектуры не найдены + wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа! attributes: password: Пароль @@ -413,6 +418,12 @@ ru: additional_repos: Дополнительные репозитории updated_at: Обновлен created_at: Создан + bpl: Репозиторий для сохранения пакетов + bpl_id: Репозиторий для сохранения пакетов + pl: Платформа + pl_id: Платформа + update_type: Критичность обновления + build_requires: Пересборка с зависимостями build_list/item: name: Название diff --git a/config/routes.rb b/config/routes.rb index 93fc5c34e..11a71d6a6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -14,6 +14,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 @@ -46,6 +49,11 @@ Rosa::Application.routes.draw do post :publish end end + + member do + get :build + get :process_build + end end resources :repositories do diff --git a/db/migrate/20111020160644_add_new_fields_to_build_lists.rb b/db/migrate/20111020160644_add_new_fields_to_build_lists.rb new file mode 100644 index 000000000..c6de348eb --- /dev/null +++ b/db/migrate/20111020160644_add_new_fields_to_build_lists.rb @@ -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 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index dfd07736f..24b083606 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -46,7 +46,7 @@ ActiveRecord::Schema.define(:version => 20111021164945) 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 => 20111021164945) 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" diff --git a/lib/build_server.rb b/lib/build_server.rb index 31da95afd..42ec030bb 100644 --- a/lib/build_server.rb +++ b/lib/build_server.rb @@ -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