Merge branch 'master' into #604-Remove_old_buildlist_created_more_than_3_month_ago

Conflicts:
	app/models/project.rb
	db/schema.rb
This commit is contained in:
Vladimir Sharshov 2012-08-07 00:53:43 +04:00
commit f35d4cd873
43 changed files with 659 additions and 100 deletions

BIN
app/assets/images/check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -1173,6 +1173,144 @@ table.tablesorter tr td.no_results {
}
/* end */
article div.all {
width: 860px;
}
div.inner-columns {
width: 100%;
height: auto;
display: block;
}
div.inner-columns:after {
clear: both;
content: ".";
display: block;
height: 0;
visibility: hidden;
}
div.inner-columns.equal section {
width: 430px;
float: left;
}
section.first div {
width: 415px;
}
form.inline_errors span.error {
display: inline-block;
color: #FF5050;
}
div.form-actions {
text-align: right;
padding-bottom: 5px;
}
div.form-actions .button {
margin-right: 50px;
}
dl.form, div.form-actions {
margin: 15px 0;
}
dl.form > dt {
margin: 0 0 6px;
}
dl.form > dt label {
color: #333333;
font-size: 14px;
font-weight: bold;
position: relative;
}
dl.form > dd {
margin: 0;
padding: 0;
border: 0, none;
}
dl.form > dd > input[type="text"],
dl.form > dd > input[type="password"],
dl.form > dd > textarea {
width: 350px;
border: 1px solid #A0A0A0;
border-radius: 4px;
padding: 5px;
font-family: Tahoma, Geneva, Helvetica, sans-serif;
font-size: 12px;
}
dl.form > dd > input.error[type="text"],
dl.form > dd > input.error[type="password"],
dl.form > dd > textarea.error {
border-color: #FF8080;
}
dl.form > dd > input[type="text"],
dl.form > dd > input[type="password"] {
height: 16px;
}
dl.form > dd > textarea {
height: 110px;
}
ul.checklist {
font-size: 12px;
font-weight: bold;
margin: 20px 0;
padding: 0;
}
ul.checklist li {
background: image-url("check.png") no-repeat scroll 0 2px transparent;
list-style-type: none;
margin: 15px 0;
padding-left: 25px;
}
div.all.feedback_sended {
background: image-url("feedback.png") no-repeat scroll 49% 0 transparent;
height: 500px;
text-align: center;
}
article div.all.feedback_sended h1 {
font-size: 48px;
font-weight: normal;
margin: 165px 0 0;
padding: 0;
}
article div.all.feedback_sended h2 {
font-size: 18px;
font-weight: normal;
margin: 5px 0 0;
padding: 0;
}
article div.all.feedback_sended p.pages {
margin-top: 70px;
width: 280px;
}
article div.all.feedback_sended p.search {
margin-top: 80px;
width: 230px;
}
article div.all.feedback_sended p {
font-size: 14px;
margin: 0 auto;
padding: 0;
text-align: center;
}
hr.bootstrap {
border: 0;
border-top: 1px solid #eeeeee;

View File

@ -0,0 +1,22 @@
# -*- encoding : utf-8 -*-
class ContactsController < ApplicationController
def new
@form = Feedback.new(current_user)
end
def create
@form = Feedback.new(params[:feedback])
if @form.perform_send
flash[:notice] = I18n.t("flash.contact.success")
redirect_to sended_contact_path
else
flash[:error] = I18n.t("flash.contact.error")
render :new and return
end
end
def sended
end
end

View File

@ -24,4 +24,5 @@ class PagesController < ApplicationController
def tos
end
end

View File

@ -41,8 +41,14 @@ class Projects::BuildListsController < Projects::BaseController
def create
notices, errors = [], []
@platform = Platform.find params[:build_list][:save_to_platform_id]
@platform = Platform.includes(:repositories).find params[:build_list][:save_to_platform_id]
@repository = @project.repositories.where(:id => @platform.repository_ids).first
params[:build_list][:save_to_repository_id] = @repository.id
params[:build_list][:auto_publish] = false if @platform.released
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
@build_list = @project.build_lists.build(params[:build_list])

View File

@ -14,6 +14,8 @@ module ApplicationHelper
'right bigpadding'
when controller_name == 'platforms' && action_name == 'clone'
'right middlepadding'
when controller_name == 'contacts' && action_name == 'sended'
'all feedback_sended'
else
content_for?(:sidebar) ? 'right' : 'all'
end

View File

@ -0,0 +1,34 @@
class FeedbackMailer < ActionMailer::Base
FBM_CONFIG = APP_CONFIG['feedback']
default :to => FBM_CONFIG['email'],
:cc => FBM_CONFIG['cc'],
:bcc => FBM_CONFIG['bcc']
include Resque::Mailer # send email async
def feedback_form_send(form_data)
@data = Feedback.new(form_data)
from = "#{@data.name} <#{@data.email}>"
subj = prepare_subject(@data.subject)
mail :from => from, :subject => subj
end
protected
def prepare_subject(subject)
res = ''
res << affix(FBM_CONFIG['subject_prefixes'])
res << subject
res << affix(FBM_CONFIG['subject_postfixes'])
res = res.strip.gsub(/\s+/, ' ')
res
end
def affix(affixes)
' %s ' % Array(affixes).map{|e| "[#{e}]"}.join
end
end

View File

@ -3,6 +3,7 @@ class BuildList < ActiveRecord::Base
belongs_to :project
belongs_to :arch
belongs_to :save_to_platform, :class_name => 'Platform'
belongs_to :save_to_repository, :class_name => 'Repository'
belongs_to :build_for_platform, :class_name => 'Platform'
belongs_to :user
belongs_to :advisory
@ -13,7 +14,8 @@ class BuildList < ActiveRecord::Base
UPDATE_TYPES = %w[security bugfix enhancement recommended newpackage]
RELEASE_UPDATE_TYPES = %w[security bugfix]
validates :project_id, :project_version, :arch, :include_repos, :presence => true
validates :project_id, :project_version, :arch, :include_repos,
:build_for_platform_id, :save_to_platform_id, :save_to_repository_id, :presence => true
validates_numericality_of :priority, :greater_than_or_equal_to => 0
validates :update_type, :inclusion => UPDATE_TYPES,
:unless => Proc.new { |b| b.advisory.present? }
@ -22,6 +24,9 @@ class BuildList < ActiveRecord::Base
validate lambda {
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
}
validate lambda {
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.map(&:id)
}
LIVE_TIME = 4.week # for unpublished
MAX_LIVE_TIME = 3.month # for published

104
app/models/feedback.rb Normal file
View File

@ -0,0 +1,104 @@
# This class is based on
# https://github.com/rails/rails/blob/4da6e1cce2833474034fda0cbb67b2cc35e828da/activerecord/lib/active_record/validations.rb
class Feedback
include ActiveModel::Conversion
include ActiveModel::Validations
include ActiveModel::Serializers::JSON
include ActiveModel::MassAssignmentSecurity
extend ActiveModel::Naming
attr_accessor :name, :email, :subject, :message
attr_accessible :name, :email, :subject, :message
validates :name, :subject, :message, :presence => true
validates :email, :presence => true,
:format => { :with => /\A[^@]+@([^@\.]+\.)+[^@\.]+\z/,
:allow_blank => false }
def initialize(args = {}, options = {})
return args.dup if args.is_a? Feedback
if args.respond_to? :name and args.respond_to? :email
self.name, self.email = args.name, args.email
elsif args.respond_to? :each_pair
sanitize_for_mass_assignment(args, options[:as]).each_pair do |k, v|
send("#{k}=", v)
end
else
return false
end
end
# FIXME: Maybe rename to `save`?
def perform_send(options = {})
perform_validations(options) ? real_send : false
end
def perform_send!(options={})
perform_validations(options) ? real_send : raise(ActiveRecord::RecordInvalid.new(self))
end
def new_record?
true
end
def persisted?
false
end
def message_with_links
message.to_s.dup.auto_link
end
def attributes
%w{ name email subject message }.inject({}) do |h, e|
h.merge(e => send(e))
end
end
def to_s
str = %w{ name email subject message }.map do |e|
"#{e}: #{ send(e).inspect }"
end.join(', ')
return "#<#{self.class} #{str}>"
end
class << self
def create(attributes = nil, options = {}, &block)
do_create(attributes, options, false, &block)
end
def create!(attributes = nil, options = {}, &block)
do_create(attributes, options, true, &block)
end
protected
def do_create(attributes = nil, options = {}, bang = false, &block)
if attributes.is_a?(Array)
attributes.collect { |attr| do_create(attr, options, bang, &block) }
else
object = new(attributes, options)
yield(object) if block_given?
bang ? object.perform_send! : object.perform_send
object
end
end
end
protected
def real_send
FeedbackMailer.feedback_form_send(self).deliver
end
def perform_validations(options={})
perform_validation = options[:validate] != false
perform_validation ? valid?(options[:context]) : true
end
end
Feedback.include_root_in_json = false

View File

@ -180,7 +180,7 @@ class Platform < ActiveRecord::Base
arches.map(&:name).each do |arch|
begin
return if mass_build.reload.stop_build
p.build_for(self, user, arch, auto_publish, mass_build_id)
p.build_for(self, rep.id, user, arch, auto_publish, mass_build_id)
rescue RuntimeError, Exception
# p.async(:build_for, self, user, arch, auto_publish, mass_build_id) # TODO need this?
end

View File

@ -90,6 +90,7 @@ class Project < ActiveRecord::Base
# If project platform repository is main, only main will be connect
main_rep_id = platform.repositories.find_by_name('main').id
build_reps_ids = [main_rep_id, repository_id].compact.uniq
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
build_lists.create do |bl|
bl.save_to_platform = platform

View File

@ -0,0 +1,48 @@
- set_meta_tags :title => t('layout.contact.page_header')
%h1= t("layout.contact.header")
%p= t("layout.contact.subheader")
%hr.bootstrap
.inner-columns.equal
%section.first
%div
= form_for @form, :url => contact_path, :html => {:class => 'inline_errors'} do |f|
%dl.form
%dt= f.label :name, t("activerecord.attributes.user.name")
%dd
= f.text_field :name, :placeholder => t("layout.contact.placeholders.name"),
:class => @form.errors.messages[:name].present? ? 'error' : ''
%dl.form
%dt= f.label :email, t("activerecord.attributes.user.email")
%dd
= f.text_field :email, :placeholder => t("layout.contact.placeholders.email"),
:class => @form.errors.messages[:email].present? ? 'error' : ''
%dl.form
%dt= f.label :subject, t("layout.contact.subject")
%dd
= f.text_field :subject, :placeholder => t("layout.contact.placeholders.subject"),
:class => @form.errors.messages[:subject].present? ? 'error' : ''
%dl.form
%dt= f.label :message, t("layout.contact.message")
%dd
= f.text_area :message, :placeholder => t("layout.contact.placeholders.message"),
:class => @form.errors.messages[:message].present? ? 'error' : ''
.form-actions
= f.submit t("layout.contact.send_request"), :class => 'button'
%section.last
%div
%h3= t("layout.contact.info.header")
%ul.checklist
- t("layout.contact.info.items").try(:each) do |item|
%li= item
%hr.bootstrap
%p= t("layout.contact.questions_info")

View File

@ -0,0 +1,8 @@
%h1= t("layout.contact.thanks")
%h2= t("layout.contact.thanks_2")
%p.pages
= t("layout.contact.open_pages")
%p.search
= t("layout.contact.use_search")
.both

View File

@ -0,0 +1,7 @@
!!!
%html
%head
%meta{:content => "text/html; charset=utf-8", "http-equiv" => "Content-Type"}
%body
= simple_format @data.message_with_links

View File

@ -0,0 +1 @@
<%= @data.message.chomp %>

View File

@ -14,3 +14,6 @@
%li
= image_tag 'square.png'
= link_to t('bottom_menu.tos'), tos_url #t('bottom_menu.tos_url')
%li
= image_tag 'square.png'
= link_to t('bottom_menu.support'), contact_url

View File

@ -0,0 +1,6 @@
- if project.description.present?
.description
%h3= t("layout.projects.about_subheader")
%p
= project.description
-# link_to t('layout.read_more'), '#'

View File

@ -1,11 +1,6 @@
= render 'submenu'
= render 'repo_block', :project => @project
.description
%h3= t("layout.projects.about_subheader")
%p
= @project.description
= link_to t('layout.read_more'), '#'
= render 'about_block', :project => @project
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|

View File

@ -13,6 +13,6 @@
%li= link_to t("project_menu.tracker"), project_issues_path(@project), :class => (contr == :issues ? 'active' : nil)
- if @project.has_wiki
%li= link_to t("project_menu.wiki"), project_wiki_index_path(@project), :class => (contr == :wiki ? 'active' : nil)
%li= link_to t("project_menu.readme"), "#" #pending
%li=# link_to t("project_menu.readme"), "#" #pending
- if can? :update, @project
%li= link_to t("project_menu.settings"), edit_project_path(@project), :class => (act == :edit && contr == :projects ? 'active' : nil)

View File

@ -3,6 +3,6 @@
%td= build_list.human_status
%td= link_to build_list.project.name_with_owner, build_list.project
%td= build_list_version_link(build_list)
%td= link_to build_list.save_to_platform.name, build_list.save_to_platform
%td= link_to "#{build_list.save_to_platform.name}/#{build_list.save_to_repository.name}", [build_list.save_to_platform, build_list.save_to_repository]
%td= build_list.arch.name
%td= link_to build_list.user.try(:fullname), build_list.user

View File

@ -7,7 +7,7 @@
%th.lpadding16= t("activerecord.attributes.build_list.status")
%th.lpadding16= t("activerecord.attributes.build_list.project")
%th.lpadding16= t("activerecord.attributes.build_list.project_version")
%th.lpadding16= t("activerecord.attributes.build_list.save_to_platform")
%th.lpadding16= t("activerecord.attributes.build_list.save_to_repository")
%th.lpadding16= t("activerecord.attributes.build_list.arch")
%th.lpadding16= t("activerecord.attributes.build_list.user")
%tbody= render :partial => 'projects/build_lists/build_list', :collection => @build_lists

View File

@ -9,7 +9,9 @@
.leftlist= t("activerecord.attributes.build_list.container_path")
.rightlist
- if @build_list.status == BuildList::BUILD_PUBLISHED
= t("layout.build_lists.container_published")
= raw "%s %s" % [t("layout.build_lists.container_published"),
link_to("#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}",
[@build_list.save_to_platform, @build_list.save_to_repository])]
- elsif @build_list.container_path.present?
- container_url = "http://#{request.host_with_port}/downloads#{@build_list.container_path}"
= link_to container_url, container_url
@ -26,9 +28,9 @@
.rightlist
= link_to @build_list.build_for_platform.name, @build_list.build_for_platform
.both
.leftlist= t("activerecord.attributes.build_list.save_to_platform")
.leftlist= t("activerecord.attributes.build_list.save_to_repository")
.rightlist
= link_to @build_list.save_to_platform.name, @build_list.save_to_platform
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
.both
.leftlist= t("activerecord.attributes.build_list.include_repos")
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')

View File

@ -1,12 +1,8 @@
-set_meta_tags :title => "#{title_object @project} #{t('at') if @branch} #{@branch.try :name}"
= render 'submenu'
= render 'repo_block', :project => @project
= render 'about_block', :project => @project
.description
%h3= t("layout.projects.about_subheader")
%p
= @project.description
= link_to t('layout.read_more'), '#'
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|

View File

@ -1,11 +1,7 @@
-set_meta_tags :title => [title_object(@project), shortest_hash_id(@commit.id), @commit.message]
= render 'submenu'
= render 'about_block', :project => @project
.description
%h3= t("layout.projects.about_subheader")
%p
= @project.description
= link_to t('layout.read_more'), '#'
%h3= t("layout.projects.last_commit")
- GitPresenters::CommitAsMessagePresenter.present(@commit, :branch => @branch, :project => @project) do |presenter|

View File

@ -1,29 +1,64 @@
-set_meta_tags :title => title_object(@project)
= render 'submenu'
= render 'repo_block', :project => @project
= render 'about_block', :project => @project
.description
%h3= t("layout.projects.about_subheader")
%p
= @project.description
= link_to t('layout.read_more'), '#'
.both
#repo-wrapper
- if @project.parent_id.present? || @project.srpm.exists?
.both
#repo-wrapper
%h3= t("layout.projects.files_in_project")
.files
.l= render 'whereami'
.both
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1= t("layout.projects.filename")
%th.th2= t("layout.projects.age")
%th.th3= t("layout.projects.message")
%th.th4= t("layout.projects.author")
%tbody
%tr
%td.centered{:colspan => 4}
%h3= I18n.t("layout.git.repositories.empty")
- else
- if current_user
%h3= t("layout.projects.git_global_setup")
%p
%code
= "git config --global user.name #{current_user.fullname}"
%br/
= "git config --global user.email #{current_user.email}"
%br/
git config --global http.postBuffer 524288000
%h3= t("layout.projects.create_repository")
%p
%code
= "git clone #{git_repo_url(@project.git_repo_name)}"
%br/
= "cd #{@project.name}"
%br/
%br/
%p= t("layout.projects.move_files_to_folder")
%br/
%code
git add .
%br/
git commit -m 'description message'
%br/
git push -u origin master
%h3= t("layout.projects.existing_git_repo")
%p
%code
cd existing_git_repo
%br/
= "git remote add origin #{git_repo_url(@project.git_repo_name)}"
%br/
git push -u origin master
%table#myTable.tablesorter.project{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1= t("layout.projects.filename")
%th.th2= t("layout.projects.age")
%th.th3= t("layout.projects.message")
%th.th4= t("layout.projects.author")
%tbody
%tr
%td.centered{:colspan => 4}
%h3= I18n.t("layout.git.repositories.empty")

View File

@ -17,6 +17,7 @@ en:
contacts_url: http://www.rosalab.com/about/contacts
tos: Terms Of Service
tos_url: http://www.rosalab.com/about
support: Support
project_menu:
project: Project
commits: Commits

View File

@ -17,6 +17,7 @@ ru:
contacts_url: http://www.rosalab.ru/about/contacts
tos: Условия использования
tos_url: http://www.rosalab.ru/about
support: Служба поддержки
project_menu:
project: Проект
commits: Коммиты

View File

@ -19,6 +19,7 @@ en:
include_repos: Included repositories
created_at: Created on
save_to_platform: Platform
save_to_repository: Repository
build_for_platform: Build for platform
update_type: Update type
build_requires: Build with all the required packages
@ -125,5 +126,7 @@ en:
no_project_version_found: Project version '%{project_version}' not found
no_arch_or_platform_selected: At least one of architecture of platform must selected
wrong_platform: Only the primary platform can be selected for the main repository!
wrong_repository: Repository to save package to must belongs to platform.
cannot_write: You can't build project to this repository.
can_not_published: Build can only be published with status "Build complete"
frozen_platform: In case of a repository for package storage with frozen platform allowed only bugfix and security updates

View File

@ -19,6 +19,7 @@ ru:
include_repos: Подключаемые репозитории
created_at: Создан
save_to_platform: Платформа
save_to_repository: Репозиторий
build_for_platform: Собрано для платформы
update_type: Критичность обновления
build_requires: Пересборка с зависимостями
@ -124,5 +125,7 @@ ru:
no_project_version_found: Выбранная версия '%{project_version}' не найдена
no_arch_or_platform_selected: Выберите хотя бы одну архитектуру и платформу
wrong_platform: Для основного репозитория (main) может быть выбран только его же основная платформа!
wrong_repository: Репозиторий для сохранения должен принадлежать платформе.
cannot_write: Вы не можете собирать пакет в этот репозиторий.
can_not_published: Опубликовать сборку можно только со статусом "Собран"
frozen_platform: В случае выбора репозитория для сохранения пакетов из замороженнной платформы разрешены только bugfix и security обновления

View File

@ -0,0 +1,34 @@
en:
layout:
contact:
page_header: Contact us
header: Contact us
subheader: Were here to help with any questions or comments.
send_request: Send Request
thanks: Thanks for feedback!
thanks_2: Your request in progress.
open_pages: Please, continue your work
use_search: Try to find something cool?
placeholders:
name: Your name
email: user@example.com
subject: I want to say about ...
message: Problem description
subject: Subject
message: Message
questions_info: If you need help with a project hosted on ABF, please contact the project's owner.
info:
header: What's in a great support request?
items:
- "Be succinct, we'll ask if we need more info"
- "The name of the user, repository, build list etc youre having troubles with"
flash:
contact:
success: Request successfully sended
error: Sending request failed

View File

@ -0,0 +1,34 @@
ru:
layout:
contact:
page_header: Обратная связь
header: Свяжитесь с нами
subheader: Мы готовы помочь вам с любыми вопросами и комментариями.
send_request: Отправить запрос
thanks: Спасибо за сообщение!
thanks_2: Мы уже начали работу.
open_pages: Продолжайте работу с системой
use_search: Воспользуйтесь поиском
placeholders:
name: Ваше имя
email: user@example.com
subject: Я хочу сказать о...
message: Описание проблемы
subject: Тема сообщения
message: Сообщение
questions_info: Если вам нужна помощь с проектом, размещенным на ABF, пожалуйста, свяжитесь с владельцем проекта.
info:
header: Каким должен быть хороший запрос?
items:
- "Будьте кратки. Если нам понадобится дополнительная информация, мы ее запросим."
- "Укажите, с чем у вас возникла проблема: имя пользователя, репозиторий, сборочный лист и т.д."
flash:
contact:
success: Запрос успешно отправлен
error: Не удалось отправить запрос

View File

@ -34,6 +34,10 @@ en:
has_issue_description: Tracker adds a lightweight issue management system tightly integrated with your repository.
has_wiki_description: Wikis are the simplest way to allow other users to contribute content. Any user can create and edit pages for documentation, examples, support or anything you wish.
human_average_build_time: Expected time is %{hours} h. %{minutes} min.
git_global_setup: Git global setup
create_repository: Create Repository
move_files_to_folder: Move files you need to the project or create them.
existing_git_repo: Git repo already exist?
git_help:
cloning: Cloning the repository

View File

@ -34,6 +34,10 @@ ru:
has_issue_description: Трэкер предоставляет лекговесный менеджер для задач по разработке Вашего проекта.
has_wiki_description: Wiki - это самый простой способ предоставить другим вносить свой вклад в развитие Вашего проекта. Каждый пользователь нашего сервиса может использовать Wiki для документирования, примеров, поддержки или всего другого, в чем у Вас появится необходимость.
human_average_build_time: 'Ожидаемое время: %{hours} ч. %{minutes} мин.'
git_global_setup: Общие настройки Git
create_repository: Создание репозитория
move_files_to_folder: Переместите нужные файлы в проект или создайте их.
existing_git_repo: Git репозиторий уже существует?
diff_show_header: "%{files} с %{additions} и %{deletions}."
about_subheader: "О проекте"

View File

@ -1,5 +1,10 @@
# -*- encoding : utf-8 -*-
Rosa::Application.routes.draw do
resource :contact, :only => [:new, :create, :sended] do
get '/' => 'contacts#new'
get :sended
end
devise_scope :users do
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
end
@ -7,9 +12,9 @@ Rosa::Application.routes.draw do
resources :search, :only => [:index]
get '/forbidden' => 'pages#forbidden', :as => 'forbidden'
get '/terms-of-service' => 'pages#tos', :as => 'tos'
get '/tour/:id' => 'pages#tour_inside', :as => 'tour_inside', :id => /projects|sources|builds/
get '/forbidden' => 'pages#forbidden', :as => 'forbidden'
get '/terms-of-service' => 'pages#tos', :as => 'tos'
get '/tour/:id' => 'pages#tour_inside', :as => 'tour_inside', :id => /projects|sources|builds/
get '/activity_feeds.:format' => 'activity_feeds#index', :as => 'atom_activity_feeds', :format => /atom/
if APP_CONFIG['anonymous_access']

View File

@ -4,7 +4,7 @@ base_path = "/srv/rosa_build"
rails_env = ENV['RAILS_ENV'] || 'production'
worker_processes 4
worker_processes 8
working_directory File.join(base_path, 'current') # available in 0.94.0+
# listen File.join(base_path, 'tmp', 'pids', 'unicorn.sock')

View File

@ -0,0 +1,26 @@
class AddSaveToRepositoryToBuildLists < ActiveRecord::Migration
def self.up
add_column :build_lists, :save_to_repository_id, :integer
BuildList.scoped.includes(:project => :repositories, :save_to_platform => :repositories).find_in_batches do |batch|
batch.each do |bl|
begin
project = bl.project
platform = bl.save_to_platform
rep = (project.repositories.map(&:id) & platform.repositories.map(&:id)).first
bl.save_to_repository_id = rep
bl.save!
rescue Exception => e
puts e.inspect
false
end
end
end
end
def self.down
remove_column :build_lists, :save_to_repository_id
end
end

View File

@ -53,8 +53,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
create_table "arches", :force => true do |t|
t.string "name", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
@ -63,8 +63,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.integer "user_id"
t.string "provider"
t.string "uid"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
@ -75,8 +75,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.integer "level"
t.integer "status"
t.integer "build_list_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.string "version"
end
@ -126,6 +126,7 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.integer "duration"
t.integer "advisory_id"
t.integer "mass_build_id"
t.integer "save_to_repository_id"
end
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
@ -160,18 +161,18 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
end
create_table "flash_notifies", :force => true do |t|
t.text "body_ru", :null => false
t.text "body_en", :null => false
t.string "status", :null => false
t.text "body_ru", :null => false
t.text "body_en", :null => false
t.string "status", :null => false
t.boolean "published", :default => true, :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "groups", :force => true do |t|
t.integer "owner_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "uname"
t.integer "own_projects_count", :default => 0, :null => false
t.text "description"
@ -261,16 +262,16 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.integer "platform_id"
t.string "login"
t.string "password"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
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 "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
@ -278,8 +279,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
create_table "products", :force => true do |t|
t.string "name", :null => false
t.integer "platform_id", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "build_script"
t.text "counter"
t.text "ks"
@ -298,8 +299,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.string "name"
t.string "version"
t.datetime "file_mtime"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.integer "platform_id"
end
@ -308,8 +309,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
create_table "project_to_repositories", :force => true do |t|
t.integer "project_id"
t.integer "repository_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
end
create_table "projects", :force => true do |t|
@ -333,14 +334,16 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
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", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "interest"
t.text "more"
end
@ -353,16 +356,16 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.string "actor_type"
t.integer "target_id"
t.string "target_type"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
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", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "name", :null => false
end
@ -373,8 +376,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.boolean "new_comment_reply", :default => true
t.boolean "new_issue", :default => true
t.boolean "issue_assign", :default => true
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "new_comment_commit_owner", :default => true
t.boolean "new_comment_commit_repo_owner", :default => true
t.boolean "new_comment_commit_commentor", :default => true
@ -383,8 +386,8 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
create_table "subscribes", :force => true do |t|
t.string "subscribeable_type"
t.integer "user_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.boolean "status", :default => true
t.integer "project_id"
t.decimal "subscribeable_id", :precision => 50, :scale => 0
@ -395,17 +398,14 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
t.string "email", :default => "", :null => false
t.string "encrypted_password", :default => "", :null => false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.text "ssh_key"
t.string "uname"
t.string "role"
t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false
t.string "confirmation_token"
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "language", :default => "en"
t.integer "own_projects_count", :default => 0, :null => false
t.text "professional_experience"
t.string "site"
t.string "company"
@ -417,6 +417,9 @@ ActiveRecord::Schema.define(:version => 20120730214052) 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

View File

@ -24,7 +24,7 @@ module Rosa
if (params = request.path_parameters) && params[:treeish] # parse existing branch (tag) and path
branch_or_tag = begin
(p = Project.find_by_owner_and_name params[:owner_name], params[:project_name]) &&
p.repo.branches_and_tags.detect{|t| params[:treeish].start_with?(t.name)}.try(:name) ||
p.repo.branches_and_tags.map(&:name).sort{|a,b| b.length <=> a.length}.detect{|b| params[:treeish].start_with?(b)} ||
params[:treeish].split('/').first
end
if path = params[:treeish].sub(branch_or_tag, '')[1..-1] and path.present?

View File

@ -27,7 +27,7 @@ namespace :import do
say 'DONE'
end
# bundle exec rake import:srpm RAILS_ENV=production BASE=/share/platforms/naulinux5x_personal/tmp/SRPMS LIST=https://dl.dropbox.com/u/984976/nauschool5x.srpms.txt OWNER=naulinux PLATFORM=naulinux REPO=main > log/srpm_naulinux.log
# bundle exec rake import:srpm RAILS_ENV=production BASE=/share/platforms/naulinux5x_personal/tmp/SRPMS LIST=https://dl.dropbox.com/u/984976/nauschool5x.srpms.txt OWNER=naulinux PLATFORM=naulinux REPO=main CLEAR=true > log/srpm_naulinux.log &
desc 'Import SRPMs as projects'
task :srpm => :environment do
base = ENV['BASE'] || '/share/alt_repos/rsync'
@ -36,17 +36,39 @@ namespace :import do
owner = User.find_by_uname(ENV['OWNER']) || Group.find_by_uname!(ENV['OWNER'] || 'altlinux')
platform = Platform.find_by_name!(ENV['PLATFORM'] || 'altlinux5')
repo = platform.repositories.find_by_name!(ENV['REPO'] || 'main')
clear = ENV['CLEAR'] == 'true' ? true : false
say "START import projects from '#{base}' using '#{list || mask}' for '#{owner.uname}' to repo '#{platform.name}/#{repo.name}'."
repo.project_to_repositories.clear if agree "Clear destination repo #{platform.name}/#{repo.name}?"
(list ? open(list).readlines.map{|n| File.join base, n.chomp.strip} : Dir[File.join base, mask]).each do |path|
print "Processing '#{path}'..."
if name = `rpm -q --qf '[%{Name}]' -p #{path}` and $?.success? and name.present?
p = Project.find_or_create_by_name_and_owner_type_and_owner_id(name, owner.class.to_s, owner.id)
p.import_srpm(path, platform.name)
repo.projects << p
print "Ok! - #{p.name}"
repo.project_to_repositories.clear if clear
(list ? open(list).readlines.map{|n| File.join base, n.chomp.strip} : Dir[File.join base, mask]).each do |srpm_file|
print "Processing '#{srpm_file}'... "
if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present?
if clear # simply add
project = Project.find_or_create_by_name_and_owner_type_and_owner_id(name, owner.class.to_s, owner.id)
repo.projects << project
else # check if project already added
if project = repo.projects.find_by_name(name) || repo.projects.by_name(name).first # fallback to speedup
print "Found project '#{project.owner.uname}/#{project.name}' in '#{platform.name}/#{repo.name}'."
elsif scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class) and
project = scoped.find_by_name(name) || scoped.by_name(name).first
begin
repo.projects << project
rescue Exception => e
print "Add project '#{project.owner.uname}/#{project.name}' to '#{platform.name}/#{repo.name}' FAILED: #{e.message}."
else
print "Add project '#{project.owner.uname}/#{project.name}' to '#{platform.name}/#{repo.name}' OK."
end
else
description = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', `rpm -q --qf '[%{Description}]' -p #{srpm_file}`)
project = Project.create!(:name => name, :description => description) {|p| p.owner = owner}
repo.projects << project
print "Create project #{project.owner.uname}/#{project.name} in #{platform.name}/#{repo.name} OK."
end
end
project.import_srpm(srpm_file, platform.name)
print " Code import complete!"
else
print 'Fail!'
print 'RPM Error!'
end
puts
end

View File

@ -87,7 +87,10 @@
<a href="#">Confidentiality</a> <img src="/pics/square.png" alt="_">
</li>
<li>
<a href="#">Security</a>
<a href="#">Security</a> <img src="/pics/square.png" alt="_">
</li>
<li>
<a href="/contact">Support</a>
</li>
</ul>
</footer>

View File

@ -89,7 +89,10 @@
<a href="#">Confidentiality</a> <img src="/pics/square.png" alt="_">
</li>
<li>
<a href="#">Security</a>
<a href="#">Security</a> <img src="/pics/square.png" alt="_">
</li>
<li>
<a href="/contact">Support</a>
</li>
</ul>
</footer>

View File

@ -49,7 +49,10 @@ We apologize for any inconvenience.</h2>
<a href="#">Confidentiality</a> <img src="/assets/square.png" alt="_">
</li>
<li>
<a href="#">Security</a>
<a href="#">Security</a> <img src="/pics/square.png" alt="_">
</li>
<li>
<a href="/contact">Support</a>
</li>
</ul>
</footer>