From 66c285c796a4220c3a31906a615dc68f97393735 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 22:22:48 +0400 Subject: [PATCH] [Refs #263] Delete AutoBuildList --- .../auto_build_lists_controller.rb | 45 ------------------- app/models/auto_build_list.rb | 11 ----- .../20120329181830_remove_auto_build_list.rb | 16 +++++++ db/schema.rb | 26 +++++------ .../auto_build_lists_controller_spec.rb | 6 --- spec/models/auto_build_list_spec.rb | 6 --- 6 files changed, 26 insertions(+), 84 deletions(-) delete mode 100644 app/controllers/auto_build_lists_controller.rb delete mode 100644 app/models/auto_build_list.rb create mode 100644 db/migrate/20120329181830_remove_auto_build_list.rb delete mode 100644 spec/controllers/auto_build_lists_controller_spec.rb delete mode 100644 spec/models/auto_build_list_spec.rb diff --git a/app/controllers/auto_build_lists_controller.rb b/app/controllers/auto_build_lists_controller.rb deleted file mode 100644 index e69f6ecc1..000000000 --- a/app/controllers/auto_build_lists_controller.rb +++ /dev/null @@ -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 diff --git a/app/models/auto_build_list.rb b/app/models/auto_build_list.rb deleted file mode 100644 index ce88aa10a..000000000 --- a/app/models/auto_build_list.rb +++ /dev/null @@ -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 diff --git a/db/migrate/20120329181830_remove_auto_build_list.rb b/db/migrate/20120329181830_remove_auto_build_list.rb new file mode 100644 index 000000000..a6fe98332 --- /dev/null +++ b/db/migrate/20120329181830_remove_auto_build_list.rb @@ -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 \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index fe45f84a7..5596d9be6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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 diff --git a/spec/controllers/auto_build_lists_controller_spec.rb b/spec/controllers/auto_build_lists_controller_spec.rb deleted file mode 100644 index 9bb22cbc6..000000000 --- a/spec/controllers/auto_build_lists_controller_spec.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding : utf-8 -*- -require 'spec_helper' - -describe AutoBuildListsController do - -end diff --git a/spec/models/auto_build_list_spec.rb b/spec/models/auto_build_list_spec.rb deleted file mode 100644 index c1c757e3b..000000000 --- a/spec/models/auto_build_list_spec.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding : utf-8 -*- -require 'spec_helper' - -describe AutoBuildList do - pending "add some examples to (or delete) #{__FILE__}" -end