From 1f088c0cfc7e99c797cecc034eb40f293b646855 Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Tue, 15 May 2012 14:00:57 +0400 Subject: [PATCH 1/4] [refs #461] Rename is_rpm to is_package --- app/models/ability.rb | 2 +- app/models/project.rb | 2 +- app/views/projects/base/_submenu.html.haml | 2 +- app/views/projects/projects/_form.html.haml | 4 +-- ...rename_is_rpm_to_is_package_in_projects.rb | 9 +++++++ db/schema.rb | 27 +++++++++---------- 6 files changed, 27 insertions(+), 19 deletions(-) create mode 100644 db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb diff --git a/app/models/ability.rb b/app/models/ability.rb index d1fe8928d..8b78a377f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -64,7 +64,7 @@ class Ability can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id} can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids} can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project} - can(:create, BuildList) {|build_list| build_list.project.is_rpm && can?(:write, build_list.project)} + can(:create, BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)} can(:publish, BuildList) do |build_list| build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project) end diff --git a/app/models/project.rb b/app/models/project.rb index 3b34263c0..2f4a2ed58 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -26,7 +26,7 @@ class Project < ActiveRecord::Base 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') - attr_accessible :name, :description, :visibility, :srpm, :is_rpm, :default_branch, :has_issues, :has_wiki + attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki attr_readonly :name scope :recent, order("name ASC") diff --git a/app/views/projects/base/_submenu.html.haml b/app/views/projects/base/_submenu.html.haml index 0f7e536b3..c4bb613fd 100644 --- a/app/views/projects/base/_submenu.html.haml +++ b/app/views/projects/base/_submenu.html.haml @@ -7,7 +7,7 @@ %ul %li= link_to t("project_menu.project"), project_path(@project), :class => (act.in?([:show, :edit]) && contr.in?([:trees, :blobs]) ? 'active' : nil) %li= link_to t("project_menu.commits"), commits_path(@project), :class => (act.in?([:index, :show]) && contr == :commits ? 'active' : nil) - - if @project.is_rpm and can?(:read, @project => BuildList) + - if @project.is_package and can?(:read, @project => BuildList) %li= link_to t("project_menu.builds"), project_build_lists_path(@project), :class => (contr == :build_lists ? 'active' : nil) - if @project.has_issues %li= link_to t("project_menu.tracker"), project_issues_path(@project), :class => (contr == :issues ? 'active' : nil) diff --git a/app/views/projects/projects/_form.html.haml b/app/views/projects/projects/_form.html.haml index 6dd8795ed..ffede9552 100644 --- a/app/views/projects/projects/_form.html.haml +++ b/app/views/projects/projects/_form.html.haml @@ -42,8 +42,8 @@ \  .rightlist .check - %span#niceCheckbox1.niceCheck-main= f.check_box :is_rpm#, :class => 'niceCheckbox1' - .forcheck= t("activerecord.attributes.project.is_rpm") + %span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1' + .forcheck= t("activerecord.attributes.project.is_package") .both .both - if [:new, :create].include? act diff --git a/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb new file mode 100644 index 000000000..7aa8f827d --- /dev/null +++ b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb @@ -0,0 +1,9 @@ +class RenameIsRpmToIsPackageInProjects < ActiveRecord::Migration + def up + rename_column :projects, :is_rpm, :is_package + end + + def down + rename_column :projects, :is_package, :is_rpm + end +end diff --git a/db/schema.rb b/db/schema.rb index 5e397546f..8a9b0397d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,14 +11,14 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20120505101650) do +ActiveRecord::Schema.define(:version => 20120515095324) do create_table "activity_feeds", :force => true do |t| t.integer "user_id", :null => false t.string "kind" t.text "data" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at" + t.datetime "updated_at" end create_table "advisories", :force => true do |t| @@ -205,7 +205,7 @@ ActiveRecord::Schema.define(:version => 20120505101650) do t.string "owner_type" t.string "visibility", :default => "open", :null => false t.string "platform_type", :default => "main", :null => false - t.string "distrib_type", :null => false + t.string "distrib_type" end add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false @@ -276,27 +276,25 @@ ActiveRecord::Schema.define(:version => 20120505101650) do t.text "description" t.string "ancestry" t.boolean "has_issues", :default => true + t.boolean "has_wiki", :default => false t.string "srpm_file_name" t.string "srpm_content_type" t.integer "srpm_file_size" t.datetime "srpm_updated_at" - t.boolean "has_wiki", :default => false t.string "default_branch", :default => "master" - t.boolean "is_rpm", :default => true + t.boolean "is_package", :default => true t.integer "average_build_time", :default => 0, :null => false t.integer "build_count", :default => 0, :null => false end - add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :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" - t.datetime "updated_at" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "interest" t.text "more" end @@ -350,6 +348,7 @@ ActiveRecord::Schema.define(:version => 20120505101650) do t.string "name" t.string "email", :default => "", :null => false t.string "encrypted_password", :limit => 128, :default => "", :null => false + t.string "password_salt", :default => "", :null => false t.string "reset_password_token" t.datetime "remember_created_at" t.datetime "created_at" @@ -357,8 +356,11 @@ ActiveRecord::Schema.define(:version => 20120505101650) do t.string "uname" t.string "role" t.string "language", :default => "en" - t.datetime "reset_password_sent_at" + 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" t.string "site" t.string "company" @@ -370,9 +372,6 @@ ActiveRecord::Schema.define(:version => 20120505101650) 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" t.string "authentication_token" t.integer "build_priority", :default => 50 end From 79a9b3d107530c9195fa32288406e6d55b78d71a Mon Sep 17 00:00:00 2001 From: "konstantin.grabar" Date: Wed, 16 May 2012 14:31:20 +0400 Subject: [PATCH 2/4] [refs #461] Fix is_package locale. Fix schema.rb and rename migration --- config/locales/models/project.en.yml | 2 +- config/locales/models/project.ru.yml | 2 +- .../20120515095324_rename_is_rpm_to_is_package_in_projects.rb | 2 ++ db/schema.rb | 4 ++-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index 8b5e67b95..f13c3d99f 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -87,4 +87,4 @@ en: me: Myself group: Group default_branch: Default branch - is_rpm: Project is a packet + is_package: Project is a packet diff --git a/config/locales/models/project.ru.yml b/config/locales/models/project.ru.yml index c97f6c03c..9b4d5b235 100644 --- a/config/locales/models/project.ru.yml +++ b/config/locales/models/project.ru.yml @@ -87,4 +87,4 @@ ru: me: Я group: Группа default_branch: Ветка по умолчанию - is_rpm: Проект является пакетом + is_package: Проект является пакетом diff --git a/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb index 7aa8f827d..1d56f3d15 100644 --- a/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb +++ b/db/migrate/20120515095324_rename_is_rpm_to_is_package_in_projects.rb @@ -1,9 +1,11 @@ class RenameIsRpmToIsPackageInProjects < ActiveRecord::Migration def up rename_column :projects, :is_rpm, :is_package + change_column :projects, :is_package, :boolean, :default => true, :null => false end def down rename_column :projects, :is_package, :is_rpm + change_column :projects, :is_package, :boolean, :default => true end end diff --git a/db/schema.rb b/db/schema.rb index 8a9b0397d..5d16920a6 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -205,7 +205,7 @@ ActiveRecord::Schema.define(:version => 20120515095324) do t.string "owner_type" t.string "visibility", :default => "open", :null => false t.string "platform_type", :default => "main", :null => false - t.string "distrib_type" + t.string "distrib_type", :null => false end add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false @@ -282,7 +282,7 @@ ActiveRecord::Schema.define(:version => 20120515095324) do t.integer "srpm_file_size" t.datetime "srpm_updated_at" t.string "default_branch", :default => "master" - t.boolean "is_package", :default => true + t.boolean "is_package", :default => true, :null => false t.integer "average_build_time", :default => 0, :null => false t.integer "build_count", :default => 0, :null => false end From a804f3ef2c705b7cff6496ce579ab8ea6c73434b Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Fri, 18 May 2012 00:40:30 +0400 Subject: [PATCH 3/4] [refs #461] Correct translation for is_package option --- config/locales/models/project.en.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/locales/models/project.en.yml b/config/locales/models/project.en.yml index 9b1a5e8bc..ae36f87f0 100644 --- a/config/locales/models/project.en.yml +++ b/config/locales/models/project.en.yml @@ -87,7 +87,7 @@ en: me: Myself group: Group default_branch: Default branch - is_package: Project is a packet + is_package: Project is a package errors: project: uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_) From aceb9e61fcbe6c66f72467579ff623848b573833 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Fri, 18 May 2012 01:07:04 +0400 Subject: [PATCH 4/4] Rename is_rpm to is_package in ability.rb --- app/models/ability.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index 0a11e7b7f..8f9550cdd 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -64,7 +64,7 @@ class Ability can [:read, :related], BuildList, :project => {:owner_type => 'User', :owner_id => user.id} can [:read, :related], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids} can(:read, BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project} - can([:create, :update], BuildList) {|build_list| build_list.project.is_rpm && can?(:write, build_list.project)} + can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)} can(:publish, BuildList) do |build_list| build_list.can_publish? and build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)