[issue #64] Merge branch 'master' into 64-project_wiki

Conflicts:
	Gemfile.lock
	db/schema.rb
This commit is contained in:
George Vinogradov 2012-02-01 22:39:04 +04:00
commit d0717c8f9e
12 changed files with 388 additions and 40 deletions

18
Gemfile
View File

@ -5,13 +5,13 @@ gem 'shotgun'
gem 'pg', '~> 0.11.0'
gem 'silent-postgres', '~> 0.1.1'
gem 'schema_plus', '~> 0.2.1'
gem 'redhillonrails_core', '~> 1.2.0' # deprecated
# gem 'schema_plus', '~> 0.2.1' # buggy shit!
gem 'devise', '~> 1.5.2'
gem 'omniauth', '~> 1.0.1'
gem 'omniauth-openid', '~> 1.0.1'
gem 'cancan', '~> 1.6.7'
#gem 'bitmask_attributes'
gem "haml-rails", '~> 0.3.4'
# gem "compass", '~> 0.11.5' # update when it will be needed
@ -25,7 +25,6 @@ gem "will_paginate", "~> 3.0.2"
gem 'meta-tags', '~> 1.2.4', :require => 'meta_tags'
gem "russian"
# gem 'ghoul_grack', '~> 0.0.1'
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
#gem "grit", :git => 'git://github.com/gvino/grit.git', :branch => 'master'
gem "grit", :git => 'git://github.com/mojombo/grit.git', :branch => 'master'
@ -44,18 +43,17 @@ gem 'RedCloth'
gem 'wikicloth'
# XML-RPC support
# gem 'actionwebservice' #, :git => 'git://github.com/ywen/actionwebservice.git'
gem "rails-xmlrpc", '~> 0.3.6' # :git => 'git://github.com/chipiga/rails-xmlrpc.git'
# gem 'passenger', '~> 3.0.11'
gem 'unicorn', '~> 4.1.1'
group :production do
gem "airbrake", '~> 3.0.5'
gem 'newrelic_rpm'
gem 'bluepill', :require => false
end
gem 'newrelic_rpm'
group :development do
# gem 'letter_opener'
gem 'rails3-generators'
@ -63,20 +61,12 @@ group :development do
gem 'hpricot'
gem 'ruby_parser'
# debug
# gem 'ruby-debug19', :require => 'ruby-debug', :platforms => :mri_19
# gem 'looksee'
# gem 'awesome_print'
# gem 'wirble'
gem 'hirb'
# gem 'rails-footnotes', '>= 3.7.5.rc4' # this shit is very buggy don't forget to switch it off back
# deploy
gem 'capistrano', :require => false
gem 'capistrano-ext', :require => false
gem 'cape', :require => false
# gem 'capistrano-exts', :require => false #, :git => 'git://github.com/chipiga/capistrano-exts.git'
# gem 'capistrano-recipes', :require => false
gem 'capistrano_colors', :require => false
end

View File

@ -61,7 +61,7 @@ GEM
state_machine (~> 1.1.0)
builder (2.1.2)
cancan (1.6.7)
cape (1.1.0)
cape (1.2.0)
capistrano (2.9.0)
highline
net-scp (>= 1.0.0)
@ -71,7 +71,7 @@ GEM
capistrano-ext (1.2.1)
capistrano (>= 1.0.0)
capistrano_colors (0.5.5)
chronic (0.6.6)
chronic (0.6.7)
cocaine (0.2.1)
creole (0.4.2)
daemons (1.1.6)
@ -181,6 +181,8 @@ GEM
rdoc (3.12)
json (~> 1.4)
redcarpet (1.17.2)
redhillonrails_core (1.2.0)
activerecord (>= 2)
rr (1.0.4)
rspec (2.7.0)
rspec-core (~> 2.7.0)
@ -202,9 +204,6 @@ GEM
i18n (>= 0.5.0)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
schema_plus (0.2.1)
rails
valuable
sexp_processor (3.0.10)
shotgun (0.9)
rack (>= 1.0)
@ -223,7 +222,6 @@ GEM
kgio (~> 2.4)
rack
raindrops (~> 0.6)
valuable (0.9.2)
warden (1.1.0)
rack (>= 1.0)
web-app-theme (0.7.0)
@ -233,7 +231,7 @@ GEM
wikicloth (0.7.1)
builder
expression_parser
will_paginate (3.0.2)
will_paginate (3.0.3)
yui-compressor (0.9.5)
PLATFORMS
@ -273,11 +271,11 @@ DEPENDENCIES
rails3-jquery-autocomplete
rdiscount
redcarpet (= 1.17.2)
redhillonrails_core (~> 1.2.0)
rr
rspec-rails (~> 2.7.0)
ruby_parser
russian
schema_plus (~> 0.2.1)
shotgun
silent-postgres (~> 0.1.1)
unicorn (~> 4.1.1)

View File

@ -14,20 +14,29 @@ class BuildListsController < ApplicationController
load_and_authorize_resource :except => CALLBACK_ACTIONS.concat(NESTED_ACTIONS)
def index
filter_params = params[:filter] || {}
if @project
@action_url = project_build_lists_path(@project)
if request.post?
new_params = {:filter => {}}
params[:filter].each do |k,v|
new_params[:filter][k] = v unless v.empty?
end
redirect_to build_lists_path(new_params)
else
@action_url = build_lists_path
end
filter_params = params[:filter] || {}
if @project
@action_url = project_build_lists_path(@project)
else
@action_url = build_lists_path
end
@filter = BuildList::Filter.new(@project, filter_params)
@build_lists = @filter.find.accessible_by(current_ability).recent.paginate :page => params[:page]
@filter = BuildList::Filter.new(@project, filter_params)
@build_lists = @filter.find.accessible_by(current_ability).recent.paginate :page => params[:page]
@build_server_status = begin
BuildServer.get_status
rescue Exception # Timeout::Error
{}
@build_server_status = begin
BuildServer.get_status
rescue Exception # Timeout::Error
{}
end
end
end

View File

@ -68,7 +68,7 @@ class BuildList::Filter
def build_date_from_params(field_name, params)
if params["#{field_name}(1i)"].present? || params["#{field_name}(2i)"].present? || params["#{field_name}(3i)"].present?
Date.civil((params["#{field_name}(1i)"].presence || Date.today.year).to_i,
(params["#{field_name}(2i)"].presence || Date.today.mohth).to_i,
(params["#{field_name}(2i)"].presence || Date.today.month).to_i,
(params["#{field_name}(3i)"].presence || Date.today.day).to_i)
else
nil

View File

@ -10,7 +10,7 @@ class Product < ActiveRecord::Base
has_attached_file :tar
validates_attachment_content_type :tar, :content_type => ["application/gnutar", "application/x-compressed", "application/x-gzip", "application/x-bzip2", "application/x-tar"], :message => I18n.t('layout.invalid_content_type')
validates_attachment_content_type :tar, :content_type => ["application/gnutar", "application/x-compressed", "application/x-gzip", "application/x-bzip", "application/x-bzip2", "application/x-tar"], :message => I18n.t('layout.invalid_content_type')
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
scope :recent, order("name ASC")

View File

@ -1,8 +1,10 @@
# -*- encoding : utf-8 -*-
class ProjectImport < ActiveRecord::Base
belongs_to :project
belongs_to :platform
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true
validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}
validates :name, :platform_id, :version, :presence => true
scope :by_name, lambda {|name| where('project_imports.name ILIKE ?', name)}

View File

@ -1,6 +1,6 @@
%h2.title= t("layout.build_lists.filter_header")
= form_for :filter, :url => @action_url, :html => { :method => :get, :class => :form } do |f|
= form_for :filter, :url => @action_url, :html => { :method => :post, :class => :form } do |f|
.columns.wat-cf
.column.left
.group

View File

@ -8,7 +8,7 @@ production:
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.19
mdv: 192.168.122.144
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc

View File

@ -42,6 +42,8 @@ Rosa::Application.routes.draw do
end
end
post 'build_lists' => 'build_lists#index', :as => 'build_lists'
resources :auto_build_lists, :only => [:index, :create, :destroy]
resources :personal_repositories, :only => [:show] do

View File

@ -0,0 +1,13 @@
class AddPlatformReferenceToProjectImports < ActiveRecord::Migration
def self.up
add_column :project_imports, :platform_id, :integer
remove_index :project_imports, :name
add_index :project_imports, [:name, :platform_id], :unique => true, :case_sensitive => false
end
def self.down
remove_index :project_imports, [:name, :platform_id]
add_index :project_imports, :name, :unique => true, :case_sensitive => false
remove_column :project_imports, :platform_id
end
end

333
db/schema.rb Normal file
View File

@ -0,0 +1,333 @@
# 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.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20120131124517) do
create_table "arches", :force => true do |t|
t.string "name", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
create_table "authentications", :force => true do |t|
t.integer "user_id"
t.string "provider"
t.string "uid"
t.datetime "created_at"
t.datetime "updated_at"
end
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"
t.integer "status"
t.integer "build_list_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "version"
end
add_index "build_list_items", ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
create_table "build_lists", :force => true do |t|
t.integer "bs_id"
t.string "container_path"
t.integer "status"
t.string "project_version"
t.integer "project_id"
t.integer "arch_id"
t.datetime "notified_at"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "is_circle", :default => false
t.text "additional_repos"
t.string "name"
t.boolean "build_requires", :default => false
t.string "update_type"
t.integer "bpl_id"
t.integer "pl_id"
t.text "include_repos"
t.integer "user_id"
t.boolean "auto_publish", :default => true
t.string "package_version"
t.string "commit_hash"
end
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
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_id"
t.string "commentable_type"
t.integer "user_id"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "containers", :force => true do |t|
t.string "name", :null => false
t.integer "project_id", :null => false
t.integer "owner_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "delayed_jobs", :force => true do |t|
t.integer "priority", :default => 0
t.integer "attempts", :default => 0
t.text "handler"
t.text "last_error"
t.datetime "run_at"
t.datetime "locked_at"
t.datetime "failed_at"
t.string "locked_by"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
create_table "downloads", :force => true do |t|
t.string "name", :null => false
t.string "version"
t.string "distro"
t.string "platform"
t.integer "counter", :default => 0
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "event_logs", :force => true do |t|
t.integer "user_id"
t.string "user_name"
t.integer "object_id"
t.string "object_type"
t.string "object_name"
t.string "ip"
t.string "kind"
t.string "protocol"
t.string "controller"
t.string "action"
t.text "message"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "groups", :force => true do |t|
t.string "name"
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "uname"
end
create_table "issues", :force => true do |t|
t.integer "serial_id"
t.integer "project_id"
t.integer "user_id"
t.string "title"
t.text "body"
t.string "status", :default => "open"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
create_table "platforms", :force => true do |t|
t.string "description"
t.string "name"
t.integer "parent_platform_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "released", :default => false
t.integer "owner_id"
t.string "owner_type"
t.string "visibility", :default => "open"
t.string "platform_type", :default => "main"
t.string "distrib_type"
end
create_table "private_users", :force => true do |t|
t.integer "platform_id"
t.string "login"
t.string "password"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "user_id"
end
create_table "product_build_lists", :force => true do |t|
t.integer "product_id"
t.integer "status", :default => 2, :null => false
t.datetime "notified_at"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
create_table "products", :force => true do |t|
t.string "name", :null => false
t.integer "platform_id", :null => false
t.integer "build_status", :default => 2, :null => false
t.string "build_path"
t.datetime "created_at"
t.datetime "updated_at"
t.text "build_script"
t.text "counter"
t.text "ks"
t.text "menu"
t.string "tar_file_name"
t.string "tar_content_type"
t.integer "tar_file_size"
t.datetime "tar_updated_at"
t.boolean "is_template", :default => false
t.boolean "system_wide", :default => false
t.text "cron_tab"
t.boolean "use_cron", :default => false
end
create_table "project_imports", :force => true do |t|
t.integer "project_id"
t.string "name"
t.string "version"
t.datetime "file_mtime"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "platform_id"
end
add_index "project_imports", ["platform_id", "name"], :name => "index_project_imports_on_name_and_platform_id", :unique => true, :case_sensitive => false
create_table "project_to_repositories", :force => true do |t|
t.integer "project_id"
t.integer "repository_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "projects", :force => true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
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
t.string "srpm_file_name"
t.string "srpm_content_type"
t.integer "srpm_file_size"
t.datetime "srpm_updated_at"
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 "relations", :force => true do |t|
t.integer "object_id"
t.string "object_type"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at"
t.datetime "updated_at"
t.string "role"
end
create_table "repositories", :force => true do |t|
t.string "description", :null => false
t.integer "platform_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "name", :null => false
t.integer "owner_id"
t.string "owner_type"
end
create_table "rpms", :force => true do |t|
t.string "name", :null => false
t.integer "arch_id", :null => false
t.integer "project_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id"
create_table "settings_notifiers", :force => true do |t|
t.integer "user_id", :null => false
t.boolean "can_notify", :default => true
t.boolean "new_comment", :default => true
t.boolean "new_comment_reply", :default => true
t.boolean "new_issue", :default => true
t.boolean "issue_assign", :default => true
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "subscribes", :force => true do |t|
t.integer "subscribeable_id"
t.string "subscribeable_type"
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
end
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 "reset_password_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"
end
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
end

View File

@ -47,7 +47,7 @@ namespace :import do
source = "rsync://mirror.yandex.ru/mandriva/#{release}/SRPMS/#{repository}/"
destination = ENV['DESTINATION'] || File.join(APP_CONFIG['root_path'], 'mirror.yandex.ru', 'mandriva', release, 'SRPMS', repository)
say "START rsync projects (*.src.rpm) from '#{source}' to '#{destination}'"
if system "rsync -rtv --delete #{source} #{destination}" # TODO --include='*.src.rpm' --exclude='*'
if system "rsync -rtv --delete --exclude='backports/*' --exclude='testing/*' #{source} #{destination}" # --include='*.src.rpm'
say 'Rsync ok!'
else
say 'Rsync failed!'
@ -69,7 +69,7 @@ namespace :import do
say "=== Processing '#{srpm_file}'..."
if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? and
version = `rpm -q --qf '[%{Version}]' -p #{srpm_file}` and $?.success? and version.present?
project_import = ProjectImport.find_by_name(name) || ProjectImport.by_name(name).first || ProjectImport.new(:name => name)
project_import = ProjectImport.find_by_name_and_platform_id(name, platform.id) || ProjectImport.by_name(name).where(:platform_id => platform.id).first || ProjectImport.new(:name => name, :platform_id => platform.id)
if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime
unless project = project_import.project
if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup
@ -89,6 +89,7 @@ namespace :import do
say "New version (#{version}) for '#{project.owner.uname}/#{project.name}' successfully imported to branch '#{branch}'!"
project_import.project = project
# project_import.platform = platform
project_import.version = version
project_import.file_mtime = File.mtime(srpm_file)
project_import.save!