Upgrade to ruby 1.9.3 and fix bugs. Fix bug with commit_hash save during project build. Move some russian text to yml. Code cleanup. Fix templates, deploy and import scripts. Fix specs. Translate event_logs. Refs #95

This commit is contained in:
Pavel Chipiga 2012-01-30 22:36:58 +02:00
parent 5126aa796c
commit 33dce21312
19 changed files with 95 additions and 51 deletions

2
.gitignore vendored
View File

@ -1,5 +1,4 @@
.bundle
.rvmrc
.DS_Store
db/*.sqlite3
log/*.log
@ -12,6 +11,5 @@ public/assets/*
config/initializers/local.rb
public/system/*
public/downloads/*
.rvmrc
*.swp
*.tmproj

2
.rvmrc Normal file
View File

@ -0,0 +1,2 @@
rvm_gemset_create_on_use_flag=1
rvm 1.9.3@rosa-build

View File

@ -52,7 +52,7 @@ group :development do
gem 'ruby_parser'
# debug
gem 'ruby-debug'
# gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
# gem 'looksee'
# gem 'awesome_print'
# gem 'wirble'

View File

@ -60,7 +60,6 @@ GEM
capistrano_colors (0.5.5)
chronic (0.6.6)
cocaine (0.2.1)
columnize (0.3.5)
daemons (1.1.4)
delayed_job (2.1.4)
activesupport (~> 3.0)
@ -95,8 +94,6 @@ GEM
yui-compressor (>= 0.9.3)
json (1.6.3)
kgio (2.6.0)
linecache (0.46)
rbx-require-relative (> 0.0.4)
mail (2.2.19)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
@ -157,7 +154,6 @@ GEM
thor (~> 0.14.4)
raindrops (0.8.0)
rake (0.9.2.2)
rbx-require-relative (0.0.5)
rdoc (3.11)
json (~> 1.4)
rr (1.0.4)
@ -174,11 +170,6 @@ GEM
activesupport (~> 3.0)
railties (~> 3.0)
rspec (~> 2.7.0)
ruby-debug (0.10.4)
columnize (>= 0.1)
ruby-debug-base (~> 0.10.4.0)
ruby-debug-base (0.10.4)
linecache (>= 0.3)
ruby-openid (2.1.8)
ruby_parser (2.3.1)
sexp_processor (~> 3.0)
@ -244,7 +235,6 @@ DEPENDENCIES
rails3-jquery-autocomplete
rr
rspec-rails (~> 2.7.0)
ruby-debug
ruby_parser
russian
schema_plus (~> 0.2.1)

View File

@ -39,7 +39,7 @@ class BuildListsController < ApplicationController
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => params[:bpls]).each do |bpl|
@build_list = @project.build_lists.build(params[:build_list])
@build_list.commit_hash = @project.git_repository.commits(@build_list.project_version.match(/(.+)_latest$/).to_a.last || @build_list.project_version).first.id
@build_list.commit_hash = @project.git_repository.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last || @build_list.project_version).first.id
@build_list.bpl = bpl; @build_list.arch = arch; @build_list.user = current_user
flash_options = {:project_version => @build_list.project_version, :arch => arch.name, :bpl => bpl.name, :pl => @build_list.pl}
if @build_list.save

View File

@ -13,7 +13,7 @@ class PrivateUsersController < ApplicationController
@pair = PrivateUser.generate_pair(params[:platform_id], current_user.id)
@urpmi_list = @platform.urpmi_list(request.host, @pair)
redirect_to platform_private_users_path(params[:platform_id]), :notice => "Логин: #{@pair[:login]} Пароль: #{@pair[:pass]}"
redirect_to platform_private_users_path(params[:platform_id]), :notice => I18n.t('flash.private_users', :login => @pair[:login], :password => @pair[:pass])
end
#def destroy

View File

@ -11,30 +11,30 @@ class RpcController < ApplicationController
# client.call("project_versions", 1)
def platforms
ActiveSupport::Notifications.instrument("event_log.observer", :message => 'список платформ')
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 => 'список пользовательских проектов')
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 => "список версий")
p.project_versions.collect {|tag| tag.name.gsub(/^\w+\./, "")} rescue 'not found'
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 => 'статус сборки')
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 => 'сборка пакета')
ActiveSupport::Notifications.instrument "event_log.observer", :message => I18n.t('event_log.notices.project_build')
'unknown' # TODO: build packet
end
end

View File

@ -49,7 +49,7 @@ class Project < ActiveRecord::Base
:pl => auto_build_list.pl,
:bpl => auto_build_list.bpl,
:arch => auto_build_list.arch,
:project_version => collected_project_versions.last,
: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
@ -70,16 +70,6 @@ class Project < ActiveRecord::Base
end
end
# TODO deprecate and remove project_versions and collected_project_versions ?
def project_versions
res = tags.select{|tag| tag.name =~ /^v\./}
return res if res and res.size > 0
tags
end
def collected_project_versions
project_versions.collect{|tag| tag.name.gsub(/^\w+\./, "")}
end
def tags
self.git_repository.tags #.sort_by{|t| t.name.gsub(/[a-zA-Z.]+/, '').to_i}
end

View File

@ -14,7 +14,9 @@
.content
.inner
.patch_and_diff
#{link_to "raw diff", commit_path(@project, @commit.id, :diff)} | #{link_to "patch", commit_path(@project, @commit.id, :patch)}
= link_to "raw diff", commit_path(@project, @commit.id, :diff)
\|
= link_to "patch", commit_path(@project, @commit.id, :patch)
.clear
= render_commit_stats(@commit.stats)

View File

@ -4,7 +4,8 @@
%th.last &nbsp;
- @projects.each do |project|
%tr{:class => cycle("odd", "even")}
%td
= link_to project.name, project_path(project)
%td= link_to project.name, project_path(project)
%td.last
#{link_to t("layout.show"), project_path(project)} | #{link_to t("layout.delete"), url_for (:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete")}
= link_to t("layout.show"), project_path(project)
\|
= link_to t("layout.delete"), url_for(:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete")

View File

@ -7,4 +7,6 @@
%td
= link_to project.name, project_path(project)
%td.last
#{link_to t("layout.show"), project_path(project)} | #{link_to t("layout.delete"), url_for (:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete")}
= link_to t("layout.show"), project_path(project)
\|
= link_to t("layout.delete"), url_for(:action => :remove_project, :project_id => project.id), :confirm => t("layout.projects.confirm_delete")

View File

@ -27,9 +27,9 @@ set :scm, :git
set :repository, "git@github.com:warpc/rosa-build.git"
set :deploy_via, :remote_cache
require 'lib/recipes/nginx'
require 'lib/recipes/unicorn'
require 'lib/recipes/bluepill'
require './lib/recipes/nginx'
require './lib/recipes/unicorn'
require './lib/recipes/bluepill'
namespace :deploy do
task :stub_xml_rpc do

View File

@ -373,6 +373,7 @@ en:
saved: Settings saved success
save_error: Setting update error
private_users: "Login: %{login} Password: %{password}"
subscribe:
saved: Subscription on notifications for this task is created

View File

@ -0,0 +1,50 @@
en:
event_log:
controllers:
products_controller: 'Product Management'
platforms_controller: 'Management of platforms'
repositories_controller: 'Manage Repositories'
projects_controller: 'Project Management'
build_lists_controller: 'Management index chart'
auto_build_lists_controller: 'Control automatic build'
product_build_lists_controller: 'Build management products'
'devise/registrations_controller': 'User Registration'
'devise/sessions_controller': 'User Authentication'
'devise/passwords_controller': 'password recovery'
'users/omniauth_callbacks_controller': 'External authentication of users'
rpc_controller: 'XML RPC'
private_users_controller: 'access to private repositories'
personal_repositories_controller: 'Managing personal repositories'
actions:
'devise/sessions_controller':
create: 'input'
destroy: 'exit'
'users/omniauth_callbacks_controller':
open_id: 'login via OpenID'
projects_controller:
auto_build: 'sent to the automatic assembly'
build_lists_controller:
create: 'sent to assembly'
cancel: 'assembly abolished'
publish: 'assembly issued'
auto_build_lists_controller:
create: 'assigned'
destroy: 'canceled'
product_build_lists_controller:
create: 'sent to assembly'
rpc_controller:
xe_index: inquiry
private_users_controller:
create: 'given'
destroy: 'deleted'
personal_repositories_controller:
change_visibility: 'status change'
create: 'created'
update: 'updated'
destroy: 'deleted'
notices:
platforms_list: a list of platforms
users_list: list of custom projects
versions_list: version list
status: the status of the assembly
project_build: build package

View File

@ -42,3 +42,9 @@ ru:
create: 'создано'
update: 'обновлено'
destroy: 'удалено'
notices:
platforms_list: список платформ
users_list: список пользовательских проектов
versions_list: список версий
status: статус сборки
project_build: сборка пакета

View File

@ -372,7 +372,8 @@ ru:
settings:
saved: Настройки успешно сохранены
save_error: При обновлении настроек произошла ошибка
private_users: "Логин: %{login} Пароль: %{password}"
subscribe:
saved: Вы подписаны на оповещения для этой задачи

View File

@ -1,3 +1,4 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
@ -241,10 +242,10 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
t.text "description"
t.string "ancestry"
t.boolean "has_issues", :default => true
t.string "srpm_content_type"
t.datetime "srpm_updated_at"
t.integer "srpm_file_size"
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
t.index ["category_id"], :name => "index_projects_on_category_id"
t.index ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
end
@ -300,18 +301,17 @@ ActiveRecord::Schema.define(:version => 20120127234602) do
create_table "users", :force => true do |t|
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 "email", :default => "", :null => false
t.string "encrypted_password", :limit => 128, :default => "", :null => false
t.string "reset_password_token"
t.string "remember_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at"
t.datetime "updated_at"
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.string "language", :default => "en"
t.index ["email"], :name => "index_users_on_email", :unique => true
t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
t.index ["uname"], :name => "index_users_on_uname", :unique => true

View File

@ -1,5 +1,6 @@
require 'highline/import'
require 'open-uri'
require 'iconv'
namespace :import do
desc "Load projects"

View File

@ -40,7 +40,7 @@ describe BuildListsController do
end
it 'should save correct commit_hash for branch based build' do
post :create, {:project_id => @project.id}.merge(@create_params).deep_merge(:build_list => {:project_version => "master_latest"})
post :create, {:project_id => @project.id}.merge(@create_params).deep_merge(:build_list => {:project_version => "latest_master"})
@project.build_lists.last.commit_hash.should == @project.git_repository.commits('master').last.id
end
@ -70,7 +70,7 @@ describe BuildListsController do
platform = Factory(:platform_with_repos)
@create_params = {
:build_list => {
:project_version => 'master_latest',
:project_version => 'latest_master',
:pl_id => platform.id,
:update_type => 'security',
:include_repos => [platform.repositories.first.id]