[issue 428] Added advisory.

This commit is contained in:
George Vinogradov 2012-05-04 21:12:51 +04:00
parent 3acd38790f
commit 8350fc8fb1
20 changed files with 287 additions and 114 deletions

View File

@ -7,7 +7,7 @@ class BuildListsController < ApplicationController
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_project, :only => NESTED_ACTIONS
before_filter :find_build_list, :only => [:show, :publish, :cancel, :reject_publish]
before_filter :find_build_list, :only => [:show, :publish, :cancel, :reject_publish, :update]
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
before_filter :find_platform, :only => [:create]
@ -44,13 +44,13 @@ class BuildListsController < ApplicationController
# Disable auto_publish if platform released
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 = 100 # 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, :save_to_platform => @build_list.save_to_platform}
if @build_list.save
notices << t("flash.build_list.saved", flash_options)
else
@ -73,20 +73,16 @@ class BuildListsController < ApplicationController
@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')
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')
def update
# King Arthur, we are under attack!
if ( !@build_list.can_publish? || cannot?(:publish, @build_list) ) && params[:publish].present? or
( !@build_list.can_reject_publish? || cannot?(:reject_publish, @build_list) ) && params[:reject_publish].present?
redirect_to :forbidden and return
end
#raise
publish if params[:publish].present?
reject_publish if params[:reject_publish].present?
#raise
end
def cancel
@ -165,7 +161,7 @@ class BuildListsController < ApplicationController
end
def find_platform
@platform = Platform.find params[:build_list][:pl_id]
@platform = Platform.find params[:build_list][:save_to_platform_id]
end
def find_build_list
@ -181,4 +177,29 @@ class BuildListsController < ApplicationController
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

View File

@ -69,10 +69,10 @@ 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)}

23
app/models/advisory.rb Normal file
View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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_\-]+$/ }

View File

@ -17,6 +17,8 @@ class Project < ActiveRecord::Base
has_many :groups, :through => :relations, :source => :actor, :source_type => 'Group'
has_many :labels
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 }
@ -61,8 +63,8 @@ class Project < ActiveRecord::Base
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}"

View File

@ -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

View File

@ -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

View File

@ -1,18 +1,18 @@
-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_platofrm")
.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
%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]}
.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

View File

@ -4,66 +4,84 @@
%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.connected_advisory")
.rightlist= @build_list.advisory.advisory_id
.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/form', :locals => {:f => f}
=# 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)
= 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")

View File

@ -157,7 +157,7 @@ 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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -11,16 +11,39 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120425190938) do
ActiveRecord::Schema.define(:version => 20120428105843) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
t.string "kind"
t.text "data"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", :null => false
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 => 20120425190938) 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"
@ -180,7 +205,7 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
t.string "owner_type"
t.string "visibility", :default => "open", :null => false
t.string "platform_type", :default => "main", :null => false
t.string "distrib_type", :null => false
t.string "distrib_type"
end
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
@ -251,18 +276,18 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.boolean "has_wiki", :default => false
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.boolean "has_wiki", :default => false
t.string "default_branch", :default => "master"
t.boolean "is_rpm", :default => true
t.integer "average_build_time", :default => 0, :null => false
t.integer "build_count", :default => 0, :null => false
end
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
create_table "register_requests", :force => true do |t|
t.string "name"
@ -277,7 +302,6 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
end
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
create_table "relations", :force => true do |t|
t.integer "actor_id"
@ -325,16 +349,16 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
t.string "name"
t.string "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "password_salt", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.text "professional_experience"
t.string "site"
t.string "company"

View File

@ -72,12 +72,12 @@ describe 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 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

View File

@ -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

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe Advisory do
pending "add some examples to (or delete) #{__FILE__}"
end