Skip to content

Commit

Permalink
[api] set some default descriptions for the attribute type definitions.
Browse files Browse the repository at this point in the history
Please, someone, review content and my language of them. Much appriciated!
  • Loading branch information
adrianschroeter committed Jun 4, 2014
1 parent d658467 commit 960a7a8
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 1 deletion.
39 changes: 39 additions & 0 deletions src/api/db/attribute_descriptions.rb
@@ -0,0 +1,39 @@

def update_all_attrib_type_descriptions
ans = AttribNamespace.find_by_name "OBS"

d = {
"VeryImportantProject" => "Marks this project as top project for the project list in web interface",
"UpdateProject" => "Marks this project as frozen, updates are handled via another project defined
in the value",
"RejectRequests" => "Request against this object get refused. The first optional value will be
given as reason to the user. When adding more values you can limit this rejection to the given action types
like \"submit\" or \"delete\"",
"ApprovedRequestSource" => "Avoid becoming a reviewer, when creating submit requests from a source where no maintainer role is owned by request creator",
"Maintained" => "Marks this as maintained package or project. Packages will be found automatically when
using the OBS maintenance features like \"osc mbranch\"",
"MaintenanceProject" => "Marks the main maintenance project which is used to coordinate all official
updates by the maintenance team",
"MaintenanceIdTemplate" => "Released maintenance updates get an ID on first release. This attribute can
be used to modify the default scheme",
# "ScreenShots" => "", # to be dropped?
"OwnerRootProject" => "Justifies the behaviour of package owner ship. DisableDevel will disable the lookup in devel projects. BugownerOnly will limit the result to bugowners and will ignore maintainer roles.",
"RequestCloned" => "A marker inside of a project to reference a clone request. The request will get
superseded when a new submit request from this project gets created.",
"ProjectStatusPackageFailComment" => "Can be used to store reasons to be shown on failing packages of a project status page in webui.",
"InitializeDevelPackage" => "The request source will become a devel package, when creating a new package by submit request",
"BranchTarget" => "Branches do by default always point to the package origin even when branched from another project and the source got found via project links. This attribute in a project linking to others will
enforce to become the package link target.",
"BranchRepositoriesFromProject" => "Use repository definitions from another specified project when creating a branch",
"AutoCleanup" => "The object will recieve a delete request at specified time in the value",
"Issues" => "To reference issues without touching the source",
"QualityCategory" => "To classify the usability of a project. The end user search will take care and priorize according to this attribute.",
}

for k in d.keys do
at = ans.attrib_types.where(name: k).first
at.description = d[k]
at.save
end
end

@@ -0,0 +1,8 @@

require_relative '../attribute_descriptions'

class SetAttribTypeDescriptions < ActiveRecord::Migration
def self.up
update_all_attrib_type_descriptions
end
end
5 changes: 4 additions & 1 deletion src/api/db/seeds.rb
@@ -1,3 +1,5 @@
require_relative 'attribute_descriptions'

puts "Seeding architectures table..."
# NOTE: armvXel is actually obsolete (because it never exist as official platform), but kept for compatibility reasons
%w(aarch64 armv4l armv5l armv6l armv7l armv5el armv6el armv7el armv8el hppa i586 i686 ia64 local m68k mips mips32 mips64 ppc ppc64 ppc64p7 ppc64le s390 s390x sparc sparc64 sparc64v sparcv8 sparcv9 sparcv9v x86_64).each do |arch_name|
Expand Down Expand Up @@ -59,7 +61,7 @@
ans.attrib_namespace_modifiable_bies.first_or_create(user_id: admin.id)

puts "Seeding attrib_types table..."
at = ans.attrib_types.where(name: "VeryImportantProject").first_or_create(value_count: 0)
at = ans.attrib_types.where(name: "VeryImportantProject").first_or_create(value_count: 1)
at.attrib_type_modifiable_bies.where(user_id: admin.id).first_or_create
at = ans.attrib_types.where(name: "UpdateProject").first_or_create(value_count: 1)
at.attrib_type_modifiable_bies.where(user_id: admin.id).first_or_create
Expand Down Expand Up @@ -106,6 +108,7 @@
at.allowed_values << AttribAllowedValue.new( value: "Development" )
at.allowed_values << AttribAllowedValue.new( value: "Private" )

update_all_attrib_type_descriptions

puts "Seeding db_project_type table by loading test fixtures"
DbProjectType.where(name: "standard").first_or_create
Expand Down
2 changes: 2 additions & 0 deletions src/api/db/structure.sql
Expand Up @@ -1451,6 +1451,8 @@ INSERT INTO schema_migrations (version) VALUES ('20140219185200');

INSERT INTO schema_migrations (version) VALUES ('20140516182719');

INSERT INTO schema_migrations (version) VALUES ('20140604101042');

INSERT INTO schema_migrations (version) VALUES ('20141302101042');

INSERT INTO schema_migrations (version) VALUES ('21');
Expand Down

0 comments on commit 960a7a8

Please sign in to comment.