Merge pull request #437 from warpc/428-advisory
[refs #428] Advisories; Change bpl и pl to build_for_platform and save_to_platform.
This commit is contained in:
commit
f2c72ba342
|
@ -1,5 +1,5 @@
|
|||
$(document).ready(function() {
|
||||
$('#build_list_pl_id').change(function() {
|
||||
$('#build_list_save_to_platform_id').change(function() {
|
||||
var platform_id = $(this).val();
|
||||
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
||||
|
||||
|
@ -15,7 +15,7 @@ $(document).ready(function() {
|
|||
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
||||
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
|
||||
|
||||
var rep_name = $('#build_list_pl_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
|
||||
var rep_name = $('#build_list_save_to_platform_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
|
||||
if (rep_name != 'main') {
|
||||
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ $(document).ready(function() {
|
|||
|
||||
setBranchSelected();
|
||||
});
|
||||
$('#build_list_pl_id').trigger('change');
|
||||
$('#build_list_save_to_platform_id').trigger('change');
|
||||
|
||||
$('.offset25 label').click(function() {
|
||||
setPlChecked($(this).prev()[0], !$(this).prev().attr('checked'));
|
||||
|
@ -58,10 +58,10 @@ function setPlChecked(pointer, checked) {
|
|||
}
|
||||
|
||||
function setBranchSelected() {
|
||||
var pl_id = $('#build_list_pl_id').val();
|
||||
var pl_id = $('#build_list_save_to_platform_id').val();
|
||||
// Checks if selected platform is main or not:
|
||||
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
|
||||
var pl_name = $('#build_list_pl_id option[value="' + pl_id + '"]').text().match(/([\w-]+)\/[\w-]+/)[1];
|
||||
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-]+)\/[\w-]+/)[1];
|
||||
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
|
||||
// If there is branch we need - set it selected:
|
||||
if ( branch_pl_opt.size() > 0 ) {
|
||||
|
|
|
@ -456,6 +456,18 @@ table.tablesorter.platforms .th2 {
|
|||
width: 280px;
|
||||
}
|
||||
|
||||
table.tablesorter.advisories .th1 {
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
table.tablesorter.advisories .th2 {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
table.tablesorter.advisories .th3 {
|
||||
width: auto;
|
||||
}
|
||||
|
||||
table.tablesorter tr td.buttons {
|
||||
text-align: center;
|
||||
}
|
||||
|
@ -921,3 +933,13 @@ div#git_help_data p {
|
|||
.dropdown.open .dropdown-toggle {
|
||||
background: none repeat scroll 0 0;
|
||||
}
|
||||
|
||||
.rightlist p {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
.leftlist span.hint {
|
||||
padding-top: 1em;
|
||||
display: block;
|
||||
font-size: 0.9em;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class AdvisoriesController < ApplicationController
|
||||
before_filter :authenticate_user!
|
||||
before_filter :find_advisory, :only => [:show]
|
||||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
@advisories = @advisories.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def find_advisory
|
||||
@advisory = Advisory.where(:advisory_id => params[:id]).limit(1).first if params[:id].present?
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
|
||||
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
|
||||
|
||||
before_filter :find_build_list, :only => [:show, :publish, :cancel]
|
||||
before_filter :find_build_list, :only => [:show, :publish, :cancel, :update]
|
||||
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
|
||||
|
||||
load_and_authorize_resource :project, :only => NESTED_ACTIONS
|
||||
|
@ -40,16 +40,16 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
|
||||
def create
|
||||
notices, errors = [], []
|
||||
@platform = Platform.find params[:build_list][:pl_id]
|
||||
@platform = Platform.find params[:build_list][:save_to_platform_id]
|
||||
params[:build_list][:auto_publish] = false if @platform.released
|
||||
Arch.where(:id => params[:arches]).each do |arch|
|
||||
Platform.main.where(:id => params[:bpls]).each do |bpl|
|
||||
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
|
||||
@build_list = @project.build_lists.build(params[:build_list])
|
||||
@build_list.commit_hash = @project.git_repository.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last || @build_list.project_version).first.id if @build_list.project_version
|
||||
@build_list.bpl = bpl; @build_list.arch = arch; @build_list.user = current_user
|
||||
@build_list.include_repos = @build_list.include_repos.select {|ir| @build_list.bpl.repository_ids.include? ir.to_i}
|
||||
@build_list.build_for_platform = build_for_platform; @build_list.arch = arch; @build_list.user = current_user
|
||||
@build_list.include_repos = @build_list.include_repos.select {|ir| @build_list.build_for_platform.repository_ids.include? ir.to_i}
|
||||
@build_list.priority = current_user.build_priority # User builds more priority than mass rebuild with zero priority
|
||||
flash_options = {:project_version => @build_list.project_version, :arch => arch.name, :bpl => bpl.name, :pl => @build_list.pl}
|
||||
flash_options = {:project_version => @build_list.project_version, :arch => arch.name, :build_for_platform => build_for_platform.name}
|
||||
if @build_list.save
|
||||
notices << t("flash.build_list.saved", flash_options)
|
||||
else
|
||||
|
@ -72,19 +72,14 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
@item_groups = @build_list.items.group_by_level
|
||||
end
|
||||
|
||||
def publish
|
||||
if @build_list.publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_success')
|
||||
def update
|
||||
if params[:publish].present? and can?(:publish, @build_list)
|
||||
publish
|
||||
elsif params[:reject_publish].present? and can?(:reject_publish)
|
||||
reject_publish
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail')
|
||||
end
|
||||
end
|
||||
|
||||
def reject_publish
|
||||
if @build_list.reject_publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.reject_publish_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.reject_publish_fail')
|
||||
# King Arthur, we are under attack!
|
||||
redirect_to :forbidden and return
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -172,4 +167,29 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
render :nothing => true, :status => 403
|
||||
end
|
||||
end
|
||||
|
||||
def publish
|
||||
@build_list.update_type = params[:build_list][:update_type] if params[:build_list][:update_type].present?
|
||||
if params[:create_advisory].present?
|
||||
a = @build_list.build_advisory
|
||||
a.update_type = @build_list.update_type
|
||||
a.project = @build_list.project
|
||||
a.platforms << @build_list.save_to_platform unless a.platforms.include? @build_list.save_to_platform
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail') unless a.update_attributes(params[:build_list][:advisory])
|
||||
end
|
||||
if @build_list.save and @build_list.publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.publish_fail')
|
||||
end
|
||||
end
|
||||
|
||||
def reject_publish
|
||||
if @build_list.reject_publish
|
||||
redirect_to :back, :notice => t('layout.build_lists.reject_publish_success')
|
||||
else
|
||||
redirect_to :back, :notice => t('layout.build_lists.reject_publish_fail')
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
module AdvisoriesHelper
|
||||
def construct_ref_link(ref)
|
||||
ref = sanitize(ref)
|
||||
url = if ref =~ %r[^http(s?)://*]
|
||||
ref
|
||||
else
|
||||
'http://' << ref
|
||||
end
|
||||
link_to url, url
|
||||
end
|
||||
end
|
|
@ -22,6 +22,7 @@ module ApplicationHelper
|
|||
end
|
||||
|
||||
def title_object object
|
||||
return object.advisory_id if object.class == Advisory
|
||||
name = object.class == Group ? object.uname : object.name
|
||||
object_name = t "activerecord.models.#{object.class.name.downcase}"
|
||||
case object.class.name
|
||||
|
|
|
@ -5,7 +5,7 @@ module PlatformsHelper
|
|||
return platform.released ? '/update' : '/release'
|
||||
end
|
||||
|
||||
def platfrom_printed_name(platform)
|
||||
def platform_printed_name(platform)
|
||||
return "" unless platform
|
||||
platform.released? ? "#{platform.name} #{I18n.t("layout.platforms.released_suffix")}" : platform.name
|
||||
end
|
||||
|
|
|
@ -66,13 +66,15 @@ class Ability
|
|||
can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
|
||||
can(:create, BuildList) {|build_list| build_list.project.is_rpm && can?(:write, build_list.project)}
|
||||
can(:publish, BuildList) do |build_list|
|
||||
build_list.can_publish? and build_list.pl.released ? local_admin?(build_list.pl) : can?(:write, build_list.project)
|
||||
build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)
|
||||
end
|
||||
can(:reject_publish, BuildList) do |build_list|
|
||||
build_list.can_reject_publish? and build_list.pl.released and local_admin?(build_list.pl)
|
||||
build_list.can_reject_publish? and build_list.save_to_platform.released and local_admin?(build_list.save_to_platform)
|
||||
end
|
||||
can(:cancel, BuildList) {|build_list| build_list.can_cancel? && can?(:write, build_list.project)}
|
||||
|
||||
can [:read], Advisory
|
||||
|
||||
can [:read, :members], Platform, :visibility => 'open'
|
||||
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
|
||||
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
class Advisory < ActiveRecord::Base
|
||||
has_and_belongs_to_many :platforms
|
||||
has_many :build_lists
|
||||
belongs_to :project
|
||||
|
||||
validates :description, :update_type, :presence => true
|
||||
|
||||
after_create :generate_advisory_id
|
||||
|
||||
ID_TEMPLATE = 'ROSA%<type>s-%<year>d:%<id>04d'
|
||||
TYPES = {'security' => 'SA', 'bugfix' => 'A'}
|
||||
|
||||
def to_param
|
||||
advisory_id
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def generate_advisory_id
|
||||
self.advisory_id = sprintf(ID_TEMPLATE, :type => TYPES[self.update_type], :year => Time.now.utc.year, :id => self.id)
|
||||
self.save
|
||||
end
|
||||
end
|
|
@ -2,18 +2,25 @@
|
|||
class BuildList < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
belongs_to :arch
|
||||
belongs_to :pl, :class_name => 'Platform'
|
||||
belongs_to :bpl, :class_name => 'Platform'
|
||||
belongs_to :save_to_platform, :class_name => 'Platform'
|
||||
belongs_to :build_for_platform, :class_name => 'Platform'
|
||||
belongs_to :user
|
||||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
|
||||
belongs_to :advisory
|
||||
|
||||
validates :project_id, :project_version, :arch, :include_repos, :presence => true
|
||||
validates_numericality_of :priority, :greater_than_or_equal_to => 0
|
||||
|
||||
UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage]
|
||||
validates :update_type, :inclusion => UPDATE_TYPES
|
||||
RELEASE_UPDATE_TYPES = %w[security bugfix]
|
||||
|
||||
validates :update_type, :inclusion => UPDATE_TYPES,
|
||||
:unless => Proc.new { |b| b.save_to_platform.released }
|
||||
validates :update_type, :inclusion => RELEASE_UPDATE_TYPES,
|
||||
:if => Proc.new { |b| b.save_to_platform.released }
|
||||
validate lambda {
|
||||
errors.add(:bpl, I18n.t('flash.build_list.wrong_platform')) if pl.platform_type == 'main' && pl_id != bpl_id
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
|
||||
}
|
||||
|
||||
# The kernel does not send these statuses directly
|
||||
|
@ -123,7 +130,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def can_reject_publish?
|
||||
can_publish? and pl.released
|
||||
can_publish? and save_to_platform.released
|
||||
end
|
||||
|
||||
def cancel
|
||||
|
@ -167,7 +174,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def place_build
|
||||
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority
|
||||
self.status = BuildServer.add_build_list project.name, project_version, pl.name, arch.name, (pl_id == bpl_id ? '' : bpl.name), update_type, build_requires, id, include_repos, priority
|
||||
self.status = BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority
|
||||
self.status = BUILD_PENDING if self.status == 0
|
||||
save
|
||||
end
|
||||
|
|
|
@ -4,7 +4,7 @@ class Collaborator
|
|||
include ActiveModel::Validations
|
||||
include ActiveModel::Serializers::JSON
|
||||
include ActiveModel::MassAssignmentSecurity
|
||||
extend ActiveModel::Naming
|
||||
extend ActiveModel::Naming
|
||||
|
||||
attr_accessor :role, :actor, :project, :relation
|
||||
attr_reader :id, :actor_id, :actor_type, :actor_name, :project_id
|
||||
|
|
|
@ -13,6 +13,8 @@ class Platform < ActiveRecord::Base
|
|||
has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy
|
||||
has_many :members, :through => :actors, :source => :actor, :source_type => 'User'
|
||||
|
||||
has_and_belongs_to_many :advisories
|
||||
|
||||
validates :description, :presence => true
|
||||
validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES}
|
||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-]+$/ }
|
||||
|
|
|
@ -17,6 +17,8 @@ class Project < ActiveRecord::Base
|
|||
has_many :collaborators, :through => :relations, :source => :actor, :source_type => 'User'
|
||||
has_many :groups, :through => :relations, :source => :actor, :source_type => 'Group'
|
||||
|
||||
has_many :advisories
|
||||
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^[a-zA-Z0-9_\-\+\.]+$/}
|
||||
validates :owner, :presence => true
|
||||
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
|
||||
|
@ -75,8 +77,8 @@ class Project < ActiveRecord::Base
|
|||
build_ids = build_reps.compact.map(&:id).uniq
|
||||
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
||||
build_lists.create do |bl|
|
||||
bl.pl = platform
|
||||
bl.bpl = platform
|
||||
bl.save_to_platform = platform
|
||||
bl.build_to_platform = platform
|
||||
bl.update_type = 'newpackage'
|
||||
bl.arch = arch
|
||||
bl.project_version = "latest_#{platform.name}"
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
%h3= t("layout.advisories.form_header")
|
||||
|
||||
.leftlist
|
||||
= f.label :description, t("activerecord.attributes.advisory.description")
|
||||
.rightlist
|
||||
= f.text_area :description, :class => 'text_field', :cols => 80
|
||||
.both
|
||||
|
||||
.leftlist
|
||||
= f.label :references, t("activerecord.attributes.advisory.references")
|
||||
%span.hint
|
||||
= t("layout.advisories.ref_comment")
|
||||
.rightlist
|
||||
= f.text_area :references, :class => 'text_field', :cols => 80
|
||||
.both
|
|
@ -0,0 +1,8 @@
|
|||
%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.th1= t("activerecord.attributes.advisory.advisory_id")
|
||||
%th.th2= t("layout.advisories.affected_versions")
|
||||
%th.th3= t("activerecord.attributes.advisory.description")
|
||||
%tbody
|
||||
= render :partial => 'list_item', :collection => list, :as => :advisory
|
|
@ -0,0 +1,7 @@
|
|||
%tr{:class => cycle("odd", "even")}
|
||||
%td= link_to advisory.advisory_id, advisory_path(advisory)
|
||||
%td
|
||||
- advisory.platforms.each do |platform|
|
||||
= link_to platform_printed_name(platform), platform_path(platform)
|
||||
%br
|
||||
%td= truncate(advisory.description, :length => 50)
|
|
@ -0,0 +1,7 @@
|
|||
- content_for :submenu do
|
||||
- act = action_name.to_sym; contr = controller_name.to_sym
|
||||
.left
|
||||
= @advisory.advisory_id if @advisory.present?
|
||||
%nav
|
||||
%ul
|
||||
%li= link_to t('layout.list'), advisories_path, :class => act.in?([:index]) ? 'active' : nil
|
|
@ -0,0 +1,4 @@
|
|||
- set_meta_tags :title => t('layout.advisories.list_header')
|
||||
- render :partial => 'submenu'
|
||||
= render :partial => 'list', :object => @advisories
|
||||
= will_paginate @advisories
|
|
@ -0,0 +1,37 @@
|
|||
- set_meta_tags :title => [title_object(@advisory), t('activerecord.models.advisory')]
|
||||
- render :partial => 'submenu'
|
||||
|
||||
%h3= "#{t("activerecord.models.advisory")} #{@advisory.advisory_id}".html_safe
|
||||
|
||||
.leftlist= "#{t("layout.advisories.project_name")}:".html_safe
|
||||
.rightlist= link_to @advisory.project.name, project_path(@advisory.project)
|
||||
.both
|
||||
|
||||
.leftlist= "#{t("activerecord.attributes.advisory.created_at")}:".html_safe
|
||||
.rightlist= @advisory.created_at
|
||||
.both
|
||||
|
||||
.leftlist= "#{t("activerecord.attributes.advisory.advisory_id")}:".html_safe
|
||||
.rightlist= @advisory.advisory_id
|
||||
.both
|
||||
|
||||
.leftlist= "#{t("layout.advisories.affected_versions")}:".html_safe
|
||||
.rightlist
|
||||
- @advisory.platforms.each do |platform|
|
||||
= link_to platform_printed_name(platform), platform_path(platform)
|
||||
%br
|
||||
.both
|
||||
|
||||
.leftlist= "#{t("activerecord.attributes.advisory.description")}:".html_safe
|
||||
.rightlist= simple_format @advisory.description
|
||||
.both
|
||||
|
||||
.leftlist= "#{t("activerecord.attributes.advisory.references")}:".html_safe
|
||||
.rightlist
|
||||
- @advisory.references.gsub(/\r| /, '').split("\n").each do |ref|
|
||||
= construct_ref_link(ref)
|
||||
%br
|
||||
.both
|
||||
|
||||
:javascript
|
||||
$('article .all').addClass('bigpadding');
|
|
@ -1,5 +1,5 @@
|
|||
- content_for :submenu do
|
||||
- act = action_name.to_sym; contr = controller_name.to_sym
|
||||
.left= platfrom_printed_name(@platform)
|
||||
.left= platform_printed_name(@platform)
|
||||
%nav
|
||||
%ul
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
%tbody
|
||||
- @platforms.each do |platform|
|
||||
%tr{:class => cycle("odd", "even")}
|
||||
%td= link_to platfrom_printed_name(platform), platform_path(platform)
|
||||
%td= link_to platform_printed_name(platform), platform_path(platform)
|
||||
%td= platform.distrib_type
|
|
@ -1,4 +1,4 @@
|
|||
- platform.repositories.each do |repo|
|
||||
.both
|
||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :pl_id => platform.id, :rep_name => repo.name
|
||||
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name
|
||||
= label_tag "include_repos_#{repo.id}", repo.name
|
||||
|
|
|
@ -1,18 +1,17 @@
|
|||
-set_meta_tags :title => [title_object(@project), t('layout.build_lists.new_header')]
|
||||
= form_for [@project, @build_list], :html => { :class => :form, :method => :post } do |f|
|
||||
%section.left
|
||||
%h3= t("activerecord.attributes.build_list.bpl")
|
||||
%h3= t("activerecord.attributes.build_list.build_for_platform")
|
||||
.all_platforms
|
||||
- Platform.main.each do |pl|
|
||||
- if pl.repository_ids.size > 0
|
||||
.both
|
||||
= check_box_tag "bpls[]", pl.id, (params[:bpls]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}", :'data-released' => pl.released ? 1 : 0
|
||||
= check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}", :'data-released' => pl.released ? 1 : 0
|
||||
= label_tag "bpls_#{pl.id}", pl.name
|
||||
.offset25{:style => 'padding-left: 25px'}
|
||||
= render 'include_repos', :platform => pl
|
||||
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
|
||||
%section.right
|
||||
%h3= t("activerecord.attributes.build_list.pl")
|
||||
.lineForm= f.select :pl_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
|
||||
%h3= t("activerecord.attributes.build_list.save_to_platform")
|
||||
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
|
||||
%h3= t("activerecord.attributes.build_list.project_version")
|
||||
- if controller.action_name == 'new'
|
||||
.lineForm= f.select :project_version, @project.versions_for_group_select, :selected => "latest_" + @project.default_branch
|
||||
|
@ -21,10 +20,7 @@
|
|||
%h3= t("activerecord.attributes.build_list.arch")
|
||||
- Arch.recent.each do |arch|
|
||||
.both
|
||||
- if controller.action_name == 'new'
|
||||
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}", :checked => 'checked'
|
||||
- else
|
||||
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
|
||||
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s) || controller.action_name == 'new', :id => "arches_#{arch.id}"
|
||||
= label_tag "arches_#{arch.id}", arch.name
|
||||
%h3= t("activerecord.attributes.build_list.update_type")
|
||||
.lineForm= f.select :update_type, BuildList::UPDATE_TYPES
|
||||
|
|
|
@ -4,66 +4,82 @@
|
|||
%p= @build_list.human_status
|
||||
%p= @build_list.updated_at
|
||||
.both
|
||||
%h3= t("layout.build_lists.main_data")
|
||||
.leftside.width125= t("activerecord.attributes.build_list.container_path")
|
||||
.leftside
|
||||
- if @build_list.status == BuildList::BUILD_PUBLISHED
|
||||
= t("layout.build_lists.container_published")
|
||||
- elsif @build_list.container_path.present?
|
||||
- container_url = "http://#{request.host_with_port}/downloads#{@build_list.container_path}"
|
||||
= link_to container_url, container_url
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.user")
|
||||
.leftside
|
||||
= link_to @build_list.user.try(:fullname), @build_list.user
|
||||
.both
|
||||
= link_to t("layout.publish"), publish_build_list_path(@build_list), :method => "put", :confirm => t("layout.confirm"), :class => "button tmargin10" if @build_list.can_publish? and can?(:publish, @build_list)
|
||||
= link_to t("layout.reject_publish"), reject_publish_build_list_path(@build_list), :method => "put", :confirm => t("layout.confirm"), :class => "button tmargin10" if @build_list.can_reject_publish? and can?(:reject_publish, @build_list)
|
||||
.hr
|
||||
%h3= t("layout.build_lists.main_data")
|
||||
.leftside.width125= t("activerecord.attributes.build_list.bpl")
|
||||
.leftside
|
||||
= link_to @build_list.bpl.name, @build_list.bpl
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.pl")
|
||||
.leftside
|
||||
= link_to @build_list.pl.name, @build_list.pl
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.include_repos")
|
||||
.leftside= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.update_type")
|
||||
.leftside= @build_list.update_type
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.build_requires")
|
||||
.leftside= @build_list.build_requires
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.auto_publish")
|
||||
.leftside= @build_list.auto_publish
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.project_version")
|
||||
.leftside= @build_list.project_version
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.arch")
|
||||
.leftside= @build_list.arch.name
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.updated_at")
|
||||
.leftside= @build_list.updated_at
|
||||
.both
|
||||
.leftside.width125= t("activerecord.attributes.build_list.is_circle")
|
||||
.leftside= t("layout.#{@build_list.is_circle?}_")
|
||||
.both
|
||||
- if !@build_list.in_work? && @build_list.started_at
|
||||
%br
|
||||
.leftside.width125
|
||||
.leftside= @build_list.human_duration
|
||||
= form_for @build_list do |f|
|
||||
%h3= t("layout.build_lists.main_data")
|
||||
.leftlist= t("activerecord.attributes.build_list.container_path")
|
||||
.rightlist
|
||||
- if @build_list.status == BuildList::BUILD_PUBLISHED
|
||||
= t("layout.build_lists.container_published")
|
||||
- elsif @build_list.container_path.present?
|
||||
- container_url = "http://#{request.host_with_port}/downloads#{@build_list.container_path}"
|
||||
= link_to container_url, container_url
|
||||
.both
|
||||
- if @build_list.in_work?
|
||||
%br
|
||||
.leftside.width125
|
||||
.leftside
|
||||
= "#{@build_list.human_current_duration} / #{@build_list.project.human_average_build_time}"
|
||||
.leftlist= t("activerecord.attributes.build_list.user")
|
||||
.rightlist
|
||||
= link_to @build_list.user.try(:fullname), @build_list.user
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.bpl")
|
||||
.rightlist
|
||||
= link_to @build_list.build_for_platform.name, @build_list.build_for_platform
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.pl")
|
||||
.rightlist
|
||||
= link_to @build_list.save_to_platform.name, @build_list.save_to_platform
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.include_repos")
|
||||
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.update_type")
|
||||
.rightlist
|
||||
- if @build_list.can_publish? and can?(:publish, @build_list)
|
||||
= f.select :update_type, options_for_select(BuildList::RELEASE_UPDATE_TYPES, @build_list.update_type)
|
||||
- else
|
||||
= @build_list.update_type
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.build_requires")
|
||||
.rightlist= t("layout.#{@build_list.build_requires}_")
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.auto_publish")
|
||||
.rightlist= t("layout.#{@build_list.auto_publish}_")
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.project_version")
|
||||
.rightlist= @build_list.project_version
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.arch")
|
||||
.rightlist= @build_list.arch.name
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.updated_at")
|
||||
.rightlist= @build_list.updated_at
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.is_circle")
|
||||
.rightlist= t("layout.#{@build_list.is_circle?}_")
|
||||
.both
|
||||
|
||||
- if @build_list.advisory.present?
|
||||
.leftlist= t("layout.build_lists.attached_advisory")
|
||||
.rightlist= link_to @build_list.advisory.advisory_id, advisory_path(@build_list.advisory)
|
||||
.both
|
||||
- if !@build_list.in_work? && @build_list.started_at
|
||||
%br
|
||||
.leftlist
|
||||
.rightlist= @build_list.human_duration
|
||||
.both
|
||||
- if @build_list.in_work?
|
||||
%br
|
||||
.leftlist
|
||||
.rightlist
|
||||
= "#{@build_list.human_current_duration} / #{@build_list.project.human_average_build_time}"
|
||||
.both
|
||||
|
||||
- if @build_list.can_publish? and @build_list.save_to_platform.released and @build_list.advisory.nil?
|
||||
.leftlist= label_tag :create_advisory, t("layout.build_lists.create_advisory")
|
||||
.rightlist= check_box_tag :create_advisory, 1, false
|
||||
.both
|
||||
= f.fields_for @build_list.build_advisory do |f|
|
||||
= render :partial => 'advisories/advisories/form', :locals => {:f => f}
|
||||
|
||||
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if @build_list.can_publish? and can?(:publish, @build_list)
|
||||
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish' if @build_list.can_reject_publish? and can?(:reject_publish, @build_list)
|
||||
|
||||
.hr
|
||||
%h3= t("layout.build_lists.items_header")
|
||||
|
|
|
@ -4,6 +4,8 @@ en:
|
|||
turned_on: on
|
||||
turned_off: off
|
||||
|
||||
list: List
|
||||
|
||||
year: year
|
||||
|
||||
enter_commit_message: Commit message
|
||||
|
|
|
@ -4,6 +4,8 @@ ru:
|
|||
turned_on: включены
|
||||
turned_off: выключены
|
||||
|
||||
list: Список
|
||||
|
||||
year: год
|
||||
|
||||
enter_commit_message: Сопровождающее сообщение
|
||||
|
|
|
@ -8,6 +8,7 @@ en:
|
|||
projects: Projects
|
||||
build_lists: Task monitoring
|
||||
groups: Groups
|
||||
advisories: Advisories
|
||||
bottom_menu:
|
||||
copyright: ROSA Lab © 2012
|
||||
about: About the company
|
||||
|
|
|
@ -8,6 +8,7 @@ ru:
|
|||
projects: Проекты
|
||||
build_lists: Мониторинг задач
|
||||
groups: Группы
|
||||
advisories: Бюллетени
|
||||
bottom_menu:
|
||||
copyright: ROSA Лаб. © 2012
|
||||
about: О компании
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
en:
|
||||
layout:
|
||||
advisories:
|
||||
list_header: Advisories
|
||||
form_header: New advisory
|
||||
project_name: Project
|
||||
affected_versions: Affected versions
|
||||
ref_comment: Add links one by row
|
||||
|
||||
flash:
|
||||
advisories:
|
||||
|
||||
activerecord:
|
||||
models:
|
||||
advisory: Advisory
|
||||
|
||||
attributes:
|
||||
advisory:
|
||||
created_at: Creation date
|
||||
advisory_id: Identifier
|
||||
description: Description
|
||||
references: References
|
|
@ -0,0 +1,22 @@
|
|||
ru:
|
||||
layout:
|
||||
advisories:
|
||||
list_header: Бюллетени
|
||||
form_header: Новый бюллетень
|
||||
project_name: Проект
|
||||
affected_versions: Применен в версиях
|
||||
ref_comment: Вставляйте ссылки по одной на строку
|
||||
|
||||
flash:
|
||||
advisories:
|
||||
|
||||
activerecord:
|
||||
models:
|
||||
advisory: Бюллетень
|
||||
|
||||
attributes:
|
||||
advisory:
|
||||
created_at: Дата создания
|
||||
advisory_id: Идентификатор
|
||||
description: Описание проблемы
|
||||
references: Ссылки
|
|
@ -18,10 +18,8 @@ en:
|
|||
additional_repos: Additional repositories
|
||||
include_repos: Included repositories
|
||||
created_at: Created on
|
||||
pl: Repository for package storage
|
||||
pl_id: Repository for package storage
|
||||
bpl: Platform
|
||||
bpl_id: Platform
|
||||
save_to_platform: Repository for package storage
|
||||
build_for_platform: Platform
|
||||
update_type: Update type
|
||||
build_requires: Build with all the required packages
|
||||
auto_publish: Automated publising
|
||||
|
@ -62,9 +60,13 @@ en:
|
|||
action: Action
|
||||
new_header: New build
|
||||
main_data: Main data
|
||||
|
||||
human_current_duration: Build currently takes %{hours} h. %{minutes} min.
|
||||
human_duration: Builded in %{hours} h. %{minutes} min.
|
||||
|
||||
attached_advisory: Attached advisory
|
||||
create_advisory: Create new advisory
|
||||
|
||||
ownership:
|
||||
header: Build list ownership
|
||||
owned: My
|
||||
|
@ -107,8 +109,8 @@ en:
|
|||
|
||||
flash:
|
||||
build_list:
|
||||
saved: Build list for project version '%{project_version}', platform '%{bpl}' and architecture '%{arch}' has been created successfully
|
||||
save_error: Build list for project version '%{project_version}', platform '%{bpl}' and architecture '%{arch}' could not been created
|
||||
saved: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' has been created successfully
|
||||
save_error: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' could not been created
|
||||
no_project_version_selected: Select any version of the project
|
||||
no_project_version_found: Project version '%{project_version}' not found
|
||||
no_arch_or_platform_selected: At least one of architecture of platform must selected
|
||||
|
|
|
@ -18,10 +18,8 @@ ru:
|
|||
additional_repos: Дополнительные репозитории
|
||||
include_repos: Подключаемые репозитории
|
||||
created_at: Создан
|
||||
pl: Репозиторий для сохранения пакетов
|
||||
pl_id: Репозиторий для сохранения пакетов
|
||||
bpl: Платформа
|
||||
bpl_id: Платформа
|
||||
save_to_platform: Репозиторий для сохранения пакетов
|
||||
build_for_platform: Платформа
|
||||
update_type: Критичность обновления
|
||||
build_requires: Пересборка с зависимостями
|
||||
auto_publish: Автоматическая публикация
|
||||
|
@ -65,6 +63,9 @@ ru:
|
|||
human_current_duration: Сборка длится уже %{hours} ч. %{minutes} мин.
|
||||
human_duration: Собрано за %{hours} ч. %{minutes} мин.
|
||||
|
||||
attached_advisory: Связанный бюллетень
|
||||
create_advisory: Создать новый бюллетень
|
||||
|
||||
ownership:
|
||||
header: Принадлежность заданий
|
||||
owned: Мне
|
||||
|
@ -107,8 +108,8 @@ ru:
|
|||
|
||||
flash:
|
||||
build_list:
|
||||
saved: Билд лист для версии '%{project_version}', платформы '%{bpl}' и архитектуры '%{arch}' создан успешно
|
||||
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{bpl}' и архитектуры '%{arch}'
|
||||
saved: Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно
|
||||
save_error: Не удалось сохранить билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}'
|
||||
no_project_version_selected: Выберите какую-нибудь версию
|
||||
no_project_version_found: Выбранная версия '%{project_version}' не найдена
|
||||
no_arch_or_platform_selected: Выберите хотя бы одну архитектуру и платформу
|
||||
|
|
|
@ -34,6 +34,8 @@ Rosa::Application.routes.draw do
|
|||
resources :event_logs, :only => :index
|
||||
end
|
||||
|
||||
resources :advisories, :only => [:index, :show]
|
||||
|
||||
scope :module => 'platforms' do
|
||||
resources :platforms do
|
||||
resources :private_users, :except => [:show, :destroy, :update]
|
||||
|
@ -106,11 +108,9 @@ Rosa::Application.routes.draw do
|
|||
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
|
||||
match 'product_status', :to => 'product_build_lists#status_build'
|
||||
|
||||
resources :build_lists, :only => [:index, :show] do
|
||||
resources :build_lists, :only => [:index, :show, :update] do
|
||||
member do
|
||||
put :cancel
|
||||
put :publish
|
||||
put :reject_publish
|
||||
end
|
||||
collection { post :search }
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
class CreateAdvisories < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :advisories do |t|
|
||||
t.string :advisory_id
|
||||
t.integer :project_id
|
||||
t.text :description, :default => ''
|
||||
t.text :references, :default => ''
|
||||
t.text :update_type, :default => ''
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
add_index :advisories, :advisory_id, :unique => true
|
||||
add_index :advisories, :project_id
|
||||
add_index :advisories, :update_type
|
||||
end
|
||||
end
|
|
@ -0,0 +1,18 @@
|
|||
class CreateAdvisoriesPlatforms < ActiveRecord::Migration
|
||||
def up
|
||||
create_table :advisories_platforms, :id => false do |t|
|
||||
t.integer :advisory_id
|
||||
t.integer :platform_id
|
||||
end
|
||||
add_index :advisories_platforms, :advisory_id
|
||||
add_index :advisories_platforms, :platform_id
|
||||
add_index :advisories_platforms, [:advisory_id, :platform_id], :name => :advisory_platform_index, :unique => true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :advisories_platforms, :column => :advisory_id
|
||||
remove_index :advisories_platforms, :column => :platform_id
|
||||
remove_index :advisories_platforms, :name => :advisory_platform_index
|
||||
drop_table :advisories_platforms
|
||||
end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
class AddAdvisoryIdToBuildLists < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :advisory_id, :integer
|
||||
add_index :build_lists, :advisory_id
|
||||
|
||||
end
|
||||
end
|
|
@ -0,0 +1,15 @@
|
|||
class RenamePlBplInBuildList < ActiveRecord::Migration
|
||||
def up
|
||||
change_table :build_lists do |t|
|
||||
t.rename :pl_id, :save_to_platform_id
|
||||
t.rename :bpl_id, :build_for_platform_id
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
change_table :build_lists do |t|
|
||||
t.rename :save_to_platform_id, :pl_id
|
||||
t.rename :build_for_platform_id, :bpl_id
|
||||
end
|
||||
end
|
||||
end
|
44
db/schema.rb
44
db/schema.rb
|
@ -21,6 +21,29 @@ ActiveRecord::Schema.define(:version => 20120505101650) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "advisories", :force => true do |t|
|
||||
t.string "advisory_id"
|
||||
t.integer "project_id"
|
||||
t.text "description", :default => ""
|
||||
t.text "references", :default => ""
|
||||
t.text "update_type", :default => ""
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "advisories", ["advisory_id"], :name => "index_advisories_on_advisory_id", :unique => true
|
||||
add_index "advisories", ["project_id"], :name => "index_advisories_on_project_id"
|
||||
add_index "advisories", ["update_type"], :name => "index_advisories_on_update_type"
|
||||
|
||||
create_table "advisories_platforms", :id => false, :force => true do |t|
|
||||
t.integer "advisory_id"
|
||||
t.integer "platform_id"
|
||||
end
|
||||
|
||||
add_index "advisories_platforms", ["advisory_id"], :name => "index_advisories_platforms_on_advisory_id"
|
||||
add_index "advisories_platforms", ["advisory_id", "platform_id"], :name => "advisory_platform_index", :unique => true
|
||||
add_index "advisories_platforms", ["platform_id"], :name => "index_advisories_platforms_on_platform_id"
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.datetime "created_at"
|
||||
|
@ -62,23 +85,25 @@ ActiveRecord::Schema.define(:version => 20120505101650) do
|
|||
t.datetime "notified_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.boolean "is_circle", :default => false
|
||||
t.boolean "is_circle", :default => false
|
||||
t.text "additional_repos"
|
||||
t.string "name"
|
||||
t.boolean "build_requires", :default => false
|
||||
t.boolean "build_requires", :default => false
|
||||
t.string "update_type"
|
||||
t.integer "bpl_id"
|
||||
t.integer "pl_id"
|
||||
t.integer "build_for_platform_id"
|
||||
t.integer "save_to_platform_id"
|
||||
t.text "include_repos"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", :default => true
|
||||
t.boolean "auto_publish", :default => true
|
||||
t.string "package_version"
|
||||
t.string "commit_hash"
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.integer "priority", :default => 0, :null => false
|
||||
t.datetime "started_at"
|
||||
t.integer "duration"
|
||||
t.integer "advisory_id"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
add_index "build_lists", ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
||||
add_index "build_lists", ["project_id"], :name => "index_build_lists_on_project_id"
|
||||
|
@ -342,11 +367,14 @@ ActiveRecord::Schema.define(:version => 20120505101650) do
|
|||
t.string "avatar_content_type"
|
||||
t.integer "avatar_file_size"
|
||||
t.datetime "avatar_updated_at"
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.integer "failed_attempts", :default => 0
|
||||
t.string "unlock_token"
|
||||
t.datetime "locked_at"
|
||||
t.string "confirmation_token"
|
||||
t.datetime "confirmed_at"
|
||||
t.datetime "confirmation_sent_at"
|
||||
t.string "authentication_token"
|
||||
t.integer "build_priority", :default => 50
|
||||
t.integer "build_priority", :default => 50
|
||||
end
|
||||
|
||||
add_index "users", ["authentication_token"], :name => "index_users_on_authentication_token"
|
||||
|
|
|
@ -72,12 +72,12 @@ describe Projects::BuildListsController do
|
|||
@create_params = {
|
||||
:build_list => {
|
||||
:project_version => 'latest_master',
|
||||
:pl_id => platform.id,
|
||||
:save_to_platform_id => platform.id,
|
||||
:update_type => 'security',
|
||||
:include_repos => [platform.repositories.first.id]
|
||||
},
|
||||
:arches => [FactoryGirl.create(:arch).id],
|
||||
:bpls => [platform.id]
|
||||
:build_for_platforms => [platform.id]
|
||||
}
|
||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||
end
|
||||
|
@ -284,7 +284,7 @@ describe Projects::BuildListsController do
|
|||
@build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@build_list3 = FactoryGirl.create(:build_list_core)
|
||||
@build_list4 = FactoryGirl.create(:build_list_core, :created_at => (Time.now - 1.day),
|
||||
:project => @build_list3.project, :pl => @build_list3.pl,
|
||||
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
||||
:arch => @build_list3.arch)
|
||||
end
|
||||
|
||||
|
|
|
@ -3,13 +3,13 @@ FactoryGirl.define do
|
|||
factory :build_list do
|
||||
association :user
|
||||
association :project
|
||||
association :pl, :factory => :platform_with_repos
|
||||
association :save_to_platform, :factory => :platform_with_repos
|
||||
association :arch
|
||||
bpl {|bl| bl.pl}
|
||||
build_for_platform {|bl| bl.save_to_platform}
|
||||
project_version "1.0"
|
||||
build_requires true
|
||||
update_type 'security'
|
||||
include_repos {|bl| bl.pl.repositories.map(&:id)}
|
||||
include_repos {|bl| bl.save_to_platform.repositories.map(&:id)}
|
||||
commit_hash '1234567890abcdef1234567890abcdef12345678'
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Advisory do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
|
@ -94,7 +94,9 @@ describe CanCan do
|
|||
end
|
||||
end
|
||||
|
||||
it { @ability.should be_able_to(:show, User) }
|
||||
it "shoud be able to show user profile" do
|
||||
@ability.should be_able_to(:show, User)
|
||||
end
|
||||
|
||||
it "shoud be able to read another user object" do
|
||||
admin_create
|
||||
|
|
|
@ -18,7 +18,7 @@ describe Platform do
|
|||
|
||||
it { should validate_presence_of(:name)}
|
||||
it { should validate_uniqueness_of(:name).case_insensitive }
|
||||
it { should validate_format_of(:name).with('Basic_platfrom-name-1234') }
|
||||
it { should validate_format_of(:name).with('Basic_platform-name-1234') }
|
||||
it { should validate_format_of(:name).not_with('.!') }
|
||||
it { should validate_presence_of(:description) }
|
||||
it { should validate_presence_of(:distrib_type) }
|
||||
|
|
Loading…
Reference in New Issue