From e7f9d8251a664349c70a12dba20a4ddc953a0421 Mon Sep 17 00:00:00 2001 From: Pavel Chipiga Date: Fri, 11 Nov 2011 21:11:27 +0200 Subject: [PATCH] Rename product field build to build_script. Change links. Refs #2161 --- app/controllers/products_controller.rb | 2 +- app/models/product.rb | 2 +- app/models/product_build_list.rb | 4 +- app/views/platforms/show.html.haml | 4 +- app/views/product_build_lists/index.html.haml | 49 +++++++++++-------- app/views/products/_form.html.haml | 4 +- config/environments/development.rb | 1 + config/locales/ru.yml | 2 +- ...7_rename_products_build_to_build_script.rb | 9 ++++ db/schema.rb | 4 +- 10 files changed, 49 insertions(+), 32 deletions(-) create mode 100644 db/migrate/20111111184657_rename_products_build_to_build_script.rb diff --git a/app/controllers/products_controller.rb b/app/controllers/products_controller.rb index 0e8ffb3da..eb810378b 100644 --- a/app/controllers/products_controller.rb +++ b/app/controllers/products_controller.rb @@ -9,7 +9,7 @@ class ProductsController < ApplicationController @product.ks = DEFAULT_KS @product.menu = DEFAULT_MENU @product.counter = DEFAULT_COUNTER - @product.build = DEFAULT_BUILD + @product.build_script = DEFAULT_BUILD end # def clone diff --git a/app/models/product.rb b/app/models/product.rb index c066e7eab..eabd4fbb3 100644 --- a/app/models/product.rb +++ b/app/models/product.rb @@ -3,7 +3,7 @@ class Product < ActiveRecord::Base # BUILD_COMPLETED = 0 # BUILD_FAILED = 1 - ATTRS_TO_CLONE = [ 'build_path', 'build', 'build', 'counter', 'ks', 'menu', 'tar', 'use_cron', 'cron_tab' ] + ATTRS_TO_CLONE = [ 'build_path', 'build_script', 'counter', 'ks', 'menu', 'tar', 'use_cron', 'cron_tab' ] validates :name, :presence => true, :uniqueness => {:scope => :platform_id} # validates :build_status, :inclusion => { :in => [ NEVER_BUILT, BUILD_COMPLETED, BUILD_FAILED ] } diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index 77653210b..facbea1f7 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -19,14 +19,14 @@ class ProductBuildList < ActiveRecord::Base end def event_log_message - {:product => Product.find(product_id).name}.inspect # TODO WTF product.name == nil ??? + {:product => product.name}.inspect end protected def xml_rpc_create tar_url = "#{base_url}#{product.tar.url}" - result = ProductBuilder.create_product id, product.platform.unixname, product.ks, product.menu, product.build, product.counter, [], tar_url + result = ProductBuilder.create_product id, product.platform.unixname, product.ks, product.menu, product.build_script, product.counter, [], tar_url if result == ProductBuilder::SUCCESS return true else diff --git a/app/views/platforms/show.html.haml b/app/views/platforms/show.html.haml index de161ab03..924374a9f 100644 --- a/app/views/platforms/show.html.haml +++ b/app/views/platforms/show.html.haml @@ -104,9 +104,9 @@ - @platform.products.recent.each do |product| %tr{:class => cycle("odd", "even")} %td - = link_to product.name, edit_platform_product_path(@platform, product) + = link_to product.name, [@platform, product] %td.last - #{link_to t("layout.show"), platform_product_path(@platform, product)} | #{link_to t("layout.delete"), platform_product_path(@platform, product), :method => :delete, :confirm => t("layout.products.confirm_delete")} #{(product.can_clone? ? "| #{link_to t("layout.products.clone"), clone_platform_product_path(@platform, product)}" : "").html_safe } + #{link_to t("layout.edit"), edit_platform_product_path(@platform, product)} | #{link_to t("layout.delete"), platform_product_path(@platform, product), :method => :delete, :confirm => t("layout.products.confirm_delete")} #{(product.can_clone? ? "| #{link_to t("layout.products.clone"), clone_platform_product_path(@platform, product)}" : "").html_safe } .actions-bar.wat-cf .actions - content_for :sidebar, render(:partial => 'sidebar') diff --git a/app/views/product_build_lists/index.html.haml b/app/views/product_build_lists/index.html.haml index b641d0a7b..fb728d0bb 100644 --- a/app/views/product_build_lists/index.html.haml +++ b/app/views/product_build_lists/index.html.haml @@ -1,21 +1,28 @@ -%h1 Listing product_build_lists - -%table - %tr - %th Product - %th Status - %th - %th - %th - - - @product_build_lists.each do |product_build_list| - %tr - %td= product_build_list.product - %td= product_build_list.status - %td= link_to 'Show', product_build_list - %td= link_to 'Edit', edit_product_build_list_path(product_build_list) - %td= link_to 'Destroy', product_build_list, :confirm => 'Are you sure?', :method => :delete - -%br - -= link_to 'New Product build list', new_product_build_list_path +/ .block +/ - if controller.action_name != 'all' +/ .secondary-navigation +/ %ul.wat-cf +/ %li.first= link_to t("layout.build_lists.current"), project_path(@project) + "#build_lists" +/ %li.active= link_to t("layout.build_lists.all"), project_build_lists_path(@project) +/ +/ .content +/ - if controller.action_name == 'all' +/ .inner +/ %h2= t('layout.build_lists.build_server_status.header') +/ .field +/ %span= t('layout.build_lists.build_server_status.client_count') + ":" +/ %span= @build_server_status['client_count'] +/ .field +/ %span= t('layout.build_lists.build_server_status.count_new_task') + ":" +/ %span= @build_server_status['count_new_task'] +/ .field +/ %span= t('layout.build_lists.build_server_status.count_build_task') + ":" +/ %span= @build_server_status['count_build_task'] +/ +/ .inner +/ = render :partial => "build_lists/filter", :action_url => @action_url +/ +/ .inner +/ = render :partial => "build_lists/build_lists", :object => @build_lists +/ +/ - content_for :sidebar, render(:partial => 'sidebar') if controller.action_name != 'all' \ No newline at end of file diff --git a/app/views/products/_form.html.haml b/app/views/products/_form.html.haml index a34544c6d..f28207da2 100644 --- a/app/views/products/_form.html.haml +++ b/app/views/products/_form.html.haml @@ -2,8 +2,8 @@ = f.label :name, t("activerecord.attributes.product.name"), :class => :label = f.text_field :name, :class => 'text_field' .group - = f.label :build, t("activerecord.attributes.product.build"), :class => :label - = f.text_area :build, :class => 'text_field', :cols => 80 + = f.label :build_script, t("activerecord.attributes.product.build_script"), :class => :label + = f.text_area :build_script, :class => 'text_field', :cols => 80 .group = f.label :counter, t("activerecord.attributes.product.counter"), :class => :label = f.text_area :counter, :class => 'text_field', :cols => 80 diff --git a/config/environments/development.rb b/config/environments/development.rb index 91d549b3c..96203c79f 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -31,6 +31,7 @@ require 'xmlrpc/client' module XMLRPC class Client def call(*args) + # raise args.inspect case when args.first == 'get_status' {:client_count => '1', :count_new_task => '2', :count_build_task => 3} diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 82f89a095..ceea58eea 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -449,7 +449,7 @@ ru: updated_at: Обновлен ks: Содержимое .ks.template counter: Содержимое .counter - build: Содержимое build + build_script: Содержимое build menu: Содержимое .menu.xml tar: Tar.bz2 файл is_template: Шаблон diff --git a/db/migrate/20111111184657_rename_products_build_to_build_script.rb b/db/migrate/20111111184657_rename_products_build_to_build_script.rb new file mode 100644 index 000000000..911c7efdc --- /dev/null +++ b/db/migrate/20111111184657_rename_products_build_to_build_script.rb @@ -0,0 +1,9 @@ +class RenameProductsBuildToBuildScript < ActiveRecord::Migration + def self.up + rename_column :products, :build, :build_script + end + + def self.down + rename_column :products, :build_script, :build + end +end diff --git a/db/schema.rb b/db/schema.rb index 35f905cf6..fba91a0d8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20111107211538) do +ActiveRecord::Schema.define(:version => 20111111184657) do create_table "arches", :force => true do |t| t.string "name", :null => false @@ -188,7 +188,7 @@ ActiveRecord::Schema.define(:version => 20111107211538) do t.string "build_path" t.datetime "created_at" t.datetime "updated_at" - t.text "build" + t.text "build_script" t.text "counter" t.text "ks" t.text "menu"