[Refs #263] Delete AutoBuildList

This commit is contained in:
Vladimir Sharshov 2012-03-29 22:22:48 +04:00
parent eac5461a29
commit 66c285c796
6 changed files with 26 additions and 84 deletions

View File

@ -1,45 +0,0 @@
# -*- encoding : utf-8 -*-
class AutoBuildListsController < ApplicationController
before_filter :authenticate_user!, :except => :auto_build
before_filter :find_auto_build_list, :only => :destroy
load_and_authorize_resource
def index
projects = Project.where(:owner_id => current_user.id, :owner_type => 'User').order('name ASC')
@projects_not_automated = projects.automateable.paginate(:page => params[:not_automated_page])
@projects_not_automated = @projects_not_automated.where(:name => params[:name]) unless params[:name].blank?
@projects_already_automated = projects.select('projects.*, auto_build_lists.id auto_build_lists_id').
joins(:auto_build_lists).paginate(:page => params[:already_automated_page])
end
def create
@auto_build_list = AutoBuildList.new(
:bpl_id => Platform.find_by_name('mandriva2011').try(:id),
:pl_id => current_user.personal_platform.id,
:arch_id => Arch.find_by_name('i586').id,
:project_id => params[:project_id])
if @auto_build_list.save
redirect_to auto_build_lists_path, :notice => t('flash.auto_build_list.success')
else
redirect_to auto_build_lists_path, :notice => t('flash.auto_build_list.failed')
end
end
def destroy
if @auto_build_list.destroy
flash[:notice] = t('flash.auto_build_list.cancel')
else
flash[:notice] = t('flash.auto_build_list.cancel_failed')
end
redirect_to auto_build_lists_path
end
protected
def find_auto_build_list
@auto_build_list = AutoBuildList.find(params[:id])
end
end

View File

@ -1,11 +0,0 @@
# -*- encoding : utf-8 -*-
class AutoBuildList < ActiveRecord::Base
belongs_to :project
belongs_to :arch
belongs_to :pl, :class_name => 'Platform'
belongs_to :bpl, :class_name => 'Platform'
def event_log_message
{:project => project.name}.inspect
end
end

View File

@ -0,0 +1,16 @@
class RemoveAutoBuildList < ActiveRecord::Migration
def self.up
drop_table :auto_build_lists
end
def self.down
create_table :auto_build_lists, :force => true do |t|
t.integer "project_id"
t.integer "arch_id"
t.integer "pl_id"
t.integer "bpl_id"
t.datetime "created_at"
t.datetime "updated_at"
end
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120326142636) do
ActiveRecord::Schema.define(:version => 20120329181830) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -40,15 +40,6 @@ ActiveRecord::Schema.define(:version => 20120326142636) do
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
add_index "authentications", ["user_id"], :name => "index_authentications_on_user_id"
create_table "auto_build_lists", :force => true do |t|
t.integer "project_id"
t.integer "arch_id"
t.integer "pl_id"
t.integer "bpl_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "build_list_items", :force => true do |t|
t.string "name"
t.integer "level"
@ -286,23 +277,26 @@ ActiveRecord::Schema.define(:version => 20120326142636) 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
end
add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
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"
t.string "email"
t.string "token"
t.boolean "approved", :default => false
t.boolean "rejected", :default => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "interest"
t.text "more"
end
@ -375,9 +369,6 @@ ActiveRecord::Schema.define(:version => 20120326142636) do
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.integer "own_projects_count", :default => 0, :null => false
t.datetime "reset_password_sent_at"
t.text "professional_experience"
@ -391,6 +382,9 @@ ActiveRecord::Schema.define(:version => 20120326142636) do
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"
end
add_index "users", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true

View File

@ -1,6 +0,0 @@
# -*- encoding : utf-8 -*-
require 'spec_helper'
describe AutoBuildListsController do
end

View File

@ -1,6 +0,0 @@
# -*- encoding : utf-8 -*-
require 'spec_helper'
describe AutoBuildList do
pending "add some examples to (or delete) #{__FILE__}"
end