#192: merge master into branch
This commit is contained in:
commit
2712c7f34b
|
@ -10,9 +10,8 @@ class Groups::ProfileController < Groups::BaseController
|
|||
end
|
||||
|
||||
def show
|
||||
@projects = @group.projects.by_visibilities(['open']).
|
||||
search(params[:search]).search_order.
|
||||
paginate(:page => params[:page], :per_page => 25)
|
||||
@projects = @group.projects.opened.search(params[:search]).recent
|
||||
.paginate(:page => params[:page], :per_page => 25)
|
||||
end
|
||||
|
||||
def new
|
||||
|
|
|
@ -52,8 +52,8 @@ class Platforms::ProductsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def autocomplete_project
|
||||
items = Project.accessible_by(current_ability, :membered).
|
||||
search(params[:term]).search_order
|
||||
items = Project.accessible_by(current_ability, :membered)
|
||||
.search(params[:term]).limit(20)
|
||||
items.select! {|e| e.repo.branches.count > 0}
|
||||
render :json => items.map{ |p|
|
||||
{
|
||||
|
|
|
@ -12,8 +12,8 @@ class Platforms::RepositoriesController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def show
|
||||
@projects = @repository.projects.recent.paginate :page => params[:project_page], :per_page => 30
|
||||
@projects = @projects.search(params[:query]).search_order if params[:query].present?
|
||||
@projects = @repository.projects.recent.search(params[:query])
|
||||
.paginate(:page => params[:project_page], :per_page => 30)
|
||||
end
|
||||
|
||||
def edit
|
||||
|
@ -125,8 +125,7 @@ class Platforms::RepositoriesController < Platforms::BaseController
|
|||
)
|
||||
|
||||
@total_projects = @projects.count
|
||||
@projects = @projects.search(params[:sSearch]).search_order if params[:sSearch].present?
|
||||
@projects = @projects.order(order)
|
||||
@projects = @projects.search(params[:sSearch]).order(order)
|
||||
|
||||
respond_to do |format|
|
||||
format.json {
|
||||
|
|
|
@ -129,7 +129,7 @@ class Projects::ProjectsController < Projects::BaseController
|
|||
projects = projects.by_owners(groups, owners)
|
||||
end
|
||||
|
||||
projects = projects.search(params[:sSearch]).search_order if params[:sSearch].present?
|
||||
projects = projects.search(params[:sSearch])
|
||||
|
||||
res[:filtered_count] = projects.count
|
||||
|
||||
|
|
|
@ -3,8 +3,7 @@ class Users::ProfileController < Users::BaseController
|
|||
skip_before_filter :authenticate_user!, :only => :show if APP_CONFIG['anonymous_access']
|
||||
|
||||
def show
|
||||
@projects = @user.projects.by_visibilities(['open']).
|
||||
search(params[:search]).search_order.
|
||||
paginate(:page => params[:page], :per_page => 25)
|
||||
@projects = @user.projects.opened.search(params[:search]).recent
|
||||
.paginate(:page => params[:page], :per_page => 25)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -55,7 +55,7 @@ class UserMailer < ActionMailer::Base
|
|||
I18n.locale = user.language if user.language
|
||||
@user, @build_list = user, build_list
|
||||
|
||||
subject = "[№ #{build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")}] "
|
||||
subject = "[№ #{build_list.id}] "
|
||||
subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project"))
|
||||
subject << " - #{build_list.human_status} "
|
||||
subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name)
|
||||
|
|
|
@ -157,7 +157,7 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
after_transition :on => :place_build, :do => :add_to_queue
|
||||
after_transition :on => :place_build, :do => :add_job_to_abf_worker_queue
|
||||
after_transition :on => :published,
|
||||
:do => [:set_version_and_tag, :actualize_packages]
|
||||
after_transition :on => :publish, :do => :set_publisher
|
||||
|
@ -290,11 +290,6 @@ class BuildList < ActiveRecord::Base
|
|||
BuildList.where(:id => extra_build_lists).where('status != ?', BUILD_PUBLISHED).count == 0
|
||||
end
|
||||
|
||||
def add_to_queue
|
||||
add_job_to_abf_worker_queue
|
||||
update_column(:bs_id, id)
|
||||
end
|
||||
|
||||
def self.human_status(status)
|
||||
I18n.t("layout.build_lists.statuses.#{HUMAN_STATUSES[status]}")
|
||||
end
|
||||
|
|
|
@ -11,8 +11,8 @@ class BuildList::Filter
|
|||
def find
|
||||
build_lists = @project ? @project.build_lists : BuildList.scoped
|
||||
|
||||
if @options[:bs_id]
|
||||
build_lists = build_lists.where(:bs_id => @options[:bs_id])
|
||||
if @options[:id]
|
||||
build_lists = build_lists.where(:id => @options[:id])
|
||||
else
|
||||
build_lists = build_lists.accessible_by(::Ability.new(@user), @options[:ownership].to_sym) if @options[:ownership]
|
||||
build_lists = build_lists.scoped_to_new_core(@options[:new_core] == '0' ? nil : true) if @options[:new_core].present?
|
||||
|
@ -41,18 +41,18 @@ class BuildList::Filter
|
|||
|
||||
def set_options(options)
|
||||
@options = HashWithIndifferentAccess.new(options.reverse_merge({
|
||||
:ownership => nil,
|
||||
:status => nil,
|
||||
:ownership => nil,
|
||||
:status => nil,
|
||||
:updated_at_start => nil,
|
||||
:updated_at_end => nil,
|
||||
:arch_id => nil,
|
||||
:platform_id => nil,
|
||||
:is_circle => nil,
|
||||
:project_version => nil,
|
||||
:bs_id => nil,
|
||||
:project_name => nil,
|
||||
:mass_build_id => nil,
|
||||
:new_core => nil
|
||||
:updated_at_end => nil,
|
||||
:arch_id => nil,
|
||||
:platform_id => nil,
|
||||
:is_circle => nil,
|
||||
:project_version => nil,
|
||||
:id => nil,
|
||||
:project_name => nil,
|
||||
:mass_build_id => nil,
|
||||
:new_core => nil
|
||||
}))
|
||||
|
||||
@options[:ownership] = @options[:ownership].presence || (@project || !@user ? 'everything' : 'owned')
|
||||
|
@ -65,7 +65,7 @@ class BuildList::Filter
|
|||
@options[:arch_id] = @options[:arch_id].try(:to_i)
|
||||
@options[:platform_id] = @options[:platform_id].try(:to_i)
|
||||
@options[:is_circle] = @options[:is_circle].present? ? @options[:is_circle] == "1" : nil
|
||||
@options[:bs_id] = @options[:bs_id].presence
|
||||
@options[:id] = @options[:id].presence
|
||||
@options[:project_name] = @options[:project_name].presence
|
||||
@options[:mass_build_id] = @options[:mass_build_id].presence
|
||||
@options[:new_core] = @options[:new_core].presence
|
||||
|
|
|
@ -45,9 +45,12 @@ class Project < ActiveRecord::Base
|
|||
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id, :publish_i686_into_x86_64
|
||||
attr_readonly :name, :owner_id, :owner_type
|
||||
|
||||
scope :recent, order("#{table_name}.name ASC")
|
||||
scope :recent, order("lower(#{table_name}.name) ASC")
|
||||
scope :search_order, order("CHAR_LENGTH(#{table_name}.name) ASC")
|
||||
scope :search, lambda {|q| by_name("%#{q.to_s.strip}%")}
|
||||
scope :search, lambda {|q|
|
||||
q = q.to_s.strip
|
||||
by_name("%#{q}%").search_order if q.present?
|
||||
}
|
||||
scope :by_name, lambda {|name| where("#{table_name}.name ILIKE ?", name) if name.present?}
|
||||
scope :by_owner_and_name, lambda { |*params|
|
||||
term = params.map(&:strip).join('/').downcase
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
.image= link_to(image_tag(avatar_url(user, :small), :alt => 'avatar'), user_path(user)) if user.persisted?
|
||||
.text
|
||||
%span
|
||||
= raw t('notifications.bodies.build_task', :task_num => task_num, :task_link => build_list_path(build_list_id))
|
||||
= raw t('notifications.bodies.build_task', :id => build_list_id, :task_link => build_list_path(build_list_id))
|
||||
= raw t('notifications.bodies.project', :project_link => link_to("#{project_owner}/#{project_name}", project_path(project_owner, project_name)) )
|
||||
- message, error = case status
|
||||
- when BuildList::BUILD_PENDING
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
|
||||
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
|
||||
%td= link_to build_list.id, build_list
|
||||
%td
|
||||
= build_list.human_status
|
||||
%br
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
=f.text_field attr, :readonly => "readonly", :size => 10, :class => 'mediumheight min input_cleanse', :value => date
|
||||
=link_to image_tag('x.png', :alt => 'x', :class => 'semi'), "#filter_#{attr}", :id => 'updated_at_clear'
|
||||
.both
|
||||
-%w[project_name bs_id].each do |filter|
|
||||
-%w[project_name id].each do |filter|
|
||||
%h3.medium= t "layout.build_lists.#{filter}_search"
|
||||
%input.mediumheight.input_cleanse{:id => "filter_#{filter}", :name => "filter[#{filter}]", :size => "30", :type => "text", :value => @filter.send(filter)}
|
||||
%br/
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
%tr{:id => "row#{platform_build_list_counter}"}
|
||||
%td= link_to (platform_build_list.bs_id.present? ? platform_build_list.bs_id : t("layout.build_lists.bs_id_not_set")), platform_build_list
|
||||
%td= link_to platform_build_list.id, platform_build_list
|
||||
%td= platform_build_list.human_status
|
||||
%td= link_to platform_build_list.project.name, platform_build_list.project
|
||||
%td= platform_build_list.updated_at
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.bs_id")
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.id")
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.status")
|
||||
%th.lpadding16= t("activerecord.attributes.build_list.project")
|
||||
%th.lpadding16= t("diff")
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
= t("layout.build_lists.creating")
|
||||
.both
|
||||
|
||||
.leftlist= t("activerecord.attributes.build_list.bs_id")
|
||||
.rightlist= @build_list.bs_id.present? ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")
|
||||
.leftlist= t("activerecord.attributes.build_list.id")
|
||||
.rightlist= @build_list.id
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.user")
|
||||
.rightlist
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
= "#{@build_list.arch.name}."
|
||||
%p
|
||||
More detailed information you can get by link:
|
||||
= link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
|
||||
= link_to "task [№ #{@build_list.id}]", build_list_url(@build_list)
|
||||
|
||||
= render 'footer'
|
||||
|
|
|
@ -10,6 +10,6 @@
|
|||
= "#{@build_list.arch.name}."
|
||||
%p
|
||||
Более подробную информацию можно получить по ссылке:
|
||||
= link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
|
||||
= link_to "задание [№ #{@build_list.id}]", build_list_url(@build_list)
|
||||
|
||||
= render 'footer'
|
||||
|
|
|
@ -39,7 +39,7 @@ en:
|
|||
delete_branch: '%{user_link} deleted a %{branch_name}'
|
||||
create_branch: '%{user_link} created a new branch %{branch_name}'
|
||||
update_branch: '%{user_link} pushed to branch %{branch_name}'
|
||||
build_task: 'Build <a href="%{task_link}">task #%{task_num}</a>'
|
||||
build_task: 'Build <a href="%{task_link}">task #%{id}</a>'
|
||||
build_status:
|
||||
published: published successfully
|
||||
success: completed successfully
|
||||
|
|
|
@ -40,7 +40,7 @@ ru:
|
|||
delete_branch: '%{user_link} удалил ветку %{branch_name}'
|
||||
create_branch: '%{user_link} создал новую ветку %{branch_name}'
|
||||
update_branch: '%{user_link} внес изменения в ветку %{branch_name}'
|
||||
build_task: 'Сборочное <a href="%{task_link}">задание №%{task_num}</a>'
|
||||
build_task: 'Сборочное <a href="%{task_link}">задание №%{id}</a>'
|
||||
build_status:
|
||||
published: успешно опубликовано
|
||||
success: успешно собрано
|
||||
|
|
|
@ -5,7 +5,7 @@ en:
|
|||
build_list_item: Build list item
|
||||
attributes:
|
||||
build_list:
|
||||
bs_id: Id
|
||||
id: Id
|
||||
name: Name
|
||||
extra_repositories: Extra repositories
|
||||
extra_build_lists: Extra build lists
|
||||
|
@ -60,9 +60,8 @@ en:
|
|||
created_at_end: "Build to start until:"
|
||||
updated_at_start: "Last update from BS on:"
|
||||
updated_at_end: " Last update from BS until:"
|
||||
bs_id_search: 'Search by Id'
|
||||
id_search: 'Search by Id'
|
||||
project_name_search: Search by project name
|
||||
bs_id_not_set: Id has not been configured yet
|
||||
items_header: Build items
|
||||
packages_header: Packages
|
||||
no_items_data: No data
|
||||
|
|
|
@ -5,7 +5,7 @@ ru:
|
|||
build_list_item: Элемент сборочного листа
|
||||
attributes:
|
||||
build_list:
|
||||
bs_id: Id
|
||||
id: Id
|
||||
name: Название
|
||||
extra_repositories: Дополнительные репозитории
|
||||
extra_build_lists: Дополнительные сборки
|
||||
|
@ -59,9 +59,8 @@ ru:
|
|||
created_at_end: "Время постановки на сборку по:"
|
||||
updated_at_start: "Время последнего обновления от BS с:"
|
||||
updated_at_end: "Время последнего обновления от BS по:"
|
||||
bs_id_search: 'Поиск по Id'
|
||||
id_search: 'Поиск по Id'
|
||||
project_name_search: Поиск по названию проекта
|
||||
bs_id_not_set: Id еще не присвоен
|
||||
items_header: Элементы сборки
|
||||
packages_header: Пакеты
|
||||
no_items_data: Данных нет
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class DropBsIdFromBuildLists < ActiveRecord::Migration
|
||||
|
||||
class BuildList < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def up
|
||||
remove_index :build_lists, :bs_id
|
||||
remove_column :build_lists, :bs_id
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :build_lists, :bs_id, :integer
|
||||
add_index :build_lists, :bs_id, :unique => true
|
||||
BuildList.update_all('bs_id = id')
|
||||
end
|
||||
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130624095928) do
|
||||
ActiveRecord::Schema.define(:version => 20130701121313) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -104,7 +104,6 @@ ActiveRecord::Schema.define(:version => 20130624095928) do
|
|||
add_index "build_list_packages", ["project_id"], :name => "index_build_list_packages_on_project_id"
|
||||
|
||||
create_table "build_lists", :force => true do |t|
|
||||
t.integer "bs_id"
|
||||
t.integer "status"
|
||||
t.string "project_version"
|
||||
t.integer "project_id"
|
||||
|
@ -142,7 +141,6 @@ ActiveRecord::Schema.define(:version => 20130624095928) do
|
|||
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", ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index"
|
||||
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"
|
||||
|
||||
create_table "comments", :force => true do |t|
|
||||
|
|
|
@ -11,13 +11,13 @@ module Modules::Observers::ActivityFeed::BuildList
|
|||
def build_list_notifications
|
||||
if mass_build.blank? && ( # Do not show mass build activity in activity feeds
|
||||
status_changed? && [
|
||||
BuildList::BUILD_PENDING,
|
||||
BuildList::BUILD_PUBLISHED,
|
||||
BuildList::SUCCESS,
|
||||
BuildList::BUILD_ERROR,
|
||||
BuildList::FAILED_PUBLISH,
|
||||
BuildList::TESTS_FAILED
|
||||
].include?(status) ||
|
||||
status == BuildList::BUILD_PENDING && bs_id_changed?
|
||||
].include?(status)
|
||||
)
|
||||
|
||||
updater = publisher || user
|
||||
|
@ -26,7 +26,6 @@ module Modules::Observers::ActivityFeed::BuildList
|
|||
:user => recipient,
|
||||
:kind => 'build_list_notification',
|
||||
:data => {
|
||||
:task_num => bs_id,
|
||||
:build_list_id => id,
|
||||
:status => status,
|
||||
:updated_at => updated_at,
|
||||
|
|
|
@ -1,58 +1,4 @@
|
|||
namespace :new_core do
|
||||
desc 'Sets bs_id field for all BuildList which use new_core'
|
||||
task :update_bs_id => :environment do
|
||||
say "[#{Time.zone.now}] Starting to update bs_id..."
|
||||
|
||||
BuildList.select(:id).
|
||||
where(:new_core => true, :bs_id => nil).
|
||||
find_in_batches(:batch_size => 500) do | bls |
|
||||
|
||||
puts "[#{Time.zone.now}] - where build_lists.id from #{bls.first.id} to #{bls.last.id}"
|
||||
BuildList.where(:id => bls.map(&:id), :bs_id => nil).
|
||||
update_all("bs_id = id")
|
||||
end
|
||||
|
||||
say "[#{Time.zone.now}] done"
|
||||
end
|
||||
|
||||
desc 'Publish mass-build 73'
|
||||
task :publish_mass_build_73 => :environment do
|
||||
say "[#{Time.zone.now}] Starting to publish mass-build 317..."
|
||||
|
||||
bl = BuildList.where(:mass_build_id => 73).first
|
||||
platform_repository_folder = "#{bl.save_to_platform.path}/repository"
|
||||
BuildList.where(:mass_build_id => 73).
|
||||
where(:status => [
|
||||
BuildList::SUCCESS,
|
||||
BuildList::FAILED_PUBLISH
|
||||
]).
|
||||
order(:id).
|
||||
find_in_batches(:batch_size => 1) do | bls |
|
||||
|
||||
bl = bls.first
|
||||
puts "[#{Time.zone.now}] - where build_lists.id #{bl.id}"
|
||||
|
||||
sha1 = bl.results.find{ |r| r['file_name'] =~ /.*\.tar\.gz$/ }['sha1']
|
||||
|
||||
system "cd #{platform_repository_folder} && curl -L -O #{APP_CONFIG['file_store_url']}/api/v1/file_stores/#{sha1}"
|
||||
system "cd #{platform_repository_folder} && tar -xzf #{sha1}"
|
||||
system "rm -f #{platform_repository_folder}/#{sha1}"
|
||||
|
||||
archive_folder = "#{platform_repository_folder}/archives"
|
||||
system "sudo chown root:root #{archive_folder}/SRC_RPM/*"
|
||||
system "sudo chmod 0666 #{archive_folder}/SRC_RPM/*"
|
||||
system "sudo chown root:root #{archive_folder}/RPM/*"
|
||||
system "sudo chmod 0666 #{archive_folder}/RPM/*"
|
||||
|
||||
system "sudo mv #{archive_folder}/SRC_RPM/* #{platform_repository_folder}/SRPMS/main/release/"
|
||||
system "sudo mv #{archive_folder}/RPM/* #{platform_repository_folder}/#{bl.arch.name}/main/release/"
|
||||
|
||||
system "sudo rm -rf #{archive_folder}"
|
||||
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||
end
|
||||
|
||||
say "[#{Time.zone.now}] done"
|
||||
end
|
||||
|
||||
desc 'Extracts all rpms from BuildList container and updates BuildList::Package#sha1 field'
|
||||
task :update_packages => :environment do
|
||||
|
|
|
@ -87,7 +87,7 @@ describe Api::V1::AdvisoriesController do
|
|||
stub_symlink_methods
|
||||
|
||||
@advisory = FactoryGirl.create(:advisory)
|
||||
@build_list = FactoryGirl.create(:build_list_core)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@build_list.save_to_platform.update_column(:released, true)
|
||||
@build_list.save_to_repository.update_column(:publish_without_qa, false)
|
||||
@build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
|
||||
|
|
|
@ -101,7 +101,7 @@ describe Api::V1::BuildListsController do
|
|||
Arch.destroy_all
|
||||
User.destroy_all
|
||||
|
||||
@build_list = FactoryGirl.create(:build_list_core)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@params = @build_list.attributes.symbolize_keys
|
||||
@project = @build_list.project
|
||||
@platform = @build_list.save_to_platform
|
||||
|
@ -115,8 +115,7 @@ describe Api::V1::BuildListsController do
|
|||
@build_list.save_to_platform.relations.create(:role => 'admin', :actor => @owner_user) # Why it's really need it??
|
||||
|
||||
# Create and show params:
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)
|
||||
.merge(:qwerty=>'!')} # wrong parameter
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.merge(:qwerty=>'!')} # wrong parameter
|
||||
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||
|
||||
|
@ -499,7 +498,7 @@ describe Api::V1::BuildListsController do
|
|||
Arch.destroy_all
|
||||
User.destroy_all
|
||||
|
||||
@build_list = FactoryGirl.create(:build_list_core)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@params = @build_list.attributes.symbolize_keys
|
||||
@project = @build_list.project
|
||||
@platform = @build_list.save_to_platform
|
||||
|
@ -510,7 +509,7 @@ describe Api::V1::BuildListsController do
|
|||
@member_user = FactoryGirl.create(:user)
|
||||
|
||||
# Create and show params:
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys.except(:bs_id)}
|
||||
@create_params = {:build_list => @build_list.attributes.symbolize_keys}
|
||||
@create_params = @create_params.merge(:arches => [@params[:arch_id]], :build_for_platforms => [@params[:build_for_platform_id]], :format => :json)
|
||||
any_instance_of(Project, :versions => ['v1.0', 'v2.0'])
|
||||
|
||||
|
@ -580,22 +579,22 @@ describe Api::V1::BuildListsController do
|
|||
@user = FactoryGirl.create(:user)
|
||||
|
||||
# Build Lists:
|
||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
||||
@build_list1 = FactoryGirl.create(:build_list)
|
||||
|
||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@build_list2 = FactoryGirl.create(:build_list)
|
||||
@build_list2.project.update_column(:visibility, 'hidden')
|
||||
|
||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
||||
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||
|
||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
||||
@build_list4 = FactoryGirl.create(:build_list)
|
||||
@build_list4.project.update_column(:visibility, 'hidden')
|
||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||
|
||||
@filter_build_list1 = FactoryGirl.create(:build_list_core)
|
||||
@filter_build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@filter_build_list3 = FactoryGirl.create(:build_list_core)
|
||||
@filter_build_list4 = FactoryGirl.create(:build_list_core, :updated_at => (Time.now - 1.day),
|
||||
@filter_build_list1 = FactoryGirl.create(:build_list)
|
||||
@filter_build_list2 = FactoryGirl.create(:build_list)
|
||||
@filter_build_list3 = FactoryGirl.create(:build_list)
|
||||
@filter_build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1.day),
|
||||
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
||||
:arch => @build_list3.arch)
|
||||
end
|
||||
|
@ -637,8 +636,8 @@ describe Api::V1::BuildListsController do
|
|||
http_login FactoryGirl.create(:admin)
|
||||
end
|
||||
|
||||
it 'should filter by bs_id' do
|
||||
get :index, :filter => {:bs_id => @filter_build_list1.bs_id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json
|
||||
it 'should filter by id' do
|
||||
get :index, :filter => {:id => @filter_build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}, :format => :json
|
||||
assigns[:build_lists].should include(@filter_build_list1)
|
||||
assigns[:build_lists].should_not include(@filter_build_list2)
|
||||
assigns[:build_lists].should_not include(@filter_build_list3)
|
||||
|
@ -666,7 +665,7 @@ describe Api::V1::BuildListsController do
|
|||
|
||||
context "for user" do
|
||||
before(:each) do
|
||||
@build_list = FactoryGirl.create(:build_list_core)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@params = @build_list.attributes.symbolize_keys
|
||||
@project = @build_list.project
|
||||
|
||||
|
@ -722,7 +721,7 @@ describe Api::V1::BuildListsController do
|
|||
context "for group" do
|
||||
before(:each) do
|
||||
@platform = FactoryGirl.create(:platform_with_repos)
|
||||
@build_list = FactoryGirl.create(:build_list_core, :save_to_platform => @platform)
|
||||
@build_list = FactoryGirl.create(:build_list, :save_to_platform => @platform)
|
||||
@project = @build_list.project
|
||||
@params = @build_list.attributes.symbolize_keys
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ describe AutocompletesController do
|
|||
end
|
||||
|
||||
context 'autocomplete_extra_build_list' do
|
||||
let(:build_list) { FactoryGirl.create(:build_list_core, :user => user) }
|
||||
let(:build_list) { FactoryGirl.create(:build_list, :user => user) }
|
||||
let(:params) { { :term => build_list.id,
|
||||
:platform_id => build_list.save_to_platform_id } }
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ describe Platforms::MassBuildsController do
|
|||
}
|
||||
|
||||
@mass_build = FactoryGirl.create(:mass_build, :save_to_platform => @platform, :user => @user, :projects_list => project.name)
|
||||
FactoryGirl.create(:build_list_core, :mass_build => @mass_build, :status => BuildList::SUCCESS)
|
||||
FactoryGirl.create(:build_list, :mass_build => @mass_build, :status => BuildList::SUCCESS)
|
||||
end
|
||||
|
||||
context 'for guest' do
|
||||
|
|
|
@ -113,7 +113,7 @@ describe Projects::BuildListsController do
|
|||
context 'for user' do
|
||||
before(:each) do
|
||||
any_instance_of(BuildList, :current_duration => 100)
|
||||
@build_list = FactoryGirl.create(:build_list_core)
|
||||
@build_list = FactoryGirl.create(:build_list)
|
||||
@project = @build_list.project
|
||||
@owner_user = @project.owner
|
||||
@member_user = FactoryGirl.create(:user)
|
||||
|
@ -223,15 +223,15 @@ describe Projects::BuildListsController do
|
|||
|
||||
context 'for all build lists' do
|
||||
before(:each) do
|
||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
||||
@build_list1 = FactoryGirl.create(:build_list)
|
||||
|
||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@build_list2 = FactoryGirl.create(:build_list)
|
||||
@build_list2.project.update_column(:visibility, 'hidden')
|
||||
|
||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
||||
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||
|
||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
||||
@build_list4 = FactoryGirl.create(:build_list)
|
||||
@build_list4.project.update_column(:visibility, 'hidden')
|
||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||
end
|
||||
|
@ -312,15 +312,15 @@ describe Projects::BuildListsController do
|
|||
|
||||
context 'for all build lists' do
|
||||
before(:each) do
|
||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
||||
@build_list1 = FactoryGirl.create(:build_list)
|
||||
|
||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@build_list2 = FactoryGirl.create(:build_list)
|
||||
@build_list2.project.update_column(:visibility, 'hidden')
|
||||
|
||||
project = FactoryGirl.create(:project_with_commit, :visibility => 'hidden', :owner => @user)
|
||||
@build_list3 = FactoryGirl.create(:build_list_core_with_attaching_project, :project => project)
|
||||
@build_list3 = FactoryGirl.create(:build_list_with_attaching_project, :project => project)
|
||||
|
||||
@build_list4 = FactoryGirl.create(:build_list_core)
|
||||
@build_list4 = FactoryGirl.create(:build_list)
|
||||
@build_list4.project.update_column(:visibility, 'hidden')
|
||||
@build_list4.project.relations.create! :role => 'reader', :actor_id => @user.id, :actor_type => 'User'
|
||||
end
|
||||
|
@ -386,16 +386,16 @@ describe Projects::BuildListsController do
|
|||
before(:each) do
|
||||
set_session_for FactoryGirl.create(:admin)
|
||||
|
||||
@build_list1 = FactoryGirl.create(:build_list_core)
|
||||
@build_list2 = FactoryGirl.create(:build_list_core)
|
||||
@build_list3 = FactoryGirl.create(:build_list_core)
|
||||
@build_list4 = FactoryGirl.create(:build_list_core, :updated_at => (Time.now - 1.day),
|
||||
@build_list1 = FactoryGirl.create(:build_list)
|
||||
@build_list2 = FactoryGirl.create(:build_list)
|
||||
@build_list3 = FactoryGirl.create(:build_list)
|
||||
@build_list4 = FactoryGirl.create(:build_list, :updated_at => (Time.now - 1.day),
|
||||
:project => @build_list3.project, :save_to_platform => @build_list3.save_to_platform,
|
||||
:arch => @build_list3.arch)
|
||||
end
|
||||
|
||||
it 'should filter by bs_id' do
|
||||
get :index, :filter => {:bs_id => @build_list1.bs_id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}
|
||||
it 'should filter by id' do
|
||||
get :index, :filter => {:id => @build_list1.id, :project_name => 'fdsfdf', :any_other_field => 'do not matter'}
|
||||
assigns[:build_lists].should include(@build_list1)
|
||||
assigns[:build_lists].should_not include(@build_list2)
|
||||
assigns[:build_lists].should_not include(@build_list3)
|
||||
|
|
|
@ -22,15 +22,7 @@ FactoryGirl.define do
|
|||
before(:create) { |bl| attach_project_to_build_list bl }
|
||||
end
|
||||
|
||||
factory :build_list_core, :parent => :build_list do
|
||||
bs_id { FactoryGirl.generate(:integer) }
|
||||
end
|
||||
|
||||
factory :build_list_core_with_attaching_project, :parent => :build_list_core do
|
||||
before(:create) { |bl| attach_project_to_build_list bl }
|
||||
end
|
||||
|
||||
factory :build_list_by_group_project, :parent => :build_list_core do
|
||||
factory :build_list_by_group_project, :parent => :build_list do
|
||||
project { |bl|
|
||||
pr = FactoryGirl.create(:group_project_with_commit)
|
||||
bl.save_to_platform.repositories.first.projects << pr
|
||||
|
|
|
@ -9,11 +9,11 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
before do
|
||||
init_test_root
|
||||
stub_symlink_methods
|
||||
FactoryGirl.create(:build_list_core, :new_core => true)
|
||||
FactoryGirl.create(:build_list)
|
||||
end
|
||||
|
||||
subject { AbfWorker::BuildListsPublishTaskManager }
|
||||
let(:build_list) { FactoryGirl.create(:build_list_core, :new_core => true) }
|
||||
let(:build_list) { FactoryGirl.create(:build_list) }
|
||||
|
||||
context 'when no items for publishing' do
|
||||
before do
|
||||
|
@ -76,7 +76,7 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
end
|
||||
|
||||
context 'grouping build lists for publishing into same repository' do
|
||||
let(:build_list2) { FactoryGirl.create(:build_list_core,
|
||||
let(:build_list2) { FactoryGirl.create(:build_list,
|
||||
:new_core => true,
|
||||
:save_to_platform => build_list.save_to_platform,
|
||||
:save_to_repository => build_list.save_to_repository,
|
||||
|
@ -122,7 +122,7 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
stub_redis
|
||||
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||
4.times {
|
||||
bl = FactoryGirl.create(:build_list_core, :new_core => true)
|
||||
bl = FactoryGirl.create(:build_list, :new_core => true)
|
||||
bl.update_column(:status, BuildList::BUILD_PUBLISH)
|
||||
}
|
||||
2.times{ subject.new.run }
|
||||
|
@ -180,13 +180,13 @@ describe AbfWorker::BuildListsPublishTaskManager do
|
|||
end
|
||||
|
||||
context 'grouping build lists for publishing and tasks for removing project from repository' do
|
||||
let(:build_list2) { FactoryGirl.create(:build_list_core,
|
||||
let(:build_list2) { FactoryGirl.create(:build_list,
|
||||
:new_core => true,
|
||||
:save_to_platform => build_list.save_to_platform,
|
||||
:save_to_repository => build_list.save_to_repository,
|
||||
:build_for_platform => build_list.build_for_platform
|
||||
) }
|
||||
let(:build_list3) { FactoryGirl.create(:build_list_core,
|
||||
let(:build_list3) { FactoryGirl.create(:build_list,
|
||||
:new_core => true,
|
||||
:save_to_platform => build_list.save_to_platform,
|
||||
:save_to_repository => build_list.save_to_repository,
|
||||
|
|
|
@ -18,7 +18,7 @@ describe BuildList do
|
|||
context "#notify_users" do
|
||||
before { stub_symlink_methods }
|
||||
let!(:user) { FactoryGirl.create(:user) }
|
||||
let!(:build_list) { FactoryGirl.create(:build_list_core,
|
||||
let!(:build_list) { FactoryGirl.create(:build_list,
|
||||
:user => user,
|
||||
:auto_publish => false) }
|
||||
let!(:build_list_package) { FactoryGirl.create(:build_list_package,
|
||||
|
@ -141,7 +141,7 @@ describe BuildList do
|
|||
|
||||
it "doesn't get 2 notification by email when user associated to project and created task" do
|
||||
project = FactoryGirl.create(:project_with_commit, :owner => user)
|
||||
bl = FactoryGirl.create(:build_list_core_with_attaching_project,
|
||||
bl = FactoryGirl.create(:build_list_with_attaching_project,
|
||||
:user => user,
|
||||
:auto_publish => true,
|
||||
:project => project
|
||||
|
|
Loading…
Reference in New Issue