From 66c285c796a4220c3a31906a615dc68f97393735 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 22:22:48 +0400 Subject: [PATCH 1/6] [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 From 5db485a4c069435d94e550fb5c7d4ae53b97afb7 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 22:43:46 +0400 Subject: [PATCH 2/6] [Refs #263] Remove Aut BuildList. Part 2 --- app/controllers/application_controller.rb | 2 +- app/models/event_log_observer.rb | 2 +- app/models/project.rb | 14 ---------- .../auto_build_lists/_already_automated.haml | 13 --------- .../auto_build_lists/_not_automated.html.haml | 13 --------- app/views/auto_build_lists/index.html.haml | 19 ------------- config/locales/en.yml | 27 ------------------- config/locales/menu.en.yml | 1 - config/locales/menu.ru.yml | 1 - config/locales/models/event_log.en.yml | 6 ----- config/locales/models/event_log.ru.yml | 6 ----- config/locales/ru.yml | 26 ------------------ config/routes.rb | 2 -- lib/grack/handler.rb | 2 -- 14 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 app/views/auto_build_lists/_already_automated.haml delete mode 100644 app/views/auto_build_lists/_not_automated.html.haml delete mode 100644 app/views/auto_build_lists/index.html.haml diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9170ab957..70b3fcb82 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -6,7 +6,7 @@ class ApplicationController < ActionController::Base before_filter :set_locale before_filter lambda { EventLog.current_controller = self }, - :only => [:create, :destroy, :open_id, :auto_build, :cancel, :publish, :change_visibility] # :update + :only => [:create, :destroy, :open_id, :cancel, :publish, :change_visibility] # :update after_filter lambda { EventLog.current_controller = nil } helper_method :get_owner diff --git a/app/models/event_log_observer.rb b/app/models/event_log_observer.rb index 7adbeb446..1518ef9fd 100644 --- a/app/models/event_log_observer.rb +++ b/app/models/event_log_observer.rb @@ -1,6 +1,6 @@ # -*- encoding : utf-8 -*- class EventLogObserver < ActiveRecord::Observer - observe :user, :private_user, :platform, :repository, :project, :product, :build_list, :auto_build_list, :product_build_list + observe :user, :private_user, :platform, :repository, :project, :product, :build_list, :product_build_list def after_create(record) ActiveSupport::Notifications.instrument("event_log.observer", :object => record) diff --git a/app/models/project.rb b/app/models/project.rb index 56ddb58b0..83b246f69 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -8,7 +8,6 @@ class Project < ActiveRecord::Base has_many :issues, :dependent => :destroy has_many :build_lists, :dependent => :destroy - has_many :auto_build_lists, :dependent => :destroy has_many :project_imports, :dependent => :destroy has_many :project_to_repositories, :dependent => :destroy @@ -36,7 +35,6 @@ class Project < ActiveRecord::Base scope :by_visibilities, lambda {|v| where(:visibility => v)} scope :opened, where(:visibility => 'open') scope :addable_to_repository, lambda { |repository_id| where("projects.id NOT IN (SELECT project_to_repositories.project_id FROM project_to_repositories WHERE (project_to_repositories.repository_id = #{ repository_id }))") } - scope :automateable, where("projects.id NOT IN (SELECT auto_build_lists.project_id FROM auto_build_lists)") after_create :attach_to_personal_repository after_create :create_git_repo @@ -53,18 +51,6 @@ class Project < ActiveRecord::Base include Modules::Models::Owner - def auto_build - auto_build_lists.each do |auto_build_list| - build_lists.create( - :pl => auto_build_list.pl, - :bpl => auto_build_list.bpl, - :arch => auto_build_list.arch, - :project_version => versions.last, - :build_requires => true, - :update_type => 'bugfix') unless build_lists.for_creation_date_period(Time.current - 15.seconds, Time.current).present? - end - end - def build_for(platform, user, arch = 'i586') # Return i586 after mass rebuild arch = Arch.find_by_name(arch) if arch.acts_like?(:string) build_lists.create do |bl| diff --git a/app/views/auto_build_lists/_already_automated.haml b/app/views/auto_build_lists/_already_automated.haml deleted file mode 100644 index 49ade241f..000000000 --- a/app/views/auto_build_lists/_already_automated.haml +++ /dev/null @@ -1,13 +0,0 @@ -%h1= t("layout.auto_build_lists.already_automated") - -%table.table - %tr - %th= t("activerecord.attributes.auto_build_list.project") - %th.last= t("layout.auto_build_lists.action") - - - @projects_already_automated.each do |project| - %tr{:class => cycle("odd", "even")} - %td= link_to project.name, project_path(project) - %td= link_to t("layout.auto_build_lists.cancel_btn"), auto_build_list_path(project.auto_build_lists_id), :method => :delete, :confirm => t("layout.confirm") - -= will_paginate @projects_already_automated, :param_name => 'already_automated_page' \ No newline at end of file diff --git a/app/views/auto_build_lists/_not_automated.html.haml b/app/views/auto_build_lists/_not_automated.html.haml deleted file mode 100644 index da198e54f..000000000 --- a/app/views/auto_build_lists/_not_automated.html.haml +++ /dev/null @@ -1,13 +0,0 @@ -%h1= t("layout.auto_build_lists.not_automated") - -%table.table - %tr - %th= t("activerecord.attributes.auto_build_list.project") - %th.last= t("layout.auto_build_lists.action") - - - @projects_not_automated.each do |project| - %tr{:class => cycle("odd", "even")} - %td= link_to project.name, project_path(project) - %td= link_to t("layout.auto_build_lists.automate_btn"), auto_build_lists_path(:project_id => project.id), :method => :post, :confirm => t("layout.confirm") - -= will_paginate @projects_not_automated, :param_name => 'not_automated_page' \ No newline at end of file diff --git a/app/views/auto_build_lists/index.html.haml b/app/views/auto_build_lists/index.html.haml deleted file mode 100644 index 3acf63785..000000000 --- a/app/views/auto_build_lists/index.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -.block - .content - .inner - %h2= t('layout.auto_build_lists.header') - %h3= t('layout.auto_build_lists.message') - - .inner - = render :partial => "auto_build_lists/not_automated" - - %br - %br - %br - - .inner - = render :partial => "auto_build_lists/already_automated" - - %br - %br - %br \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index eefa2d4e0..3b4bc3759 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -69,16 +69,6 @@ en: message: Automatically updated every 24 hours refresh_btn: Refresh - auto_build_lists: - header: Automated build projects - message: All projects build under user repository and architecture i586 - project: Project - action: Action - automate_btn: Automate - cancel_btn: Cancel - not_automated: Not automated - already_automated: Automated - weekdays: Monday: Monday Tuesday: Tuesday @@ -176,12 +166,6 @@ en: successfully_added: Member %s successfully added error_in_adding: Member %s adding error - auto_build_list: - success: Automated build success! - failed: Automated build failed! - cancel: Automated build canceled! - cancel_failed: Automated build canceling failed! - category: saved: Category saved save_error: Category saves error @@ -215,7 +199,6 @@ en: private_user: Private user product_build_list: Product build list download: Statistics - auto_build_list: Auto rebuild list attributes: settings: @@ -229,16 +212,6 @@ en: new_comment_commit_repo_owner: Notify about comments to my repository commits new_comment_commit_commentor: Notify about comments after my commit - auto_build_list: - project_id: Project - project: Project - bpl_id: Repository for saving - bpl: Repository for saving - pl_id: Platform - pl: Platform - arch_id: Architecture - arch: Architecture - private_user: login: Login password: Password diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index f01ce212f..f9aeb6885 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -4,7 +4,6 @@ en: personal_repository: My repository products: Products categories: Catalogue - auto_build_lists: Automated builds downloads: Statistics top_menu: platforms: Platforms diff --git a/config/locales/menu.ru.yml b/config/locales/menu.ru.yml index 6ae802418..858689f6c 100644 --- a/config/locales/menu.ru.yml +++ b/config/locales/menu.ru.yml @@ -4,7 +4,6 @@ ru: products: Продукты repositories: Репозитории personal_repository: Мой репозиторий - auto_build_lists: Авто. сборки downloads: Статистика top_menu: platforms: Платформы diff --git a/config/locales/models/event_log.en.yml b/config/locales/models/event_log.en.yml index b2b9cef02..3a3b60cd4 100644 --- a/config/locales/models/event_log.en.yml +++ b/config/locales/models/event_log.en.yml @@ -6,7 +6,6 @@ en: repositories_controller: 'Repositories Management' projects_controller: 'Projects Management' build_lists_controller: 'Build lists management' - auto_build_lists_controller: 'Automatic builds management' product_build_lists_controller: 'Products build management' 'devise/registrations_controller': 'User Registration' 'devise/sessions_controller': 'User Authentication' @@ -21,15 +20,10 @@ en: destroy: 'exit' 'users/omniauth_callbacks_controller': open_id: 'login via OpenID' - projects_controller: - auto_build: 'sent to automatic build' build_lists_controller: create: 'sent to build' cancel: 'build abolished' publish: 'build published' - auto_build_lists_controller: - create: 'assigned' - destroy: 'canceled' product_build_lists_controller: create: 'sent to build' rpc_controller: diff --git a/config/locales/models/event_log.ru.yml b/config/locales/models/event_log.ru.yml index 68a1d390a..5e356c988 100644 --- a/config/locales/models/event_log.ru.yml +++ b/config/locales/models/event_log.ru.yml @@ -6,7 +6,6 @@ ru: repositories_controller: 'Управление репозиториями' projects_controller: 'Управление проектами' build_lists_controller: 'Управление сборочными листами' - auto_build_lists_controller: 'Управление автоматической сборкой' product_build_lists_controller: 'Управление сборкой продуктов' 'devise/registrations_controller': 'Регистрация пользователей' 'devise/sessions_controller': 'Аутентификация пользователей' @@ -21,15 +20,10 @@ ru: destroy: 'выход' 'users/omniauth_callbacks_controller': open_id: 'вход через OpenID' - projects_controller: - auto_build: 'отправлен на автоматическую сборку' build_lists_controller: create: 'отправлен на сборку' cancel: 'сборка отменена' publish: 'сборка опубликована' - auto_build_lists_controller: - create: 'назначена' - destroy: 'отменена' product_build_lists_controller: create: 'отправлен на сборку' rpc_controller: diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 8989582d7..a8c9d7614 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -69,16 +69,6 @@ ru: message: Обновляется автоматически каждые 24 часа refresh_btn: Обновить - auto_build_lists: - header: Проекты с автоматической сборкой - message: Все проекты собираются под пользовательский репозиторий и архитектуру i586 - project: Проект - action: Действие - automate_btn: Автоматизировать - cancel_btn: Отменить - not_automated: Не автоматизированы - already_automated: Автоматизированы - weekdays: Monday: Понедельник Tuesday: Вторник @@ -176,12 +166,6 @@ ru: successfully_added: Участник %s успешно добавлен error_in_adding: Ошибка при добавлении участника %s - auto_build_list: - success: Сборка проекта автоматизорована! - failed: Не удалось автоматизировать сборку! - cancel: Автоматическая сборка проекта отменена! - cancel_failed: Не удалось отменить автоматическую сборку проекта! - category: saved: Категория успешно сохранена save_error: Не удалось сохранить категорию @@ -229,16 +213,6 @@ ru: new_comment_commit_repo_owner: Оповещать о комментариях к коммитам в моем репозитории new_comment_commit_commentor: Оповещать о комментариях к коммиту после моего - auto_build_list: - project_id: Проект - project: Проект - bpl_id: Репозиторий для сохранения - bpl: Репозиторий для сохранения - pl_id: Платформа - pl: Платформа - arch_id: Архитектура - arch: Архитектура - private_user: login: Логин password: Пароль diff --git a/config/routes.rb b/config/routes.rb index 44906e335..20dc90673 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -65,8 +65,6 @@ Rosa::Application.routes.draw do collection { post :search } end - resources :auto_build_lists, :only => [:index, :create, :destroy] - resources :personal_repositories, :only => [:show] do member do get :settings diff --git a/lib/grack/handler.rb b/lib/grack/handler.rb index 587fa2170..4fda63ef5 100644 --- a/lib/grack/handler.rb +++ b/lib/grack/handler.rb @@ -9,8 +9,6 @@ module Grack def call(env) super if git? - # TODO event_log? - project.delay.auto_build if write? # hook ::GitHttp::App.new(@config).call(env) else @app.call(env) From 0c2d0f46120270fcc6f69fdc219715e65ad3d8e8 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 23:00:44 +0400 Subject: [PATCH 3/6] [Refs #263] Delete Categories --- app/controllers/categories_controller.rb | 78 ---------- app/helpers/application_helper.rb | 2 +- app/models/category.rb | 10 -- app/models/project.rb | 3 +- app/views/categories/_category.html.haml | 9 -- app/views/categories/_form.html.haml | 15 -- app/views/categories/_sidebar.html.haml | 0 app/views/categories/edit.html.haml | 11 -- app/views/categories/index.html.haml | 17 --- app/views/categories/index2.html.haml | 14 -- app/views/categories/new.html.haml | 9 -- app/views/categories/platforms.html.haml | 31 ---- app/views/categories/show.html.haml | 15 -- app/views/projects/_form.html.haml | 5 +- config/locales/en.yml | 20 --- config/locales/menu.en.yml | 1 - config/locales/menu.ru.yml | 1 - config/locales/models/project.en.yml | 1 - config/locales/models/project.ru.yml | 1 - config/locales/ru.yml | 20 --- config/routes.rb | 8 -- .../20120329182602_delete_categories.rb | 17 +++ db/schema.rb | 12 +- db/seeds.rb | 134 ------------------ 24 files changed, 21 insertions(+), 413 deletions(-) delete mode 100644 app/controllers/categories_controller.rb delete mode 100644 app/models/category.rb delete mode 100644 app/views/categories/_category.html.haml delete mode 100644 app/views/categories/_form.html.haml delete mode 100644 app/views/categories/_sidebar.html.haml delete mode 100644 app/views/categories/edit.html.haml delete mode 100644 app/views/categories/index.html.haml delete mode 100644 app/views/categories/index2.html.haml delete mode 100644 app/views/categories/new.html.haml delete mode 100644 app/views/categories/platforms.html.haml delete mode 100644 app/views/categories/show.html.haml create mode 100644 db/migrate/20120329182602_delete_categories.rb diff --git a/app/controllers/categories_controller.rb b/app/controllers/categories_controller.rb deleted file mode 100644 index f7ed16b9d..000000000 --- a/app/controllers/categories_controller.rb +++ /dev/null @@ -1,78 +0,0 @@ -# -*- encoding : utf-8 -*- -class CategoriesController < ApplicationController - before_filter :authenticate_user! - before_filter :find_category, :only => [:show, :edit, :update, :destroy] - before_filter :find_platform, :only => [:show, :index] - - load_and_authorize_resource - - def platforms - @all_platforms = Platform.all - @all_platforms_count = Platform.joins(:repositories => :projects).group('platforms.id').count - @personal_platforms = Platform.personal - @personal_platforms_count = Platform.personal.joins(:repositories => :projects).group('platforms.id').count - @main_platforms = Platform.main - @main_platforms_count = Platform.main.joins(:repositories => :projects).group('platforms.id').count - end - - def index - if @platform - @categories = Category.select('categories.id, categories.name, categories.ancestry, count(projects.id) projects_count'). - joins(:projects => :repositories).where('repositories.platform_id = ?', @platform.id). - having('count(projects.id) > 0').group('categories.id, categories.name, categories.ancestry, projects_count') - render 'index2' - else - @categories = Category.paginate(:page => params[:page]) - end - end - - def show - @projects = @category.projects - @projects = @projects.joins(:repositories).where("repositories.platform_id = ?", @platform.id) if @platform - @projects = @projects.paginate :page => params[:page] - end - - def new - @category = Category.new - end - - def edit - end - - def destroy - @category.destroy - flash[:notice] = t("flash.category.destroyed") - redirect_to categories_path - end - - def create - @category = Category.new params[:category] - if @category.save - flash[:notice] = t('flash.category.saved') - redirect_to categories_path - else - flash[:error] = t('flash.category.save_error') - render :action => :new - end - end - - def update - if @category.update_attributes(params[:category]) - flash[:notice] = t('flash.category.saved') - redirect_to categories_path - else - flash[:error] = t('flash.category.save_error') - render :action => :edit - end - end - - protected - - def find_category - @category = Category.find(params[:id]) - end - - def find_platform - @platform = Platform.find(params[:platform_id]) if params[:platform_id] - end -end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 1052213cc..ec035d7bc 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,7 +1,7 @@ # -*- encoding : utf-8 -*- module ApplicationHelper def choose_title - title = if ['categories', 'personal_repositories', 'downloads'].include?(controller.controller_name) + title = if ['personal_repositories', 'downloads'].include?(controller.controller_name) APP_CONFIG['repo_project_name'] else APP_CONFIG['project_name'] diff --git a/app/models/category.rb b/app/models/category.rb deleted file mode 100644 index a7cb4d328..000000000 --- a/app/models/category.rb +++ /dev/null @@ -1,10 +0,0 @@ -# -*- encoding : utf-8 -*- -class Category < ActiveRecord::Base - has_many :projects, :dependent => :nullify - - validates :name, :presence => true - - default_scope order('categories.name') - - has_ancestry -end diff --git a/app/models/project.rb b/app/models/project.rb index 83b246f69..8f52595aa 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -3,7 +3,6 @@ class Project < ActiveRecord::Base VISIBILITIES = ['open', 'hidden'] MAX_OWN_PROJECTS = 32000 - belongs_to :category, :counter_cache => true belongs_to :owner, :polymorphic => true, :counter_cache => :own_projects_count has_many :issues, :dependent => :destroy @@ -21,7 +20,7 @@ class Project < ActiveRecord::Base 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 } - # validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?} + validates_attachment_size :srpm, :less_than => 500.megabytes validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type') diff --git a/app/views/categories/_category.html.haml b/app/views/categories/_category.html.haml deleted file mode 100644 index 013dc5310..000000000 --- a/app/views/categories/_category.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%tr{:class => cycle("odd", "even")} - %td - = link_to category.name, category - (#{category.projects_count}) - %td= category.parent.try(:name) - %td.last - = link_to t("layout.edit"), edit_category_path(category) - | - = link_to t("layout.delete"), category_path(category), :method => :delete, :confirm => t("layout.categories.confirm_delete") \ No newline at end of file diff --git a/app/views/categories/_form.html.haml b/app/views/categories/_form.html.haml deleted file mode 100644 index dc652871c..000000000 --- a/app/views/categories/_form.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -= form_for @category, :html => { :class => :form } do |f| - .group - = f.label :parent_id, :class => :label - = f.collection_select :parent_id, Category.roots, :id, :name, :include_blank => true - - .group - = f.label :name, :class => :label - = f.text_field :name, :class => 'text_field' - - .group.navform.wat-cf - %button.button{:type => "submit"} - = image_tag("choose.png", :alt => t("layout.save")) - = t("layout.save") - %span.text_button_padding= t("layout.or") - = link_to t("layout.cancel"), categories_path, :class => "text_button_padding link_button" diff --git a/app/views/categories/_sidebar.html.haml b/app/views/categories/_sidebar.html.haml deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/categories/edit.html.haml b/app/views/categories/edit.html.haml deleted file mode 100644 index c279e42ac..000000000 --- a/app/views/categories/edit.html.haml +++ /dev/null @@ -1,11 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.categories.list"), categories_path - %li= link_to t("layout.categories.platforms"), platforms_categories_path - %li= link_to t("layout.categories.new"), new_category_path - %li.active= link_to t("layout.categories.edit"), edit_category_path - .content - %h2.title= t("layout.categories.edit_header") - .inner= render "form" -- content_for :sidebar, render('sidebar') diff --git a/app/views/categories/index.html.haml b/app/views/categories/index.html.haml deleted file mode 100644 index 52700aad1..000000000 --- a/app/views/categories/index.html.haml +++ /dev/null @@ -1,17 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first.active= link_to t("layout.categories.list"), categories_path - %li= link_to t("layout.categories.platforms"), platforms_categories_path - %li= link_to t("layout.categories.new"), new_category_path - .content - %h2.title= t("layout.categories.list_header") - .inner - %table.table - %tr - %th= t("activerecord.attributes.category.name") - %th= t("activerecord.attributes.category.parent_id") - %th.last   - = render @categories - .actions-bar.wat-cf - .actions= will_paginate @categories diff --git a/app/views/categories/index2.html.haml b/app/views/categories/index2.html.haml deleted file mode 100644 index 97e74afed..000000000 --- a/app/views/categories/index2.html.haml +++ /dev/null @@ -1,14 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.categories.list"), categories_path - %li.active= link_to t("layout.categories.platforms"), platforms_categories_path - .content - %h2.title= @platform.name - .inner - %table.table - - @categories.each do |category| - %tr{:class => cycle("odd", "even")} - %td= link_to category.name, [@platform, category] - %td= category.parent.name - %td.last= category.projects_count \ No newline at end of file diff --git a/app/views/categories/new.html.haml b/app/views/categories/new.html.haml deleted file mode 100644 index a7c6611db..000000000 --- a/app/views/categories/new.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to "#{t("layout.categories.list")}", @categories_path - %li= link_to t("layout.categories.platforms"), platforms_categories_path - %li.active= link_to "#{t("layout.categories.new")}", @new_category_path - .content - %h2.title= t("layout.categories.new_header") - .inner= render "form" diff --git a/app/views/categories/platforms.html.haml b/app/views/categories/platforms.html.haml deleted file mode 100644 index a93767620..000000000 --- a/app/views/categories/platforms.html.haml +++ /dev/null @@ -1,31 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.categories.list"), categories_path - %li.active= link_to t("layout.categories.platforms"), platforms_categories_path - .content - %h2.title= t("layout.platforms.list_header") - %br - .inner - %h3.title= t("layout.platforms.list_header_main") - %table.table - - @main_platforms.each do |platform| - %tr{:class => cycle("odd", "even")} - %td= link_to platform.name, platform_categories_path(platform) - %td.last= @main_platforms_count[platform.id].to_i - %br - .inner - %h3.title= t("layout.platforms.list_header_personal") - %table.table - - @personal_platforms.each do |platform| - %tr{:class => cycle("odd", "even")} - %td= link_to platform.name, platform_categories_path(platform) - %td.last= @personal_platforms_count[platform.id].to_i - %br - .inner - %h3.title= t("layout.platforms.list_header_all") - %table.table - - @all_platforms.each do |platform| - %tr{:class => cycle("odd", "even")} - %td= link_to platform.name, platform_categories_path(platform) - %td.last= @all_platforms_count[platform.id].to_i diff --git a/app/views/categories/show.html.haml b/app/views/categories/show.html.haml deleted file mode 100644 index 0ee654296..000000000 --- a/app/views/categories/show.html.haml +++ /dev/null @@ -1,15 +0,0 @@ -.block - .secondary-navigation - %ul.wat-cf - %li.first= link_to t("layout.categories.list"), categories_path - %li= link_to t("layout.categories.platforms"), platforms_categories_path - - if @platform - %li.active= link_to @platform.name, platform_categories_path(@platform) - .content - %h2.title - = @category.name - (#{@category.parent.name}) - .inner - %table.table= render @projects - .actions-bar.wat-cf - .actions= will_paginate @projects diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index 5642020ee..4a4ffa06f 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -21,10 +21,7 @@ - else = hidden_field_tag :who_owns, :me .both --#- if [:new, :create].include? act --# .leftlist= f.label :category_id, t("activerecord.attributes.project.category_id"), :class => :label --# .rightlist= f.grouped_collection_select :category_id, Category.roots, :children, :name, :id, :name, :include_blank => true --# .both + .leftlist= f.label :visibility, t("activerecord.attributes.project.visibility"), :class => :label .rightlist =# f.select :visibility, Project::VISIBILITIES diff --git a/config/locales/en.yml b/config/locales/en.yml index 3b4bc3759..e2b649312 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -93,16 +93,6 @@ en: regenerate_btn: Regenerate warning_message: Warning - Old data set as invalid when new data obtaining - categories: - list: List - new: Create - edit: Edit - platforms: By platform - list_header: Catalogue - new_header: New category - edit_header: Edit category - confirm_delete: Are you sure to delete this category? - collaborators: back_to_proj: Back to project edit: Edit list @@ -166,11 +156,6 @@ en: successfully_added: Member %s successfully added error_in_adding: Member %s adding error - category: - saved: Category saved - save_error: Category saves error - destroyed: Category deleted - blob: successfully_updated: File '%{name}' successfully updated updating_error: Error updating file '%{name}' @@ -192,7 +177,6 @@ en: can_have_less_or_equal: You cannot have more than %{count} projects. models: - category: Category arch: Arch container: Container rpm: RPM @@ -216,10 +200,6 @@ en: login: Login password: Password - category: - parent_id: Parent - name: Name - arch: name: Name created_at: Created diff --git a/config/locales/menu.en.yml b/config/locales/menu.en.yml index f9aeb6885..458463829 100644 --- a/config/locales/menu.en.yml +++ b/config/locales/menu.en.yml @@ -3,7 +3,6 @@ en: repositories: Repositories personal_repository: My repository products: Products - categories: Catalogue downloads: Statistics top_menu: platforms: Platforms diff --git a/config/locales/menu.ru.yml b/config/locales/menu.ru.yml index 858689f6c..a7d0682d8 100644 --- a/config/locales/menu.ru.yml +++ b/config/locales/menu.ru.yml @@ -1,6 +1,5 @@ ru: menu: - categories: Каталог products: Продукты repositories: Репозитории personal_repository: Мой репозиторий diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index ebfe1c0e0..e79e66abd 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -60,7 +60,6 @@ en: project: Project attributes: project: - category_id: Category name: Name description: Descripton owner: Owner diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index 194a8a0b3..acda92170 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -60,7 +60,6 @@ ru: project: Проект attributes: project: - category_id: Категория name: Название description: Описание owner: Владелец diff --git a/config/locales/ru.yml b/config/locales/ru.yml index a8c9d7614..ca0c366c3 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -93,16 +93,6 @@ ru: regenerate_btn: Перегенерировать warning_message: Примечание - При получении новых данных старые становятся недействительными - categories: - list: Список - new: Создать - edit: Редактировать - platforms: По платформам - list_header: Каталог - new_header: Новая категория - edit_header: Редактировать категорию - confirm_delete: Вы уверены, что хотите удалить эту категорию? - collaborators: back_to_proj: Вернуться к проекту edit: Редактировать список @@ -166,11 +156,6 @@ ru: successfully_added: Участник %s успешно добавлен error_in_adding: Ошибка при добавлении участника %s - category: - saved: Категория успешно сохранена - save_error: Не удалось сохранить категорию - destroyed: Категория успешно удалена - blob: successfully_updated: Файл '%{name}' успешно обновлен updating_error: Ошибка обновления файла '%{name}' @@ -192,7 +177,6 @@ ru: can_have_less_or_equal: Нельзя иметь больше, чем %{count} проектов. models: - category: Категория arch: Arch container: Container rpm: RPM @@ -217,10 +201,6 @@ ru: login: Логин password: Пароль - category: - parent_id: Родитель - name: Название - arch: name: Название created_at: Создана diff --git a/config/routes.rb b/config/routes.rb index 20dc90673..ea4f010fe 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -44,10 +44,6 @@ Rosa::Application.routes.draw do match 'statistics/refresh' => 'downloads#refresh', :as => :downloads_refresh match 'statistics/test_sudo' => 'downloads#test_sudo', :as => :test_sudo_downloads - resources :categories do - get :platforms, :on => :collection - end - match '/private/:platform_name/*file_path' => 'privates#show' match 'build_lists/publish_build', :to => "build_lists#publish_build" @@ -101,8 +97,6 @@ Rosa::Application.routes.draw do end resources :repositories - - resources :categories, :only => [:index, :show] end resources :projects, :except => [:show] do @@ -198,8 +192,6 @@ Rosa::Application.routes.draw do resources :search, :only => [:index] - match '/catalogs', :to => 'categories#platforms', :as => :catalogs - match 'product_status', :to => 'product_build_lists#status_build' # Tree diff --git a/db/migrate/20120329182602_delete_categories.rb b/db/migrate/20120329182602_delete_categories.rb new file mode 100644 index 000000000..7b2c9b985 --- /dev/null +++ b/db/migrate/20120329182602_delete_categories.rb @@ -0,0 +1,17 @@ +class DeleteCategories < ActiveRecord::Migration + def self.up + remove_column :projects, :category_id + drop_table :categories + end + + def self.down + create_table :categories, :force => true do |t| + t.string "name" + t.string "ancestry" + t.integer "projects_count", :default => 0, :null => false + t.datetime "created_at" + t.datetime "updated_at" + end + add_column :projects, :category_id, :integer + end +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 5596d9be6..d1166777e 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 => 20120329181830) do +ActiveRecord::Schema.define(:version => 20120329182602) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false @@ -81,14 +81,6 @@ ActiveRecord::Schema.define(:version => 20120329181830) do 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 "categories", :force => true do |t| - t.string "name" - t.string "ancestry" - t.integer "projects_count", :default => 0, :null => false - t.datetime "created_at" - t.datetime "updated_at" - end - create_table "comments", :force => true do |t| t.string "commentable_type" t.integer "user_id" @@ -273,7 +265,6 @@ ActiveRecord::Schema.define(:version => 20120329181830) do t.integer "owner_id" t.string "owner_type" t.string "visibility", :default => "open" - t.integer "category_id" t.text "description" t.string "ancestry" t.boolean "has_issues", :default => true @@ -286,7 +277,6 @@ ActiveRecord::Schema.define(:version => 20120329181830) do 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| diff --git a/db/seeds.rb b/db/seeds.rb index 8e6b2314d..bb47f49f9 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -3,137 +3,3 @@ ARCHES = %w(i386 i586 x86_64) ARCHES.each do |arch| Arch.find_or_create_by_name arch end - -CATEGORIES = { - :mandriva => - %(Accessibility -Archiving/Backup -Archiving/Cd burning -Archiving/Compression -Archiving/Other -Books/Computer books -Books/Faqs -Books/Howtos -Books/Literature -Books/Other -Communications -Databases -Development/C -Development/C++ -Development/Databases -Development/GNOME and GTK+ -Development/Java -Development/KDE and Qt -Development/Kernel -Development/Other -Development/Perl -Development/PHP -Development/Python -Development/Ruby -Development/X11 -Editors -Education -Emulators -File tools -Games/Adventure -Games/Arcade -Games/Boards -Games/Cards -Games/Other -Games/Puzzles -Games/Sports -Games/Strategy -Graphical desktop/Enlightenment -Graphical desktop/FVWM based -Graphical desktop/GNOME -Graphical desktop/Icewm -Graphical desktop/KDE -Graphical desktop/Other -Graphical desktop/Sawfish -Graphical desktop/WindowMaker -Graphical desktop/Xfce -Graphics -Monitoring -Networking/Chat -Networking/File transfer -Networking/Instant messaging -Networking/IRC -Networking/Mail -Networking/News -Networking/Other -Networking/Remote access -Networking/WWW -Office -Publishing -Sciences/Astronomy -Sciences/Biology -Sciences/Chemistry -Sciences/Computer science -Sciences/Geosciences -Sciences/Mathematics -Sciences/Other -Sciences/Physics -Shells -Sound -System/Base -System/Cluster -System/Configuration/Boot and Init -System/Configuration/Hardware -System/Configuration/Networking -System/Configuration/Other -System/Configuration/Packaging -System/Configuration/Printing -System/Fonts/Console -System/Fonts/True type -System/Fonts/Type1 -System/Fonts/X11 bitmap -System/Internationalization -System/Kernel and hardware -System/Libraries -System/Printing -System/Servers -System/X11 -Terminals -Text tools -Toys -Video), - :naulinux => -%(Amusements/Games -Amusements/Graphics -Applications/Archiving -Applications/Communications -Applications/Databases -Applications/Editors -Applications/Emulators -Applications/Engineering -Applications/File -Applications/Internet -Applications/Multimedia -Applications/Productivity -Applications/Publishing -Applications/System -Applications/Text -Development/Debuggers -Development/Languages -Development/Libraries -Development/System -Development/Tools -Documentation -System Environment/Base -System Environment/Daemons -System Environment/Kernel -System Environment/Libraries -System Environment/Shells -User Interface/Desktops -User Interface/X -User Interface/X Hardware Support) -} - -CATEGORIES.each do |platform_type, categories| - parent = Category.roots.find_or_create_by_name(platform_type) - categories.split("\n").each do |category| - Category.find_or_create_by_name(category) do |c| - c.parent = parent - end - end -end From 39c5da244507c621966b05a0262f571a0d0b311b Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 23:07:38 +0400 Subject: [PATCH 4/6] [Refs #263] Remove EasyUrpmi support --- app/controllers/platforms_controller.rb | 18 +----------------- config/routes.rb | 1 - spec/controllers/platforms_controller_spec.rb | 4 ---- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/app/controllers/platforms_controller.rb b/app/controllers/platforms_controller.rb index 4d89f37b9..743759fd0 100644 --- a/app/controllers/platforms_controller.rb +++ b/app/controllers/platforms_controller.rb @@ -1,6 +1,6 @@ # -*- encoding : utf-8 -*- class PlatformsController < ApplicationController - before_filter :authenticate_user!, :except => :easy_urpmi + before_filter :authenticate_user! before_filter :find_platform, :only => [:clone, :edit, :destroy, :members] before_filter :get_paths, :only => [:new, :create, :clone] @@ -17,22 +17,6 @@ class PlatformsController < ApplicationController @platforms = @platforms.accessible_by(current_ability, :related).paginate(:page => params[:page], :per_page => 20) end - def easy_urpmi - @platforms = Platform.where(:distrib_type => APP_CONFIG['distr_types'].first, :visibility => 'open', :platform_type => 'main') - respond_to do |format| - format.json do - render :json => { - :platforms => @platforms.map do |p| - {:name => p.name, - :architectures => ['i586', 'x86_64'], - :repositories => p.repositories.map(&:name), - :url => p.public_downloads_url(request.host_with_port)} - end - } - end - end - end - def show @platform = Platform.find params[:id], :include => :repositories #@repositories = @platform.repositories diff --git a/config/routes.rb b/config/routes.rb index ea4f010fe..1adfae20d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -84,7 +84,6 @@ Rosa::Application.routes.draw do end collection do - get :easy_urpmi get :autocomplete_user_uname end diff --git a/spec/controllers/platforms_controller_spec.rb b/spec/controllers/platforms_controller_spec.rb index 2514fe136..7d5361ffd 100644 --- a/spec/controllers/platforms_controller_spec.rb +++ b/spec/controllers/platforms_controller_spec.rb @@ -49,10 +49,6 @@ describe PlatformsController do end context 'for guest' do - it "should not be able to perform easy_urpmi action" do - get :easy_urpmi - response.should redirect_to(forbidden_path) - end [:index, :create].each do |action| it "should not be able to perform #{ action } action" do From 34011513b5ddbc2d5fd1ad54260ce124d3b049ea Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Thu, 29 Mar 2012 23:19:00 +0400 Subject: [PATCH 5/6] [Refs #263] Remove old xml-rpc API --- app/controllers/rpc_controller.rb | 41 ------------------------------- app/models/event_log.rb | 2 +- bin/xml-client-demo.rb | 38 ---------------------------- config/routes.rb | 2 -- 4 files changed, 1 insertion(+), 82 deletions(-) delete mode 100644 app/controllers/rpc_controller.rb delete mode 100755 bin/xml-client-demo.rb diff --git a/app/controllers/rpc_controller.rb b/app/controllers/rpc_controller.rb deleted file mode 100644 index e9e5ba78a..000000000 --- a/app/controllers/rpc_controller.rb +++ /dev/null @@ -1,41 +0,0 @@ -# -*- encoding : utf-8 -*- -class RpcController < ApplicationController - exposes_xmlrpc_methods - - before_filter :authenticate_user! - before_filter lambda { EventLog.current_controller = self }, :only => :xe_index # should be after auth callback - - ## Usage example: - # - # require 'xmlrpc/client' - # client = XMLRPC::Client.new("127.0.0.1", '/api/xmlrpc', 3000, nil, nil, 'user@email', 'password', false, 900) - # client.call("project_versions", 1) - - def platforms - ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.platforms_list') - Platform.select('name').where("platform_type = ?", 'main').map(&:name) - end - - def user_projects - ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.users_list') - current_user.projects.map{|p| { :id => p.id, :name => p.name } } - end - - def project_versions id - p = Project.find_by_id(id) - ActiveSupport::Notifications.instrument "event_log.observer", :object => p, :message => I18n.t('event_log.notices.versions_list') - p.tags.map(&:name) rescue 'not found' - end - - def build_status id - bl = BuildList.find_by_id(id) - ActiveSupport::Notifications.instrument "event_log.observer", :object => bl, :message => I18n.t('event_log.notices.status') - bl.try(:status) || 'not found' - end - - def build_packet project_id, repo_id - # p = Project.find_by_id(project_id); r = Repository.find_by_id(repo_id) - ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.project_build') - 'unknown' # TODO: build packet - end -end diff --git a/app/models/event_log.rb b/app/models/event_log.rb index ba1e2343e..ca3607a82 100644 --- a/app/models/event_log.rb +++ b/app/models/event_log.rb @@ -21,7 +21,7 @@ class EventLog < ActiveRecord::Base el.ip = current_controller.request.remote_ip el.controller = current_controller.class.to_s el.action = current_controller.action_name - el.protocol = (el.controller == 'RpcController' ? 'api' : 'web') + el.protocol = 'web' end end diff --git a/bin/xml-client-demo.rb b/bin/xml-client-demo.rb deleted file mode 100755 index af73ea16c..000000000 --- a/bin/xml-client-demo.rb +++ /dev/null @@ -1,38 +0,0 @@ -# -*- encoding : utf-8 -*- -#!/usr/bin/env ruby - -require 'rubygems' -require 'xmlrpc/client' -require 'pp' - -# Please correctly fill following vars -@host = 'npp-build.rosalab.ru' -@port = 80 -@user = 'pchipiga@ya.ru' -@password = '123456' - -puts 'PLATFORMS' -client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -pp client.call("platforms") - -puts 'USER PROJECTS' -client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -pp client.call("user_projects") - -puts 'PROJECT VERSIONS' -client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -project_id = 1 # FIXME! -pp client.call("project_versions", project_id) - -puts 'BUILD STATUS' -client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -build_list_id = 1 # FIXME -pp client.call("build_status", build_list_id) - -puts 'BUILD PACKET' -client = XMLRPC::Client.new(@host, '/api/xmlrpc', @port, nil, nil, @user, @password, false, 900) -project_id = 1 # FIXME -repo_id = 1 # FIXME -pp client.call("build_packet", project_id, repo_id) - -puts 'DONE' diff --git a/config/routes.rb b/config/routes.rb index 1adfae20d..efb8bb716 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,5 @@ # -*- encoding : utf-8 -*- Rosa::Application.routes.draw do - # XML RPC - match 'api/xmlrpc' => 'rpc#xe_index' devise_scope :user do get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru' From 4dd97d8c63cc9bffd25619d6cb768d64bc7c87f3 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Fri, 30 Mar 2012 00:24:45 +0400 Subject: [PATCH 6/6] [Refs #263] Remove xml-rpc gem, clear CanCan abilities and tests --- Gemfile | 1 - Gemfile.lock | 2 -- app/models/ability.rb | 6 ------ spec/models/category_spec.rb | 6 ------ 4 files changed, 15 deletions(-) delete mode 100644 spec/models/category_spec.rb diff --git a/Gemfile b/Gemfile index 80937b2ae..ba7830ecc 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,6 @@ gem 'paperclip', '~> 2.7.0' gem 'delayed_job_active_record', '~> 0.3.2' gem 'russian', '~> 0.6.0' gem 'highline', '~> 1.6.11' -gem 'rails-xmlrpc', '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git' gem 'jbuilder' diff --git a/Gemfile.lock b/Gemfile.lock index a27ac23f0..825ee840e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -217,7 +217,6 @@ GEM activesupport (= 3.2.2) bundler (~> 1.0) railties (= 3.2.2) - rails-xmlrpc (0.3.6) rails3-generators (0.17.4) railties (>= 3.0.0) rails3-jquery-autocomplete (1.0.6) @@ -350,7 +349,6 @@ DEPENDENCIES paperclip (~> 2.7.0) pg (~> 0.13.2) rails (= 3.2.2) - rails-xmlrpc (~> 0.3.6) rails3-generators rails3-jquery-autocomplete (~> 1.0.6) rdiscount diff --git a/app/models/ability.rb b/app/models/ability.rb index 0a2c410e4..16d41fe9c 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -55,10 +55,6 @@ class Ability can(:destroy, Project) {|project| owner? project} can :remove_user, Project - # TODO: Turn on AAA when it will be updated - #can :create, AutoBuildList - #can [:index, :destroy], AutoBuildList, :project_id => user.own_project_ids - can :search, BuildList can [:read, :owned], BuildList, :user_id => user.id can :read, BuildList, :project => {:visibility => 'open'} @@ -93,8 +89,6 @@ class Ability can(:create, ProductBuildList) {|pbl| can?(:update, pbl.product)} can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)} - can [:read, :platforms], Category - can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id} can [:read, :create], PrivateUser, :platform => {:owner_type => 'Group', :owner_id => user.group_ids} diff --git a/spec/models/category_spec.rb b/spec/models/category_spec.rb deleted file mode 100644 index bc525ba4d..000000000 --- a/spec/models/category_spec.rb +++ /dev/null @@ -1,6 +0,0 @@ -# -*- encoding : utf-8 -*- -require 'spec_helper' - -describe Category do - pending "add some examples to (or delete) #{__FILE__}" -end