[refs #374] Merge master into 374-rest_api_for_builds

This commit is contained in:
konstantin.grabar 2012-09-21 13:20:04 +04:00
commit e94c6f4f00
140 changed files with 2513 additions and 1091 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
*~
.bundle
.rvmrc
.DS_Store

12
Gemfile
View File

@ -1,6 +1,6 @@
source 'http://rubygems.org'
gem 'rails', '3.2.7' #, :git => 'git://github.com/rails/rails.git'
gem 'rails', '3.2.8' #, :git => 'git://github.com/rails/rails.git'
gem 'pg', '~> 0.14.0'
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
@ -25,13 +25,13 @@ gem 'state_machine'
# gem 'rugged', '~> 0.16.0'
gem 'grack', :git => 'git://github.com/rdblue/grack.git', :require => 'git_http'
gem "grit", :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
gem 'charlock_holmes', '~> 0.6.8' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
gem 'charlock_holmes', '~> 0.6.9' #, :git => 'git://github.com/brianmario/charlock_holmes.git', :branch => 'bundle-icu'
# gem 'ruby-filemagic', '~> 0.4.2', :require => 'filemagic/ext'
gem 'github-linguist', '~> 2.1.2', :require => 'linguist'
gem 'github-linguist', '~> 2.2.1', :require => 'linguist'
gem 'diff-display', '~> 0.0.1'
# Wiki
gem "gollum", :git => 'git://github.com/github/gollum.git'
gem "gollum", '~> 2.1.3'
gem "redcarpet", "1.17.2"
gem 'creole'
gem 'rdiscount'
@ -65,7 +65,7 @@ group :assets do
gem 'coffee-rails', '~> 3.2.2'
gem 'compass-rails', '~> 1.0.3'
gem 'uglifier', '~> 1.2.4'
gem 'therubyracer', '~> 0.10.1', :platforms => [:mri, :rbx]
gem 'therubyracer', '~> 0.10.2', :platforms => [:mri, :rbx]
gem 'therubyrhino', '~> 1.73.1', :platforms => :jruby
end
@ -88,7 +88,7 @@ end
group :test do
gem 'rspec-rails', '~> 2.11.0', :group => 'development'
gem 'factory_girl_rails', '~> 3.6.0'
gem 'factory_girl_rails', '~> 4.0.0'
gem 'rr', '~> 1.0.4'
gem 'shoulda'
end

View File

@ -6,23 +6,6 @@ GIT
redhillonrails_core (2.0.0.pre)
activerecord (>= 3.1.0.rc)
GIT
remote: git://github.com/github/gollum.git
revision: 8422b712048656c8ea391c2d7ef27fb29f66746b
specs:
gollum (2.1.0)
github-markdown
github-markup (>= 0.7.0, < 1.0.0)
grit (~> 2.5.0)
mustache (>= 0.11.2, < 1.0.0)
nokogiri (~> 1.4)
posix-spawn (~> 0.3.0)
pygments.rb (~> 0.2.0)
sanitize (~> 2.0.0)
sinatra (~> 1.0)
stringex (~> 1.4.0)
useragent (~> 0.4.9)
GIT
remote: git://github.com/rdblue/grack.git
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
@ -42,12 +25,12 @@ GEM
remote: http://rubygems.org/
specs:
RedCloth (4.2.9)
actionmailer (3.2.7)
actionpack (= 3.2.7)
actionmailer (3.2.8)
actionpack (= 3.2.8)
mail (~> 2.4.4)
actionpack (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
actionpack (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@ -55,18 +38,18 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.7)
activesupport (= 3.2.7)
activemodel (3.2.8)
activesupport (= 3.2.8)
builder (~> 3.0.0)
activerecord (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activerecord (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activesupport (3.2.7)
activeresource (3.2.8)
activemodel (= 3.2.8)
activesupport (= 3.2.8)
activesupport (3.2.8)
i18n (~> 0.6)
multi_json (~> 1.0)
adsf (1.1.1)
@ -94,9 +77,9 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano_colors (0.5.5)
charlock_holmes (0.6.8)
charlock_holmes (0.6.9)
chronic (0.6.7)
chunky_png (1.2.5)
chunky_png (1.2.6)
cocaine (0.2.1)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@ -130,21 +113,33 @@ GEM
execjs (1.4.0)
multi_json (~> 1.0)
expression_parser (0.9.0)
factory_girl (3.6.0)
factory_girl (4.0.0)
activesupport (>= 3.0.0)
factory_girl_rails (3.6.0)
factory_girl (~> 3.6.0)
factory_girl_rails (4.0.0)
factory_girl (~> 4.0.0)
railties (>= 3.0.0)
ffi (1.0.11)
fssm (0.2.9)
github-linguist (2.1.2)
github-linguist (2.2.1)
charlock_holmes (~> 0.6.6)
escape_utils (~> 0.2.3)
mime-types (~> 1.18)
pygments.rb (>= 0.2.13)
github-markdown (0.5.0)
github-markup (0.7.4)
haml (3.1.6)
gollum (2.1.3)
github-markdown
github-markup (>= 0.7.0, < 1.0.0)
grit (~> 2.5.0)
mustache (>= 0.11.2, < 1.0.0)
nokogiri (~> 1.4)
posix-spawn (~> 0.3.0)
pygments.rb (~> 0.2.0)
sanitize (~> 2.0.0)
sinatra (~> 1.0)
stringex (~> 1.4.0)
useragent (~> 0.4.9)
haml (3.1.7)
haml-rails (0.3.4)
actionpack (~> 3.0)
activesupport (~> 3.0)
@ -155,7 +150,7 @@ GEM
hike (1.2.1)
hirb (0.7.0)
i18n (0.6.0)
jbuilder (0.4.0)
jbuilder (0.4.3)
activesupport (>= 3.0.0)
blankslate (>= 2.1.2.4)
journey (1.0.4)
@ -233,14 +228,14 @@ GEM
rack (>= 1.0)
rack-throttle (0.3.0)
rack (>= 1.0.0)
rails (3.2.7)
actionmailer (= 3.2.7)
actionpack (= 3.2.7)
activerecord (= 3.2.7)
activeresource (= 3.2.7)
activesupport (= 3.2.7)
rails (3.2.8)
actionmailer (= 3.2.8)
actionpack (= 3.2.8)
activerecord (= 3.2.8)
activeresource (= 3.2.8)
activesupport (= 3.2.8)
bundler (~> 1.0)
railties (= 3.2.7)
railties (= 3.2.8)
rails-backbone (0.7.2)
coffee-script (~> 2.2.0)
ejs (~> 1.0.0)
@ -249,9 +244,9 @@ GEM
railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.7)
rails (~> 3.0)
railties (3.2.7)
actionpack (= 3.2.7)
activesupport (= 3.2.7)
railties (3.2.8)
actionpack (= 3.2.8)
activesupport (= 3.2.8)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
@ -263,7 +258,7 @@ GEM
json (~> 1.4)
redcarpet (1.17.2)
redis (3.0.1)
redis-namespace (1.2.0)
redis-namespace (1.2.1)
redis (~> 3.0.0)
redisk (0.2.2)
redis (>= 0.1.1)
@ -287,7 +282,7 @@ GEM
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
rspec-mocks (2.11.2)
rspec-rails (2.11.0)
actionpack (>= 3.0)
activesupport (>= 3.0)
@ -306,7 +301,7 @@ GEM
capistrano (>= 2.0.0)
sanitize (2.0.3)
nokogiri (>= 1.4.4, < 1.6)
sass (3.1.20)
sass (3.2.0)
sass-rails (3.2.5)
railties (~> 3.2.0)
sass (>= 3.1.10)
@ -334,19 +329,19 @@ GEM
state_machine (1.1.2)
stringex (1.4.0)
systemu (2.5.2)
therubyracer (0.10.1)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
thin (1.4.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.15.4)
thor (0.16.0)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.33)
uglifier (1.2.6)
uglifier (1.2.7)
execjs (>= 0.3.0)
multi_json (~> 1.3)
unicorn (4.3.1)
@ -381,15 +376,15 @@ DEPENDENCIES
cape
capistrano
capistrano_colors
charlock_holmes (~> 0.6.8)
charlock_holmes (~> 0.6.9)
coffee-rails (~> 3.2.2)
compass-rails (~> 1.0.3)
creole
devise (~> 2.1.2)
diff-display (~> 0.0.1)
factory_girl_rails (~> 3.6.0)
github-linguist (~> 2.1.2)
gollum!
factory_girl_rails (~> 4.0.0)
github-linguist (~> 2.2.1)
gollum (~> 2.1.3)
grack!
grit!
haml-rails (~> 0.3.4)
@ -408,7 +403,7 @@ DEPENDENCIES
perform_later (~> 1.3.0)
pg (~> 0.14.0)
rack-throttle
rails (= 3.2.7)
rails (= 3.2.8)
rails-backbone (~> 0.7.2)
rails3-generators
rails3-jquery-autocomplete (~> 1.0.7)
@ -427,7 +422,7 @@ DEPENDENCIES
shotgun
shoulda
state_machine
therubyracer (~> 0.10.1)
therubyracer (~> 0.10.2)
therubyrhino (~> 1.73.1)
trinidad (~> 1.0.2)
uglifier (~> 1.2.4)

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B

View File

@ -0,0 +1,23 @@
Rosa.Views.ProjectModifyView = Backbone.View.extend({
initialize: function() {
_.bindAll(this, 'checkboxClick');
this.$checkbox_wrapper = $('#niceCheckbox1');
this._$checkbox = this.$checkbox_wrapper.children('#project_is_package').first();
this.$maintainer_form = $('#maintainer_form');
this.$checkbox_wrapper.on('click', this.checkboxClick);
},
checkboxClick: function() {
if (this._$checkbox.is(':checked')) {
this.$maintainer_form.slideDown();
} else {
this.$maintainer_form.slideUp();
}
},
render: function() {
this.checkboxClick();
}
});

View File

@ -1,5 +1,5 @@
function changeCheck(el) {
var el = el, input = el.find('input[type="checkbox"]');
var input = el.find('input[type="checkbox"]');
if(input.attr("checked")) {
el.css('backgroundPosition', '0 0');
@ -13,7 +13,7 @@ function changeCheck(el) {
}
function startChangeCheck(el) {
var el = el, input = el.find('input[type="checkbox"]');
var input = el.find('input[type="checkbox"]');
if(input.attr('checked')) {
el.css('backgroundPosition', '0 -18px');

View File

@ -1,98 +1,47 @@
$(document).ready(function() {
// TODO: Refactor this handler!! It's too complicated.
$('#build_list_save_to_platform_id').change(function() {
var platform_id = $(this).val();
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
$('#build_list_save_to_repository_id').change(function() {
var selected_option = $(this).find("option:selected");
base_platforms.each(function(){
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) >= 0) {
if ($(this).val() == platform_id) {
if ($(this).attr('data-released') === '1') {
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
//disableUpdateTypes();
var platform_id = selected_option.attr('platform_id');
var rep_name = selected_option.text().match(/[\w-]+\/([\w-]+)/)[1];
var build_platform = $('#build_for_pl_' + platform_id);
var all_repositories = $('.all_platforms input');
all_repositories.removeAttr('checked');
if (build_platform.size() == 0) {
all_repositories.removeAttr('disabled');
} else {
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
//enableUpdateTypes();
}
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled');
var rep_name = $('#build_list_save_to_platform_id option[value="' + $(this).val() + '"]').text().match(/[\w-]+\/([\w-]+)/)[1];
all_repositories.attr('disabled', 'disabled');
var parent = build_platform.parent();
parent.find('input').removeAttr('disabled');
parent.find('input[rep_name="main"]').attr('checked', 'checked');
if (rep_name != 'main') {
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="' + rep_name + '"]').attr('checked', 'checked');
parent.find('input[rep_name="' + rep_name + '"]').attr('checked', 'checked');
}
$(this).parent().find('.offset25 input[type="checkbox"][rep_name="main"]').attr('checked', 'checked');
setBranchSelected(selected_option);
}
var build_list_auto_publish = $('#build_list_auto_publish');
if (selected_option.attr('publish_without_qa') == '1') {
build_list_auto_publish.removeAttr('disabled').attr('checked', 'checked');
} else {
$(this).removeAttr('checked').attr('disabled', 'disabled').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').attr('disabled', 'disabled').removeAttr('checked');
}
} else {
$(this).removeAttr('disabled').removeAttr('checked').trigger('change');
$(this).parent().find('.offset25 input[type="checkbox"]').removeAttr('disabled').removeAttr('checked');
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
build_list_auto_publish.removeAttr('checked').attr('disabled', 'disabled');
}
});
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) == -1) {
// For personal platforms update types always enebaled:
enableUpdateTypes();
}
setBranchSelected();
});
$('#build_list_save_to_platform_id').trigger('change');
$('.offset25 label').click(function() {
setPlChecked($(this).prev()[0], !$(this).prev().attr('checked'));
});
$('.offset25 input[type="checkbox"]').click(function() {
setPlChecked(this, $(this).attr('checked'));
});
$('.build_bpl_ids').click(function() {
return false;
});
$('#build_list_save_to_repository_id').trigger('change');
});
function setPlChecked(pointer, checked) {
var pl_cbx = $(pointer).parent().parent().parent().find('input[type="checkbox"].build_bpl_ids');
var pl_id = pl_cbx.val();
if (checked && !$(pointer).attr('disabled')) {
pl_cbx.attr('checked', 'checked').trigger('change');
} else if ($('input[pl_id=' + pl_id + '][checked="checked"]').size() == 0) {
pl_cbx.removeAttr('checked').trigger('change');
}
}
function setBranchSelected() {
var pl_id = $('#build_list_save_to_platform_id').val();
// Checks if selected platform is main or not:
if ( $('.all_platforms').find('input[type="checkbox"][value=' + pl_id + '].build_bpl_ids').size() > 0 ) {
var pl_name = $('#build_list_save_to_platform_id option[value="' + pl_id + '"]').text().match(/([\w-.]+)\/[\w-.]+/)[1];
var branch_pl_opt = $('#build_list_project_version option[value="latest_' + pl_name + '"]');
function setBranchSelected(selected_option) {
var pl_name = selected_option.text().match(/([\w-.]+)\/[\w-.]+/)[1];
var bl_version_sel = $('#build_list_project_version');
var branch_pl_opt = bl_version_sel.find('option[value="latest_' + pl_name + '"]');
// If there is branch we need - set it selected:
if ( branch_pl_opt.size() > 0 ) {
$('#build_list_project_version option[selected]').removeAttr('selected');
if (branch_pl_opt.size() > 0) {
bl_version_sel.find('option[selected]').removeAttr('selected');
branch_pl_opt.attr('selected', 'selected');
}
bl_version_sel.val(branch_pl_opt);
// hack for FF to force render of select box.
bl_version_sel[0].innerHTML = bl_version_sel[0].innerHTML;
}
}
function disableUpdateTypes() {
$("select#build_list_update_type option").each(function(i,el) {
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
$(el).attr("disabled", "disabled");
// If disabled option is selected - select 'bugfix':
if ( $(el).attr("selected") ) {
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
}
}
});
}
function enableUpdateTypes() {
$("select#build_list_update_type option").removeAttr("disabled");
}

View File

@ -232,7 +232,7 @@ $(document).ready(function() {
form.fadeOut('slow');
$('#edit_issue_content').fadeIn('slow');
$('h3.issue_title').html(form.find('#issue_title').attr('value'));
$('.fulltext.view.issue_body').html(form.find('#issue_body').attr('value'));
$('.fulltext.view.issue_body').html(data);
},
error: function(data){
alert('error'); // TODO remove

View File

@ -1152,19 +1152,19 @@ form.mass_build section.right {
}
/* remove this lines after change to backbone */
table.tablesorter.advisories thead tr.search th {
table.tablesorter.static-search thead tr.search th {
padding: 0 5px;
}
table.tablesorter.advisories thead tr.search th input[type='text'] {
table.tablesorter.static-search thead tr.search th input[type='text'] {
width: 640px;
}
table.tablesorter.advisories thead tr.search th form {
table.tablesorter.static-search thead tr.search th form {
float: left;
}
table.tablesorter.advisories thead tr.search th form.button_to {
table.tablesorter.static-search thead tr.search th form.button_to {
padding: 3px 0 0 7px;
}
@ -1384,3 +1384,110 @@ hr.bootstrap {
filter: alpha(opacity=20);
}
}
div.reloader {
float: right;
}
div.log-wrapper {
width: 565px;
div.log-header {
margin-bottom: 10px;
div.text-wrap, span {
height: 16px;
margin: 0;
padding: 0;
}
div.text-wrap {
width: 545px;
float: left;
h3 {
margin: 0;
}
}
span {
background: image-url("trigger.gif") no-repeat scroll left bottom transparent;
margin: 1px;
cursor: pointer;
display: block;
font-size: 0;
height: 14px;
width: 14px;
float: right;
}
span.closed {
background-position: left top;
}
}
div.log-body {
div.reloader, .log {
border: 1px solid #ccc;
}
div.reloader {
padding: 5px 10px;
border-bottom: none;
border-radius: 5px 5px 0 0;
table.options {
border-spacing: 5px 0;
tr {
td a {
display: inline-block;
height: 13px;
padding-left: 16px;
background: image-url('code.png') no-repeat;
padding-bottom: 2px;
margin: 2px 0 0 1px;
}
td.first {
padding-right: 5px;
}
td.last {
border-left: 1px solid #ccc;
}
}
tr.bottom {
td {
padding-left: 5px;
}
td.first {
border-top: 1px solid #ccc;
}
}
}
}
.log {
background: #f8f8f8;
height: 500px;
width: 543px;
min-width: 543px;
border-radius: 5px 0 5px 5px;
overflow: auto;
padding: 10px;
margin: 0;
font-family: monospace;
font-size: 13px;
}
}
}
table.tablesorter.platform-maintainers.static-search thead tr.search th input[type="text"] {
width: 430px;
}
.all_platforms {
> .both { margin: 0 0 5px; }
.build_for_pl { font-weight: bold; }
.offset25 { padding-left: 10px }
}

View File

@ -828,11 +828,11 @@ article div.activity div.fulltext.view {
margin: 0px 0px 10px 0px;
}
.right div.rightlist div.check {
div.rightlist div.check {
float: left;
}
.right div.rightlist div.forcheck {
div.rightlist div.forcheck {
float: left;
margin: 1px 0px 0px 5px;
}

View File

@ -10,7 +10,7 @@ class Groups::ProfileController < Groups::BaseController
end
def show
@projects = @group.projects #.paginate(:page => params[:project_page], :per_page => 10)
@projects = @group.projects.by_visibilities(['open'])
end
def new

View File

@ -9,11 +9,11 @@ class PagesController < ApplicationController
def tour_inside
@entries = case params[:id]
when 'projects'
when 'builds'
%w(repo builds monitoring)
when 'sources'
%w(source history annotation edit)
when 'builds'
when 'projects'
%w(control git tracker)
end
render "pages/tour/tour-inside", :layout => 'tour'

View File

@ -0,0 +1,15 @@
# -*- encoding : utf-8 -*-
class Platforms::MaintainersController < ApplicationController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
def index
@maintainers = BuildList::Package.actual.by_platform(@platform)
.order('lower(name) ASC, length(name) ASC')
.includes(:project)
@maintainers = @maintainers.where('name ILIKE ?', "%#{params[:q]}%") if params[:q].present?
@maintainers = @maintainers.paginate(:page => params[:page])
end
end

View File

@ -2,7 +2,7 @@
class Platforms::PlatformsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:advisories] if APP_CONFIG['anonymous_access']
skip_before_filter :authenticate_user!, :only => [:advisories, :members, :show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource
autocomplete :user, :uname
@ -86,35 +86,25 @@ class Platforms::PlatformsController < Platforms::BaseController
end
def remove_members
all_user_ids = params['user_remove'].inject([]) {|a, (k, v)| a << k if v.first == '1'; a}
all_user_ids.each do |uid|
Relation.by_target(@platform).where(:actor_id => uid, :actor_type => 'User').each{|r| r.destroy}
end
user_ids = params[:user_remove] ?
params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : []
User.where(:id => user_ids).each{ |user| @platform.remove_member(user) }
redirect_to members_platform_path(@platform)
end
def remove_member
u = User.find(params[:member_id])
Relation.by_actor(u).by_target(@platform).each{|r| r.destroy}
User.where(:id => params[:member_id]).each{ |user| @platform.remove_member(user) }
redirect_to members_platform_path(@platform)
end
def add_member
if params[:member_id].present?
member = User.find(params[:member_id])
if @platform.relations.exists?(:actor_id => member.id, :actor_type => member.class.to_s) or @platform.owner == member
flash[:warning] = t('flash.platform.members.already_added', :name => member.uname)
else
rel = @platform.relations.build(:role => 'admin')
rel.actor = member
if rel.save
if member = User.where(:id => params[:member_id]).first
if @platform.add_member(member)
flash[:notice] = t('flash.platform.members.successfully_added', :name => member.uname)
else
flash[:error] = t('flash.platform.members.error_in_adding', :name => member.uname)
end
end
end
redirect_to members_platform_url(@platform)
end

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class Platforms::ProductsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource :product, :through => :platform

View File

@ -1,9 +1,11 @@
# -*- encoding : utf-8 -*-
class Platforms::RepositoriesController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show, :projects_list] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource :repository, :through => :platform, :shallow => true
before_filter :set_members, :only => [:edit, :update]
def index
@repositories = @repositories.paginate(:page => params[:page])
@ -14,6 +16,46 @@ class Platforms::RepositoriesController < Platforms::BaseController
@projects = @projects.search(params[:query]).search_order if params[:query].present?
end
def edit
end
def update
if @repository.update_attributes(
:description => params[:repository][:description],
:publish_without_qa => (params[:repository][:publish_without_qa] || @repository.publish_without_qa)
)
flash[:notice] = I18n.t("flash.repository.updated")
redirect_to platform_repository_path(@platform, @repository)
else
flash[:error] = I18n.t("flash.repository.update_error")
flash[:warning] = @repository.errors.full_messages.join('. ')
render :action => :edit
end
end
def remove_members
user_ids = params[:user_remove] ?
params[:user_remove].map{ |k, v| k if v.first == '1' }.compact : []
User.where(:id => user_ids).each{ |user| @repository.remove_member(user) }
redirect_to edit_platform_repository_path(@platform, @repository)
end
def remove_member
User.where(:id => params[:member_id]).each{ |user| @repository.remove_member(user) }
redirect_to edit_platform_repository_path(@platform, @repository)
end
def add_member
if member = User.where(:id => params[:member_id]).first
if @repository.add_member(member)
flash[:notice] = t('flash.repository.members.successfully_added', :name => member.uname)
else
flash[:error] = t('flash.repository.members.error_in_adding', :name => member.uname)
end
end
redirect_to edit_platform_repository_path(@platform, @repository)
end
def new
@repository = Repository.new
@platform_id = params[:platform_id]
@ -94,4 +136,10 @@ class Platforms::RepositoriesController < Platforms::BaseController
redirect_to platform_repository_path(@platform, @repository), :notice => t('flash.repository.project_removed')
end
protected
def set_members
@members = @repository.members.order('name')
end
end

View File

@ -5,9 +5,9 @@ class Projects::BuildListsController < Projects::BaseController
before_filter :authenticate_user!, :except => CALLBACK_ACTIONS
before_filter :authenticate_build_service!, :only => CALLBACK_ACTIONS
skip_before_filter :authenticate_user!, :only => [:show, :index, :search] if APP_CONFIG['anonymous_access']
skip_before_filter :authenticate_user!, :only => [:show, :index, :search, :log] if APP_CONFIG['anonymous_access']
before_filter :find_build_list, :only => [:show, :publish, :cancel, :update]
before_filter :find_build_list, :only => [:show, :publish, :cancel, :update, :log]
before_filter :find_build_list_by_bs, :only => [:publish_build, :status_build, :pre_build, :post_build, :circle_build]
load_and_authorize_resource :project, :only => NESTED_ACTIONS
@ -25,8 +25,10 @@ class Projects::BuildListsController < Projects::BaseController
def index
@action_url = @project ? search_project_build_lists_path(@project) : search_build_lists_path
@filter = BuildList::Filter.new(@project, current_user, params[:filter] || {})
@build_lists = @filter.find.scoped(:include => [:save_to_platform, :project, :user, :arch])
@build_lists = @build_lists.recent.paginate :page => params[:page]
@bls = @filter.find.recent.paginate :page => params[:page]
@build_lists = BuildList.where(:id => @bls.pluck("#{BuildList.table_name}.id")).recent
@build_lists = @build_lists.includes [:save_to_platform, :save_to_repository, :arch, :user, :project => [:owner]]
@build_server_status = begin
BuildServer.get_status
@ -42,15 +44,18 @@ class Projects::BuildListsController < Projects::BaseController
def create
notices, errors = [], []
@platform = Platform.includes(:repositories).find params[:build_list][:save_to_platform_id]
@repository = Repository.find params[:build_list][:save_to_repository_id]
@platform = @repository.platform
@repository = @project.repositories.where(:id => @platform.repository_ids).first
params[:build_list][:save_to_platform_id] = @platform.id
params[:build_list][:auto_publish] = false unless @repository.publish_without_qa?
params[:build_list][:save_to_repository_id] = @repository.id
params[:build_list][:auto_publish] = false if @platform.released
build_for_platforms = Repository.select(:platform_id).
where(:id => params[:build_list][:include_repos]).group(:platform_id).map(&:platform_id)
Arch.where(:id => params[:arches]).each do |arch|
Platform.main.where(:id => params[:build_for_platforms]).each do |build_for_platform|
Platform.main.where(:id => build_for_platforms).each do |build_for_platform|
@build_list = @project.build_lists.build(params[:build_list])
@build_list.commit_hash = @project.repo.commits(@build_list.project_version.match(/^latest_(.+)/).to_a.last ||
@build_list.project_version).first.id if @build_list.project_version
@ -99,6 +104,15 @@ class Projects::BuildListsController < Projects::BaseController
end
end
def log
@log = `tail -n #{params[:load_lines].to_i} #{Rails.root + 'public' + @build_list.fs_log_path}`
@log = t("layout.build_lists.log.not_available") unless $?.success?
respond_to do |format|
format.json { render :json => { :log => @log, :building => @build_list.build_started? } }
end
end
def publish_build
if params[:status].to_i == 0 # ok
@build_list.published

View File

@ -4,7 +4,7 @@ class Projects::CommentsController < Projects::BaseController
load_and_authorize_resource :project
before_filter :find_commentable
before_filter :find_or_build_comment
load_and_authorize_resource
load_and_authorize_resource #:through => :commentable
include CommentsHelper

View File

@ -1,6 +1,7 @@
# -*- encoding : utf-8 -*-
class Projects::Git::TreesController < Projects::Git::BaseController
before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => 'show'
before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => :show
skip_before_filter :set_branch_and_tree, :only => :archive
def show
@tree = @tree / @path if @path.present?
@ -9,13 +10,18 @@ class Projects::Git::TreesController < Projects::Git::BaseController
end
def archive
@commit = @project.repo.log(@treeish, nil, :max_count => 1).first
raise Grit::NoSuchPathError unless @commit
name = "#{@project.owner.uname}-#{@project.name}#{@project.repo.tags.include?(@treeish) ? "-#{@treeish}" : ''}-#{@commit.id[0..19]}"
fullname = "#{name}.#{params[:format] == 'tar' ? 'tar.gz' : 'zip'}"
file = Tempfile.new fullname, 'tmp'
system("cd #{@project.path}; git archive --format=#{params[:format]} --prefix=#{name}/ #{@treeish} #{params[:format] == 'tar' ? ' | gzip -9' : ''} > #{file.path}")
file.close
send_file file.path, :disposition => 'attachment', :type => "application/#{params[:format] == 'tar' ? 'x-tar-gz' : 'zip'}", :filename => fullname
format = params[:format]
if (@treeish =~ /^#{@project.owner.uname}-#{@project.name}-/) && !(@treeish =~ /[\s]+/) && (format =~ /^(zip|tar\.gz)$/)
@treeish = @treeish.gsub(/^#{@project.owner.uname}-#{@project.name}-/, '')
@commit = @project.repo.commits(@treeish, 1).first
end
raise Grit::NoSuchPathError unless @commit
name = "#{@project.owner.uname}-#{@project.name}-#{@treeish}"
fullname = "#{name}.#{format == 'zip' ? 'zip' : 'tar.gz'}"
file = Tempfile.new fullname, 'tmp'
system("cd #{@project.path}; git archive --format=#{format} --prefix=#{name}/ #{@treeish} #{format == 'zip' ? '' : ' | gzip -9'} > #{file.path}")
file.close
send_file file.path, :disposition => 'attachment', :type => "application/#{format == 'zip' ? 'zip' : 'x-tar-gz'}", :filename => fullname
end
end

View File

@ -1,13 +1,13 @@
# -*- encoding : utf-8 -*-
class Projects::IssuesController < Projects::BaseController
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label, :search_collaborators]
NON_RESTFUL_ACTION = [:create_label, :update_label, :destroy_label]
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
load_resource :project
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create, :index]
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION
layout 'application'
layout false, :only => [:update, :search_collaborators]
def index(status = 200)
@is_assigned_to_me = params[:filter] == 'to_me'
@ -16,35 +16,28 @@ class Projects::IssuesController < Projects::BaseController
@issues = @project.issues
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me
@issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == []
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
@issues = @issues.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%") if params[:search_issue]
if params[:search_issue]
@issues = @issues.where('issues.title ILIKE ?', "%#{params[:search_issue].mb_chars.downcase}%")
end
@opened_issues = @issues.opened.count
@closed_issues = @issues.closed.count
@opened_issues, @closed_issues = @issues.opened.count, @issues.closed.count
@issues = @issues.where(:status => @status)
@issues = @issues.includes(:assignee, :user).order('serial_id desc').uniq.paginate :per_page => 10, :page => params[:page]
.includes(:assignee, :user).order('serial_id desc').uniq.paginate :per_page => 10, :page => params[:page]
if status == 200
render 'index', :layout => request.format == '*/*' ? 'issues' : 'application' # maybe FIXME '*/*'?
render 'index', :layout => request.xhr? ? 'issues' : 'application'
else
render :status => status, :nothing => true
end
end
def new
@issue = @project.issues.new
end
def create
@assignee_uname = params[:assignee_uname]
@issue = @project.issues.new(params[:issue])
@issue.user_id = current_user.id
if @issue.save
@issue.subscribe_creator(current_user.id)
flash[:notice] = I18n.t("flash.issue.saved")
redirect_to project_issues_path(@project)
else
@ -54,41 +47,35 @@ class Projects::IssuesController < Projects::BaseController
end
def update
@issue.labelings.destroy_all if params[:update_labels]
if params[:issue] && status = params[:issue][:status]
action = 'status'
@issue.set_close(current_user) if status == 'closed'
@issue.set_open if status == 'open'
status = 200 if @issue.save
render :partial => action, :status => (status || 500), :layout => false
render :partial => 'status', :status => (@issue.save ? 200 : 500)
elsif params[:issue]
@issue.labelings.destroy_all if params[:issue][:labelings_attributes] # FIXME
status = 200 if @issue.update_attributes(params[:issue])
render :nothing => true, :status => (status || 500), :layout => false
status = @issue.update_attributes(params[:issue]) ? 200 : 500
render :inline => ActionController::Base.helpers.simple_format(params[:issue][:body]), :status => status
else
render :nothing => true, :status => 200, :layout => false
render :nothing => true, :status => 200
end
end
def destroy
@issue.destroy
flash[:notice] = t("flash.issue.destroyed")
redirect_to root_path
end
def create_label
status = @project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
index(@project.labels.create!(:name => params[:name], :color => params[:color]) ? 200 : 500)
end
def update_label
status = @label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500
index(status)
index(@label.update_attributes(:name => params[:name], :color => params[:color]) ? 200 : 500)
end
def destroy_label
status = (@label && @label_destroy) ? 200 : 500
index(status)
index((@label && @label_destroy) ? 200 : 500)
end
def search_collaborators
@ -96,7 +83,7 @@ class Projects::IssuesController < Projects::BaseController
users = User.joins(:groups => :projects).where(:projects => {:id => @project.id}).where("users.uname ILIKE ?", search)
users2 = @project.collaborators.where("users.uname ILIKE ?", search)
@users = (users + users2).uniq.sort {|x,y| x.uname <=> y.uname}.first(10)
render :partial => 'search_collaborators', :layout => false
render :partial => 'search_collaborators'
end
private

View File

@ -5,9 +5,7 @@ class Projects::ProjectsController < Projects::BaseController
def index
@projects = Project.accessible_by(current_ability, :membered)
# @projects = @projects.search(params[:query]).search_order if params[:query].present?
#puts prepare_list(@projects).inspect
respond_to do |format|
format.html { @projects = @projects.recent.paginate(:page => params[:page], :per_page => 25) }
format.json { @projects = prepare_list(@projects) }
@ -39,6 +37,7 @@ class Projects::ProjectsController < Projects::BaseController
end
def update
params[:project].delete(:maintainer_id) if params[:project][:maintainer_id].blank?
if @project.update_attributes(params[:project])
flash[:notice] = t('flash.project.saved')
redirect_to @project
@ -86,6 +85,14 @@ class Projects::ProjectsController < Projects::BaseController
redirect_to projects_path
end
def autocomplete_maintainers
term, limit = params[:term], params[:limit] || 10
items = User.member_of_project(@project)
.where("users.name ILIKE ? OR users.uname ILIKE ?", "%#{term}%", "%#{term}%")
.limit(limit).map { |u| {:value => u.fullname, :label => u.fullname, :id => u.id} }
render :json => items
end
protected
def prepare_list(projects)

View File

@ -5,7 +5,6 @@ class SearchController < ApplicationController
def index
params[:type] ||= 'all'
params[:type] = 'projects' unless current_user
case params[:type]
when 'all'
find_collection('projects')

View File

@ -3,8 +3,6 @@ class Users::ProfileController < Users::BaseController
autocomplete :user, :uname
def show
@groups = @user.groups.uniq
@platforms = @user.platforms.paginate(:page => params[:platform_page], :per_page => 10)
@projects = @user.projects.paginate(:page => params[:project_page], :per_page => 10)
@projects = @user.projects.by_visibilities(['open'])
end
end

View File

@ -8,6 +8,7 @@ class Users::RegisterRequestsController < ApplicationController
end
def create
params[:register_request][:language] = I18n.locale if params[:register_request]
RegisterRequest.create(params[:register_request])
render :thanks
end

View File

@ -43,4 +43,22 @@ module BuildListsHelper
build_list.project_version
end
end
def container_url
"http://#{request.host_with_port}/downloads#{@build_list.container_path}".html_safe
end
def build_list_log_url(log_type)
"http://#{request.host_with_port}/#{@build_list.fs_log_path(log_type)}".html_safe
end
def log_reload_time_options
t = I18n.t("layout.build_lists.log.reload_times").map { |i| i.reverse }
options_for_select(t, t.first).html_safe
end
def log_reload_lines_options
options_for_select([100, 200, 500, 1000, 1500, 2000], 1000).html_safe
end
end

View File

@ -36,8 +36,24 @@ class UserMailer < ActionMailer::Base
end
end
def build_list_notification(build_list, user)
I18n.locale = user.language if user.language
@user, @build_list = user, build_list
subject = "[№ #{build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")}] "
subject << (build_list.project ? build_list.project.name_with_owner : t("layout.projects.unexisted_project"))
subject << " - #{build_list.human_status} "
subject << I18n.t("notifications.subjects.for_arch", :arch => @build_list.arch.name)
mail(:to => user.email, :subject => subject) do |format|
format.html
end
end
def invite_approve_notification(register_request)
I18n.locale = register_request.language if register_request.language
@register_request = register_request
mail :to => register_request.email, :subject => I18n.t("notifications.subjects.invite_approve_notification")
mail :to => register_request.email, :subject => I18n.t("notifications.subjects.invite_approve_notification") do |format|
format.html
end
end
end

View File

@ -13,18 +13,23 @@ class Ability
@user = user
# Shared rights between guests and registered users
can :show, Project, :visibility => 'open'
can [:show, :archive], Project, :visibility => 'open'
can :get_id, Project
can :archive, Project, :visibility => 'open'
can :read, Issue, :project => {:visibility => 'open'}
can :search, BuildList
can [:read, :everything], BuildList, :project => {:visibility => 'open'}
can [:read, :log, :everything], BuildList, :project => {:visibility => 'open'}
can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
can :read, Advisory
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
# Core callbacks
can [:publish_build, :status_build, :pre_build, :post_build, :circle_build, :new_bbdt], BuildList
# Platforms block
can [:show, :members, :advisories], Platform, :visibility == 'open'
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
can :read, Product, :platform => {:visibility => 'open'}
if user.guest? # Guest rights
# can [:new, :create], RegisterRequest
else # Registered user rights
@ -56,51 +61,48 @@ class Ability
can [:read, :archive], Project, :owner_type => 'Group', :owner_id => user.group_ids
can([:read, :membered], Project, read_relations_for('projects')) {|project| local_reader? project}
can(:write, Project) {|project| local_writer? project} # for grack
can([:update, :sections, :manage_collaborators], Project) {|project| local_admin? project}
can([:update, :sections, :manage_collaborators, :autocomplete_maintainers], Project) {|project| local_admin? project}
can(:fork, Project) {|project| can? :read, project}
can(:fork, Project) {|project| project.owner_type == 'Group' and can? :update, project.owner}
can(:destroy, Project) {|project| owner? project}
can(:destroy, Project) {|project| project.owner_type == 'Group' and project.owner.actors.exists?(:actor_type => 'User', :actor_id => user.id, :role => 'admin')}
can :remove_user, Project
can [:read, :owned, :everything], BuildList, :user_id => user.id
can [:read, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :log, :everything], BuildList, read_relations_for('build_lists', 'projects')) {|build_list| can? :read, build_list.project}
can([:create, :update], BuildList) {|build_list| build_list.project.is_package && can?(:write, build_list.project)}
can(:publish, BuildList) do |build_list|
build_list.save_to_platform.released ? local_admin?(build_list.save_to_platform) : can?(:write, build_list.project)
build_list.can_publish? and build_list.save_to_repository.publish_without_qa ? can?(:write, build_list.project) : local_admin?(build_list.save_to_platform)
end
can(:reject_publish, BuildList) do |build_list|
build_list.save_to_platform.released and local_admin?(build_list.save_to_platform)
build_list.can_reject_publish? and not build_list.save_to_repository.publish_without_qa and local_admin?(build_list.save_to_platform)
end
can(:cancel, BuildList) {|build_list| can?(:write, build_list.project)}
can [:read], Advisory
can [:read, :members], Platform, :visibility => 'open'
can [:read, :owned, :related, :members], Platform, :owner_type => 'User', :owner_id => user.id
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
can([:update, :members], Platform) {|platform| local_admin? platform}
can([:destroy, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) }
can [:autocomplete_user_uname, :read_advisories, :advisories], Platform
can [:autocomplete_user_uname], Platform
can([:failed_builds_list, :create], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main? }
can(:cancel, MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && !mass_build.stop_build && mass_build.platform.main?}
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
can [:read, :projects_list], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
can [:read, :projects_list], Repository, :platform => {:owner_type => 'Group', :owner_id => user.group_ids}
can([:read, :projects_list], Repository, read_relations_for('repositories', 'platforms')) {|repository| local_reader? repository.platform}
can([:create, :update, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
can([:create, :edit, :update, :destroy, :projects_list, :add_project, :remove_project], Repository) {|repository| local_admin? repository.platform}
can([:remove_members, :remove_member, :add_member], Repository) {|repository| owner?(repository.platform) || local_admin?(repository.platform)}
can([:add_project, :remove_project], Repository) {|repository| repository.members.exists?(:id => user.id)}
can(:clear, Platform) {|platform| local_admin?(platform) && platform.personal?}
can([:change_visibility, :settings, :destroy], Repository) {|repository| owner? repository.platform}
can([:change_visibility, :settings, :destroy, :edit, :update], Repository) {|repository| owner? repository.platform}
can([:create, :destroy], KeyPair) {|key_pair| owner?(key_pair.repository.platform) || local_admin?(key_pair.repository.platform)}
can :read, Product, :platform => {:visibility => 'open'}
can :read, Product, :platform => {:owner_type => 'User', :owner_id => user.id, :platform_type => 'main'}
can :read, Product, :platform => {:owner_type => 'Group', :owner_id => user.group_ids, :platform_type => 'main'}
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
@ -115,18 +117,18 @@ class Ability
can :read, Issue, :project => {:owner_type => 'User', :owner_id => user.id}
can :read, Issue, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
can(:read, Issue, read_relations_for('issues', 'projects')) {|issue| can? :read, issue.project rescue nil}
can(:create, Issue) {|issue| can? :write, issue.project}
can(:create, Issue) {|issue| can? :read, issue.project}
can([:update, :destroy], Issue) {|issue| issue.user_id == user.id or local_admin?(issue.project)}
cannot :manage, Issue, :project => {:has_issues => false} # switch off issues
can(:create, Comment) {|comment| can? :read, comment.project}
can(:update, Comment) {|comment| comment.user_id == user.id or local_admin?(comment.project || comment.commentable.project)}
can(:update, Comment) {|comment| comment.user == user or comment.project.owner == user or local_admin?(comment.project)}
cannot :manage, Comment, :commentable_type => 'Issue', :commentable => {:project => {:has_issues => false}} # switch off issues
end
# Shared cannot rights for all users (registered, admin)
cannot :destroy, Platform, :platform_type => 'personal'
cannot [:create, :destroy, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
cannot [:create, :destroy, :edit, :update, :add_project, :remove_project], Repository, :platform => {:platform_type => 'personal'}
cannot :clear, Platform, :platform_type => 'main'
cannot :destroy, Issue

View File

@ -87,7 +87,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
else
kind = 'git_new_push_notification'
options = {:project_id => record.project.id, :project_name => record.project.name, :last_commits => last_commits, :branch_name => branch_name,
:change_type => change_type, :user_email => record.project.repo.repo.log(branch_name, nil).first.author.email,
:change_type => change_type, :user_email => record.project.repo.log(branch_name, nil).first.author.email,
:project_owner => record.project.owner.uname}
options.merge!({:user_id => first_commiter.id, :user_name => first_commiter.name}) if first_commiter
end

View File

@ -84,7 +84,7 @@ class BuildList < ActiveRecord::Base
scope :recent, order("#{table_name}.updated_at DESC")
scope :for_status, lambda {|status| where(:status => status) }
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform.id) }
scope :for_platform, lambda { |platform| where(:build_for_platform_id => platform) }
scope :by_mass_build, lambda { |mass_build| where(:mass_build_id => mass_build) }
scope :scoped_to_arch, lambda {|arch| where(:arch_id => arch) }
scope :scoped_to_save_platform, lambda {|pl_id| where(:save_to_platform_id => pl_id) }
@ -130,7 +130,11 @@ class BuildList < ActiveRecord::Base
end
end
after_transition :on => :published, :do => :set_version_and_tag
after_transition :on => :published, :do => [:set_version_and_tag, :actualize_packages]
after_transition :on => [:published, :fail_publish, :build_error], :do => :notify_users
after_transition :on => :build_success, :do => :notify_users,
:unless => lambda { |build_list| build_list.auto_publish? }
event :place_build do
transition :waiting_for_response => :build_pending, :if => lambda { |build_list|
@ -206,6 +210,19 @@ class BuildList < ActiveRecord::Base
save
end
def actualize_packages
ActiveRecord::Base.transaction do
old_pkgs = self.class.where(:project_id => self.project_id)
.where(:save_to_repository_id => self.save_to_repository_id)
.for_platform(self.build_for_platform_id)
.scoped_to_arch(self.arch_id)
.for_status(BUILD_PUBLISHED)
.recent.limit(2).last.packages # packages from previous build_list
old_pkgs.update_all(:actual => false)
self.packages.update_all(:actual => true)
end
end
#TODO: Share this checking on product owner.
def can_cancel?
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include?(status) && bs_id
@ -216,13 +233,13 @@ class BuildList < ActiveRecord::Base
end
def can_reject_publish?
can_publish? and save_to_platform.released
can_publish? and not save_to_repository.publish_without_qa
end
def add_to_queue
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority
@status ||= BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority
#XML-RPC params: project_name, project_version, plname, arch, bplname, update_type, build_requires, id_web, include_repos, priority, git_project_address
@status ||= BuildServer.add_build_list project.name, project_version, save_to_platform.name, arch.name, (save_to_platform_id == build_for_platform_id ? '' : build_for_platform.name), update_type, build_requires, id, include_repos, priority, project.git_project_address
end
def self.human_status(status)
@ -271,6 +288,10 @@ class BuildList < ActiveRecord::Base
I18n.t("layout.build_lists.human_duration", {:hours => (duration/3600).to_i, :minutes => (duration%3600/60).to_i})
end
def fs_log_path(log_type = :build)
container_path? ? "downloads/#{container_path}/log/#{project.name}/#{log_type.to_s}.log" : nil
end
def in_work?
status == BuildServer::BUILD_STARTED
#[WAITING_FOR_RESPONSE, BuildServer::BUILD_PENDING, BuildServer::BUILD_STARTED].include?(status)
@ -278,6 +299,22 @@ class BuildList < ActiveRecord::Base
protected
def notify_users
unless mass_build_id
users = []
if project # find associated users
users = project.all_members.
select{ |user| user.notifier.can_notify? && user.notifier.new_associated_build? }
end
if user.notifier.can_notify? && user.notifier.new_build?
users = users | [user]
end
users.each do |user|
UserMailer.build_list_notification(self, user).deliver
end
end
end # notify_users
def delete_container
if can_cancel?
BuildServer.delete_build_list bs_id

View File

@ -7,6 +7,18 @@ class BuildList::Package < ActiveRecord::Base
attr_accessible :fullname, :name, :release, :version
validates :build_list_id, :project_id, :platform_id, :fullname, :package_type, :name, :release, :version, :presence => true
validates :build_list_id, :project_id, :platform_id, :fullname,
:package_type, :name, :release, :version,
:presence => true
validates :package_type, :inclusion => PACKAGE_TYPES
# Fetches only actual (last publised) packages.
scope :actual, where(:actual => true)
scope :by_platform, lambda {|platform| where(:platform_id => platform) }
scope :by_name, lambda {|name| where(:name => name) }
scope :by_package_type, lambda {|type| where(:package_type => type) }
def assignee
project.maintainer
end
end

View File

@ -16,5 +16,6 @@ class BuildListObserver < ActiveRecord::Observer
end
end
end
end
end # before_update
end

View File

@ -45,8 +45,8 @@ class MassBuild < ActiveRecord::Base
end
def cancel_all
self.update_attribute(:stop_build, true)
self.build_lists.find_each(:batch_size => 100) do |bl|
update_column(:stop_build, true)
build_lists.find_each(:batch_size => 100) do |bl|
bl.cancel
end
end

View File

@ -28,13 +28,12 @@ class Platform < ActiveRecord::Base
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
before_destroy :xml_rpc_destroy
after_update :freeze_platform
after_update :freeze_platform_and_update_repos
after_update :update_owner_relation
after_create lambda { symlink_directory unless hidden? }
after_destroy lambda { remove_symlink_directory unless hidden? }
after_update :update_owner_relation
scope :search_order, order("CHAR_LENGTH(name) ASC")
scope :search, lambda {|q| where("name ILIKE ?", "%#{q.to_s.strip}%")}
scope :by_visibilities, lambda {|v| where(:visibility => v)}
@ -74,6 +73,14 @@ class Platform < ActiveRecord::Base
build_path(name)
end
def add_member(member, role = 'admin')
Relation.add_member(member, self, role)
end
def remove_member(member)
Relation.remove_member(member, self)
end
def symlink_path
Rails.root.join("public", "downloads", name)
end
@ -131,11 +138,11 @@ class Platform < ActiveRecord::Base
end
def change_visibility
if !self.hidden?
self.update_attribute(:visibility, 'hidden')
if !hidden?
update_attributes(:visibility => 'hidden')
remove_symlink_directory
else
self.update_attribute(:visibility, 'open')
update_attributes(:visibility => 'open')
symlink_directory
end
end
@ -230,10 +237,11 @@ class Platform < ActiveRecord::Base
end
later :xml_rpc_clone, :loner => true, :queue => :clone_build
def freeze_platform
def freeze_platform_and_update_repos
if released_changed? && released == true
result = BuildServer.freeze(name)
raise "Failed freeze platform #{name} with code #{result}" if result != BuildServer::SUCCESS
repositories.update_all(:publish_without_qa => false)
end
end
end

View File

@ -5,6 +5,7 @@ class Project < ActiveRecord::Base
NAME_REGEXP = /[a-zA-Z0-9_\-\+\.]+/
belongs_to :owner, :polymorphic => true, :counter_cache => :own_projects_count
belongs_to :maintainer, :class_name => "User"
has_many :issues, :dependent => :destroy
has_many :labels, :dependent => :destroy
@ -21,12 +22,15 @@ class Project < ActiveRecord::Base
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
has_and_belongs_to_many :advisories # should be without :dependent => :destroy
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false},
:presence => true,
:format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
validates :owner, :presence => true
validates :maintainer_id, :presence => true, :unless => :new_record?
validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES}
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki, :maintainer_id
attr_readonly :name, :owner_id, :owner_type
scope :recent, order("name ASC")
@ -35,9 +39,19 @@ class Project < ActiveRecord::Base
scope :by_name, lambda {|name| where('projects.name ILIKE ?', name)}
scope :by_visibilities, lambda {|v| where(:visibility => v)}
scope :opened, where(:visibility => 'open')
scope :addable_to_repository, lambda { |repository_id| where("projects.id NOT IN (SELECT project_to_repositories.project_id FROM project_to_repositories WHERE (project_to_repositories.repository_id = #{ repository_id }))") }
scope :package, where(:is_package => true)
scope :addable_to_repository, lambda { |repository_id| where %Q(
projects.id NOT IN (
SELECT
ptr.project_id
FROM
project_to_repositories AS ptr
WHERE (ptr.repository_id = #{ repository_id })
)
) }
after_create :attach_to_personal_repository
before_create :set_maintainer
after_save :attach_to_personal_repository
has_ancestry :orphan_strategy => :rootify #:adopt not available yet
@ -62,8 +76,12 @@ class Project < ActiveRecord::Base
name
end
def all_members
members | (owner_type == 'User' ? [owner] : owner.members)
end
def members
collaborators + groups.map(&:members).flatten
collaborators | groups.map(&:members).flatten
end
def platforms
@ -84,6 +102,13 @@ class Project < ActiveRecord::Base
owner == user
end
def git_project_address
#host ||= EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
#protocol ||= EventLog.current_controller.request.protocol rescue "http"
#Rails.application.routes.url_helpers.project_url(self.owner.uname, self.name, :host => host, :protocol => protocol) + ".git"
path
end
def build_for(platform, repository_id, user, arch = 'i586', auto_publish = false, mass_build_id = nil, priority = 0)
# Select main and project platform repository(contrib, non-free and etc)
# If main does not exist, will connect only project platform repository
@ -113,6 +138,8 @@ class Project < ActiveRecord::Base
c.parent_id = id
c.owner = new_owner
c.updated_at = nil; c.created_at = nil # :id = nil
# Hack to call protected method :)
c.send :set_maintainer
c.save
end
end
@ -121,6 +148,10 @@ class Project < ActiveRecord::Base
I18n.t("layout.projects.human_average_build_time", {:hours => (average_build_time/3600).to_i, :minutes => (average_build_time%3600/60).to_i})
end
def formatted_average_build_time
"%02d:%02d" % [average_build_time / 3600, average_build_time % 3600 / 60]
end
def xml_rpc_create(repository)
result = BuildServer.create_project name, repository.platform.name, repository.name, path
if result == BuildServer::SUCCESS
@ -142,6 +173,16 @@ class Project < ActiveRecord::Base
protected
def attach_to_personal_repository
repositories << self.owner.personal_repository if !repositories.exists?(:id => self.owner.personal_repository)
owner_rep = self.owner.personal_repository
if is_package
repositories << owner_rep unless repositories.exists?(:id => owner_rep)
else
repositories.delete owner_rep
end
end
def set_maintainer
self.maintainer_id = (owner_type == 'User') ? self.owner_id : self.owner.owner_id
end
end

View File

@ -1,16 +1,17 @@
# -*- encoding : utf-8 -*-
class RegisterRequest < ActiveRecord::Base
default_scope order('created_at ASC')
scope :rejected, where(:rejected => true)
scope :approved, where(:approved => true)
scope :unprocessed, where(:approved => false, :rejected => false)
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
# before_create :generate_token
before_update :invite_approve_notification
validates :email, :presence => true, :uniqueness => {:case_sensitive => false}, :format => { :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i }
def approve
update_attributes(:approved => true, :rejected => false)
end
@ -26,7 +27,7 @@ class RegisterRequest < ActiveRecord::Base
end
def invite_approve_notification
if approved_changed? and approved == true
if approved_changed? && approved?
generate_token
UserMailer.invite_approve_notification(self).deliver
end

View File

@ -10,9 +10,9 @@ class Relation < ActiveRecord::Base
before_validation :add_default_role
scope :by_user_through_groups, lambda {|u| where("actor_type = 'User' AND actor_id = ? OR actor_type = 'Group' AND actor_id IN (?)", u.id, u.group_ids)}
scope :by_actor, lambda {|obj| {:conditions => ['actor_id = ? AND actor_type = ?', obj.id, obj.class.to_s]}}
scope :by_target, lambda {|tar| {:conditions => ['target_id = ? AND target_type = ?', tar.id, tar.class.to_s]}}
scope :by_role, lambda {|role| {:conditions => ['role = ?', role]}}
scope :by_actor, lambda {|obj| where(:actor_id => obj.id, :actor_type => obj.class.to_s)}
scope :by_target, lambda {|tar| where(:target_id => tar.id, :target_type => tar.class.to_s)}
scope :by_role, lambda {|role| where(:role => role)}
def self.create_with_role(actor, target, role)
r = self.new
@ -22,6 +22,20 @@ class Relation < ActiveRecord::Base
r.save
end
def self.add_member(member, target, role)
if target.relations.exists?(:actor_id => member.id, :actor_type => member.class.to_s) || @platform.try(:owner) == member
true
else
rel = target.relations.build(:role => role)
rel.actor = member
rel.save
end
end
def self.remove_member(member, target)
Relation.by_actor(member).by_target(target).each{|r| r.destroy}
end
protected
def add_default_role

View File

@ -2,6 +2,11 @@
class Repository < ActiveRecord::Base
belongs_to :platform
has_many :relations, :as => :target, :dependent => :destroy
has_many :actors, :as => :target, :class_name => 'Relation', :dependent => :destroy
has_many :members, :through => :actors, :source => :actor, :source_type => 'User'
has_many :project_to_repositories, :dependent => :destroy, :validate => true
has_many :projects, :through => :project_to_repositories
has_one :key_pair, :dependent => :destroy
@ -14,7 +19,7 @@ class Repository < ActiveRecord::Base
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
before_destroy :xml_rpc_destroy, :unless => lambda {Thread.current[:skip]}
attr_accessible :name, :description
attr_accessible :name, :description, :publish_without_qa
attr_readonly :name, :platform_id
def base_clone(attrs = {})
@ -38,6 +43,14 @@ class Repository < ActiveRecord::Base
end
end
def add_member(member, role = 'admin')
Relation.add_member(member, self, role)
end
def remove_member(member)
Relation.remove_member(member, self)
end
class << self
def build_stub(platform)
rep = Repository.new

View File

@ -34,7 +34,7 @@ class Subscribe < ActiveRecord::Base
def self.set_subscribe_to_commit(options, status)
if subscribe = Subscribe.where(options).first
subscribe.update_attribute(:status, status)
subscribe.update_attributes(:status => status)
else
Subscribe.create(options.merge(:status => status))
end

View File

@ -52,6 +52,10 @@ class User < ActiveRecord::Base
scope :admin, where(:role => 'admin')
scope :real, where(:role => ['', nil])
scope :member_of_project, lambda {|item|
where "#{table_name}.id IN (?)", item.members.map(&:id).uniq
}
after_create lambda { self.create_notifier }
before_create :ensure_authentication_token

View File

@ -0,0 +1,43 @@
class MaintainerPresenter < ApplicationPresenter
attr_reader :package, :package_link, :package_name, :package_type,
:package_version, :package_release, :package_version_release,
:package_updated_at
attr_reader :maintainer, :maintainer_fullname, :maintainer_email,
:maintainer_link, :maintainer_mail_link
delegate :package_type, :to => :package
[:name, :version, :release, :updated_at].each do |meth|
define_method "package_#{meth}" do
@package.send meth
end
end
[:fullname, :email].each do |meth|
define_method "maintainer_#{meth}" do
@maintainer.send meth
end
end
def initialize(package, opts = {})
@package = package
@maintainer = package.try(:assignee)
end
def package_link
link_to @package.name, @package.project
end
def package_version_release
"#{@package.version}-#{@package.release}"
end
def maintainer_link
link_to @maintainer.fullname, @maintainer
end
def maintainer_email_link
mail_to @maintainer.email, @maintainer.email, :encode => "javascript"
end
end

View File

@ -1,4 +1,4 @@
%table#myTable.tablesorter.advisories{:cellspacing => "0", :cellpadding => "0"}
%table#myTable.tablesorter.advisories.static-search{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.th1= t("activerecord.attributes.advisory.advisory_id")

View File

@ -3,7 +3,7 @@
%h3= @group.name
%h4= t("activerecord.attributes.group.description") + ":"
%p= @group.description
%h4= t("layout.groups.projects_list") + ":"
%h4= t("layout.groups.public_projects_list") + ":"
%p
- @projects.each do |project|
= link_to project.name, project

View File

@ -34,6 +34,7 @@
.a= link_to t('layout.logout'), destroy_user_session_path, :method => :delete
- else
.user
.profile= link_to t("layout.devise.shared_links.sign_up"), new_register_request_path
.profile= link_to t("layout.devise.shared_links.sign_in"), new_user_session_path
.right
.both

View File

@ -10,13 +10,16 @@
= link_to t("layout.platforms.about"), platform_path(@platform)
%li{:class => (contr == :repositories) ? 'active' : ''}
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
- if can? :show, @platform
%li{:class => (act == :index && contr == :maintainers) ? 'active' : nil}
= link_to t("layout.platforms.maintainers"), platform_maintainers_path(@platform)
- if can? :edit, @platform
%li{:class => (contr == :mass_builds && [:index, :create].include?(act)) ? 'active' : ''}
= link_to t("layout.platforms.mass_build"), platform_mass_builds_path(@platform)
- if can? :read, @platform.products.build
%li{:class => (contr == :products) ? 'active' : ''}
= link_to t("layout.products.list_header"), platform_products_path(@platform)
- if can? :read_advisories, @platform
- if can? :advisories, @platform
%li{:class => (contr == :platforms and act == :advisories) ? 'active' : ''}
= link_to t("layout.advisories.list_header"), advisories_platform_path(@platform)
- if can? :update, @platform

View File

@ -0,0 +1,25 @@
%table#myTable.tablesorter.platform-maintainers.static-search{:cellspacing => "0", :cellpadding => "0"}
%thead
%tr
%th.centered= t("activerecord.attributes.maintainer.package_name")
%th.centered= t("activerecord.attributes.maintainer.package_type")
%th.centered= t("activerecord.attributes.maintainer.version")
%th.centered{:colspan => 2}= t("activerecord.models.maintainer")
%th.centered= t("activerecord.attributes.maintainer.updated_at")
%tr.search
-# TODO: change filter to Backbone.js
%th{:colspan => 6, :rowspan => 1}
= form_tag platform_maintainers_path(@platform), :method => :get do |f|
= text_field_tag('q', params[:q], :placeholder => t("layout.maintainers.search_by_package"), :class => params[:q].present? ? 'black' : 'gray')
%input{:type => 'submit', :value => t("layout.search.header")}
= button_to t('layout.clear'), {:action => :index} , :method => :get
%tbody
- MaintainerPresenter.present_collection(@maintainers) do |pr|
%tr{:class => cycle("odd", "even")}
%td= pr.package_link
%td= pr.package_type
%td= pr.package_version_release
%td= pr.maintainer_link
%td= pr.maintainer_email_link.html_safe
%td= pr.package_updated_at

View File

@ -0,0 +1 @@
doHandleAbfAssignee(<%= @ret.to_json.html_safe %>);

View File

@ -0,0 +1,7 @@
-set_meta_tags :title => [title_object(@platform), t('layout.maintainers.list_header')]
-# FIXME: no these 'base' links!
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= render :partial => 'list', :object => @maintainers
= will_paginate @maintainers

View File

@ -2,42 +2,9 @@
= render 'submenu'
= render 'sidebar'
= form_tag remove_members_platform_path(@platform), :id => 'members_form', :method => :post do
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
- if can? :remove_members, @platform
%th
\ 
%th
= t("layout.collaborators.members")
- if can? :remove_member, @platform
%th.buttons
= t("layout.remove")
%tbody
- @members.select{|u| u != @platform.owner}.each_with_index do |user, num|
%tr{:id => "admin-table-members-row#{num}", :class => cycle(:odd, :even)}
- if can? :remove_members, @platform
%td
%span.niceCheck-main{:id => "niceCheckbox#{num}", :style => "background-position: 0px 0px; "}
= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.forimg= link_to user.fullname, user_path(user)
- if can? :remove_member, @platform
%td.buttons
= link_to remove_member_platform_path(@platform, :member_id => user.id), :method => :delete, :confirm => t("layout.confirm") do
%span.delete &nbsp;
- if can? :remove_memvers, @platforms
= submit_tag t("layout.delete"), :class => 'button'
.both
- if can? :add_member, @platform
.hr.top
= form_tag add_member_platform_path(@platform) do
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_users_path, :id_element => '#member_id_field'
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both
= render "shared/members_table",
:remove_members_path => remove_members_platform_path(@platform),
:remove_member_path => remove_member_platform_path(@platform),
:add_member_path => add_member_platform_path(@platform),
:members => @members.select{|u| u != @platform.owner},
:editable_object => @platform

View File

@ -1,9 +1,13 @@
.leftlist= f.label :name, t("activerecord.attributes.repository.name"), :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
- unless ['edit', 'update'].include? controller.action_name
.leftlist= f.label :name, t("activerecord.attributes.repository.name"), :class => :label
.rightlist= f.text_field :name, :class => 'text_field'
.leftlist= f.label :description, t("activerecord.attributes.repository.description"), :class => :label
.rightlist= f.text_field :description, :class => 'text_field'
.leftlist= f.label :publish_without_qa, t("activerecord.attributes.repository.publish_without_qa"), :class => :label
.rightlist= f.check_box :publish_without_qa, :class => 'check_box'
.both
.button_block

View File

@ -3,7 +3,7 @@
%tr
%th.th1= t("activerecord.attributes.repository.name")
%th.th2= t("layout.repositories.projects")
%th= t("layout.delete")
%th= t("activerecord.attributes.repository.publish_without_qa")
%tbody
- @repositories.each do |repository|
%tr{:class => cycle("odd", "even")}
@ -11,7 +11,5 @@
= link_to repository.name, platform_repository_path(@platform, repository)
%td
= repository.projects.count
%td.buttons
- if can? :destroy, repository
= link_to platform_repository_path(@platform, repository), :method => :delete, :confirm => t("layout.repositories.confirm_delete") do
%span.delete &nbsp;
%td
= repository.publish_without_qa

View File

@ -0,0 +1,16 @@
-set_meta_tags :title => [title_object(@repository), t('layout.repositories.edit')]
= render 'submenu'
= render 'sidebar'
%h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}"
= form_for @repository, :url => platform_repository_path(@platform, @repository), :html => { :class => :form } do |f|
= render "form", :f => f
%br
= render "shared/members_table",
:remove_members_path => remove_members_platform_repository_path(@platform, @repository),
:remove_member_path => remove_member_platform_repository_path(@platform, @repository),
:add_member_path => add_member_platform_repository_path(@platform, @repository),
:members => @members,
:editable_object => @repository

View File

@ -2,10 +2,15 @@
= render 'submenu'
= render 'sidebar'
%h3.fix= "#{t("layout.repositories.about")}: #{@repository.name}"
%h3 #{t("layout.repositories.about")} #{@repository.name}
%p= @repository.description
.buttons_block
- if can? :update, @repository
= link_to image_tag("code.png", :alt => t("layout.edit")) + " " + t("layout.edit"), edit_platform_repository_path(@platform, @repository), :class => "button"
- if can? :destroy, @repository
= link_to image_tag("x.png", :alt => t("layout.delete")) + " " + t("layout.delete"), platform_repository_path(@platform, @repository), :method => "delete", :class => "button", :confirm => t("layout.repositories.confirm_delete")
%br
%br
%h3.fix= t("layout.projects.list_header")

View File

@ -6,8 +6,9 @@
=image_tag 'zip.png', :alt => 'ZIP'
%b.caret
%ul.dropdown-menu
%li=link_to "tar.gz", archive_path(project, @treeish, 'tar')
%li=link_to "zip", archive_path(project, @treeish, 'zip')
- file_name = "#{@project.owner.uname}-#{@project.name}-#{@commit.id}"
%li=link_to "tar.gz", archive_path(project, file_name, 'tar.gz')
%li=link_to "zip", archive_path(project, file_name, 'zip')
= text_field_tag :url, git_repo_url(project.git_repo_name), :class => 'name', :spellcheck => 'false', :readonly => true
.git_help ?

View File

@ -1,8 +1,20 @@
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
%td= build_list.human_status
%td
= build_list.human_status
%br
- if BuildList::HUMAN_STATUSES[build_list.status].in? [:build_pending, :build_started, :build_publish]
%time.js-relative-date{:datetime => build_list.updated_at.strftime("%FT%T%:z"), :title => build_list.updated_at.strftime("%F %T")}
= build_list.updated_at.strftime "%F %T"
- if build_list.build_started? && ((build_list.project.average_build_time || 0) > 0)
\/
%time
= build_list.project.formatted_average_build_time
- if build_list.project.present?
%td= link_to build_list.project.name_with_owner, build_list.project
%td= build_list_version_link(build_list)
- else
%td.centered{:colspan => 2}= t("layout.projects.unexisted_project")
%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= build_list.arch.try(:name) || t("layout.arches.unexisted_arch")
%td= link_to build_list.user.try(:fullname), build_list.user

View File

@ -1,4 +1,4 @@
- platform.repositories.each do |repo|
.both
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :save_to_platform_id => platform.id, :rep_name => repo.name
= check_box_tag "build_list[include_repos][]", repo.id, repo.name == 'main' || @project.repositories.map(&:id).include?(repo.id), :id => "include_repos_#{repo.id}", :rep_name => repo.name
= label_tag "include_repos_#{repo.id}", repo.name

View File

@ -0,0 +1,148 @@
.hr
%a{:name => 'log'}
.log-wrapper
.log-header
.text-wrap
= link_to({:anchor => :log}, {:id => 'log_anchor'}) do
%h3= t("layout.build_lists.log.build_log")
%span
.both
.log-body.hidden
.reloader
%table.options
%tr.top
%td.first
= label_tag :word_wrap do
= check_box_tag :word_wrap
= t("layout.word_wrap")
%td.last{ :class => @build_list.build_started? ? nil : :hidden }
= label_tag :autoreload do
= check_box_tag :autoreload, true, @build_list.build_started?
= t("layout.build_lists.log.autoreload")
= select_tag :reload_interval, log_reload_time_options
%tr.bottom
%td.first
= link_to t("layout.build_lists.log.download"), build_list_log_url(:build), :id => :log_url
%td.last{ :class => @build_list.build_started? ? nil : :hidden }
= label_tag :load_lines do
= raw t("layout.build_lists.log.load_lines", :count => select_tag(:load_lines, log_reload_lines_options))
.both
%textarea.log{ :readonly => :readonly, :wrap => 'off',
:data => { :url => log_build_list_path(@build_list), :log_type => :build } }
= t("layout.build_lists.log.not_available")
:javascript
$(function() {
(function() {
var $wrapper = $('div.log-wrapper');
var $logBody = $wrapper.children('div.log-body').first();
var $logCont = $logBody.children('.log').first();
var logUrl = $logCont.data('url');
var $logHead = $wrapper.children('div.log-header').first();
var $trigger = $logHead.children('span').first();
var $autoload = $('#autoreload');
var state = $logBody.is(':visible');
var t = null; // timer
var first_open = true;
if (state) {
$trigger.removeClass('closed');
$wrapper.removeClass('inactive')
.addClass('active');
} else {
$trigger.addClass('closed');
$logBody.addClass('hidden');
$wrapper.removeClass('active')
.addClass('inactive');
}
function getLineHeight(element){
var temp = document.createElement(element.nodeName);
temp.setAttribute("style","margin:0px;padding:0px;font-family:"+element.style.fontFamily+";font-size:"+element.style.fontSize);
temp.innerHTML = "test";
temp = element.parentNode.appendChild(temp);
var ret = temp.clientHeight;
temp.parentNode.removeChild(temp);
return ret;
}
var loadLog = function() {
$.ajax({
url: logUrl,
type: "GET",
dataType: 'json',
data: $logCont.data(),
beforeSend: function( xhr ) {
var token = $('meta[name="csrf-token"]').attr('content');
if (token) xhr.setRequestHeader('X-CSRF-Token', token);
},
success: function(data, textStatus, jqXHR) {
var l = $logCont[0];
var vScroll = l.scrollTop;
var hScroll = l.scrollLeft;
var onBottom = Math.abs((l.clientHeight + vScroll - l.scrollHeight)) < getLineHeight(l);
$logCont.text(data.log);
$logCont.scrollLeft(hScroll);
$logCont.scrollTop((onBottom || first_open) ? l.scrollHeight - l.clientHeight : vScroll);
first_open = false;
if (!data.building) $autoload.attr({'checked': false}).trigger('change');
}
});
}
var reloadChange = function() {
if ($(this).is(':checked')) {
first_open = true;
loadLog();
$logCont.scrollTop($logCont[0].scrollHeight - $logCont[0].clientHeight);
t = setInterval(function() {
loadLog();
}, $('#reload_interval').val());
} else {
clearInterval(t);
}
}
var toggleHandler = function() {
state = !state;
// if log opened
if (state) {
if ($autoload.is(':checked')) {
$autoload.trigger('change');
}
} else {
clearInterval(t);
}
$logBody.slideToggle('slow')
.toggleClass('hidden');
$logHead.toggleClass('active inactive');
$trigger.toggleClass('closed');
window.location.href = $('a#log_anchor').attr('href');
}
$wrapper.on('click', '.log-header > span', toggleHandler);
$autoload.on('change', reloadChange);
$('#word_wrap').on('change', function() {
$logCont.attr({'wrap': ($(this).is(':checked')) ? 'soft' : 'off'});
});
$('#reload_interval').on('change', function() {
clearInterval(t);
if ($autoload.is(':checked')) {
t = setInterval($(this).val());
}
});
$('#load_lines').on('change', function() {
$logCont.data('load_lines', $(this).val());
}).trigger('change');
loadLog();
})();
});

View File

@ -1,5 +1,11 @@
-set_meta_tags :title => t('.title')
/ #myTable
%div.reloader
= label_tag :autoreload do
= check_box_tag :autoreload, true, true
= t("layout.autoreload_page")
.both
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
@ -13,7 +19,58 @@
%tbody= render :partial => 'projects/build_lists/build_list', :collection => @build_lists
.both
= will_paginate @build_lists
:javascript
$(function(){
// from jQuery.timeago
var parseIso8601 = function(iso8601) {
var s = $.trim(iso8601);
s = s.replace(/\.\d+/,""); // remove milliseconds
s = s.replace(/-/,"/").replace(/-/,"/");
s = s.replace(/T/," ").replace(/Z/," UTC");
s = s.replace(/([\+\-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400
return new Date(s);
}
var strTimeBetween = function(dt, dt1) {
var formatNumber = function(num) {
return (num < 10) ? "0%d".replace("%d", num) : num
}
var seconds = Math.abs(dt1 - dt) / 1000;
var minutes = seconds / 60;
var hours = minutes / 60;
minutes = Math.round(minutes % 60);
hours = Math.floor(hours);
return "%d:%d".replace("%d", formatNumber(hours))
.replace("%d", formatNumber(minutes));
}
// TODO Very, very ugly method.
var now = (new Date).getTime();
$("time.js-relative-date").each(function() {
var time = parseIso8601($(this).attr('datetime')).getTime();
$(this).text(strTimeBetween(time, now));
});
var t = null;
var reloadChange = function() {
if ($(this).is(':checked')) {
//reload page every 1 minute
t = setTimeout(function() {
window.location.reload();
}, 60000);
} else {
clearTimeout(t);
}
}
$('#autoreload').on('change', reloadChange)
.trigger('change');
});
= will_paginate @bls
= render 'filter'
= render @project ? 'projects/base/submenu' : 'projects/build_lists/submenu'

View File

@ -6,12 +6,13 @@
- Platform.main.each do |pl|
- if pl.repository_ids.size > 0
.both
= check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}", :'data-released' => pl.released ? 1 : 0
= label_tag "bpls_#{pl.id}", pl.name
.offset25{:style => 'padding-left: 25px'}= render 'include_repos', :platform => pl
=# check_box_tag "build_for_platforms[]", pl.id, (params[:build_for_platforms]||[]).include?(pl.id.to_s), :class => 'build_bpl_ids', :id => "bpls_#{pl.id}"
=# label_tag "bpls_#{pl.id}", pl.name
%div{:id => "build_for_pl_#{pl.id}", :class => 'build_for_pl'}= pl.name
.offset25= render 'include_repos', :platform => pl
%section.right
%h3= t("activerecord.attributes.build_list.save_to_platform")
.lineForm= f.select :save_to_platform_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.platform.id]}
%h3= t("activerecord.attributes.build_list.save_to_repository")
.lineForm= f.select :save_to_repository_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.id, {:publish_without_qa => r.publish_without_qa? ? 1 : 0, :platform_id => r.platform.id}]}
%h3= t("activerecord.attributes.build_list.project_version")
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || "latest_" + @project.default_branch
%h3= t("activerecord.attributes.build_list.arch")

View File

@ -13,7 +13,6 @@
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
.both
@ -125,8 +124,15 @@
var r = new Rosa.Routers.BuildListsAdvisoriesRouter();
});
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if @build_list.can_publish? && can?(:publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish' if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
- if BuildList::HUMAN_STATUSES[@build_list.status].in? [:build_started, :build_error, :success]
= render :partial => 'projects/build_lists/log'
- if (can_publish = @build_list.can_publish? && can?(:publish, @build_list))
.hr
= submit_tag t("layout.publish"), :confirm => t("layout.confirm"), :name => 'publish' if can_publish
- if @build_list.can_reject_publish? && can?(:reject_publish, @build_list)
= submit_tag t("layout.reject_publish"), :confirm => t("layout.confirm"), :name => 'reject_publish'
.hr
%h3= t("layout.build_lists.items_header")

View File

@ -30,7 +30,7 @@
%h3= t("layout.projects.git_global_setup")
%p
%code
= "git config --global user.name #{current_user.fullname}"
= "git config --global user.name '#{current_user.fullname}'"
%br/
= "git config --global user.email #{current_user.email}"
%br/

View File

@ -3,10 +3,10 @@
#labels-stock
=form_tag project_issues_path(@project), :id => 'filter_labels', :method => :get do
- @project.labels.each_with_index do |label, index|
.div-tracker-labels{:id => "label-#{label.name}", :style => @labels.include?(label.name) ? "background-color:##{label.color};color:#FFF" : ''}
.div-tracker-labels{:id => "label-#{label.name.parameterize}", :style => @labels.include?(label.name) ? "background-color:##{label.color};color:#FFF" : ''}
.div-label-left
.label
.flag{:id => "flag-#{label.name}", :style => "background-color: ##{label.color};"}
.flag{:id => "flag-#{label.name.parameterize}", :style => "background-color: ##{label.color};"}
.labeltext=label.name
=check_box_tag 'labels[]', label.name, @labels.include?(label.name), :style => 'display:none'
.both

View File

@ -27,7 +27,7 @@
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
.name=@issue.assignee.fullname
.both
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
=link_to(t('layout.issues.assignee_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
- if can_manage
=form_tag search_collaborators_project_issues_path(@project), :id => 'search_user', :method => :get, :style => @issue.persisted? ? 'display:none' : '' do
=tracker_search_field(:search_user, t('layout.issues.search_user'))
@ -47,6 +47,7 @@
.both=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_labels issue'} do |f|
.manage_labels
=hidden_field_tag "update_labels", true
- @issue.labels.each do |label|
=hidden_field_tag "flag#{label.id}", label.id, :name => "issue[labelings_attributes][#{label.id}][label_id]"
- else

View File

@ -14,7 +14,7 @@
%span.date=@issue.created_at.to_s(:long)
%br/
.both
.fulltext.view.issue_body=@issue.body
.fulltext.view.issue_body=simple_format @issue.body
.both
%br
- if can? :update, @issue

View File

@ -6,14 +6,12 @@
.leftlist= f.label :description, t("activerecord.attributes.project.description"), :class => :label
.rightlist= f.text_area :description, :class => 'text_field', :cols => 80
.both
- if ['new', 'create'].include? controller.action_name
- if [:new, :create].include? act
.leftlist= f.label :owner_id, t("activerecord.attributes.project.owner"), :class => :label
.rightlist
= label_tag t("activerecord.attributes.project.who_owns.me")
- if Group.can_own_project(current_user).count > 0
= radio_button_tag :who_owns, 'me', @who_owns == :me #{}.merge( (@who_owns == :me) ? {:checked => 'checked'} : {} )
- puts @who_owns.inspect
- puts @who_owns == :group
= label_tag t("activerecord.attributes.project.who_owns.group")
= radio_button_tag :who_owns, 'group', @who_owns == :group #{}.merge( (@who_owns == :group) ? {:checked => 'checked'} : {} )
-# TODO: Make our own select_box helper with new design, blackjack and bitches!
@ -33,19 +31,33 @@
= image_tag("lock.png")
= t("activerecord.attributes.project.visibilities.#{visibility}")
.both
- if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch")
.rightlist= f.select :default_branch, options_from_collection_for_select(@project.repo.branches, :name, :name, @project.default_branch), :class => 'sel80', :id => 'branch_selector'
.both
- if [:edit, :update].include? act
.leftlist
.leftlist
\ 
.rightlist
.rightlist
.check
%span#niceCheckbox1.niceCheck-main= f.check_box :is_package#, :class => 'niceCheckbox1'
.forcheck= t("activerecord.attributes.project.is_package")
.both
.both
- if [:edit, :update].include? act
.leftlist= t("activerecord.attributes.project.default_branch")
.rightlist
= f.select :default_branch,
options_from_collection_for_select( @project.repo.branches,
:name, :name, @project.default_branch),
:class => 'sel80', :id => 'branch_selector'
.both
#maintainer_form{:class => @project.is_package ? '' : 'hidden'}
= f.hidden_field :maintainer_id, :value => @project.maintainer_id
.leftlist
= t("activerecord.attributes.project.maintainer")
.rightlist
-# TODO: Maybe use something like Chosen with filter and prepopulated
-# list of potential maintainers?
= autocomplete_field_tag :maintainer_name, @project.maintainer.fullname,
autocomplete_maintainers_path(@project.owner, @project),
:id_element => '#project_maintainer_id',
:placeholder => @project.maintainer.fullname
- if [:new, :create].include? act
.leftlist= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
.rightlist= f.file_field :srpm, :class => 'file_field'
@ -54,3 +66,7 @@
\ 
.rightlist= submit_tag t("layout.save"), :class => 'button'
.both
:javascript
$(function() {
( new Rosa.Views.ProjectModifyView ).render();
});

View File

@ -0,0 +1,39 @@
= form_tag remove_members_path, :id => 'members_form', :method => :post do
%table.tablesorter{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
- if can? :remove_members, editable_object
%th
\ 
%th
= t("layout.collaborators.members")
- if can? :remove_member, editable_object
%th.buttons
= t("layout.remove")
%tbody
- members.each_with_index do |user, num|
%tr{:id => "admin-table-members-row#{num}", :class => cycle(:odd, :even)}
- if can? :remove_members, editable_object
%td
%span.niceCheck-main{:id => "niceCheckbox#{num}", :style => "background-position: 0px 0px; "}
= check_box_tag "user_remove[#{user.id}][]"
%td
.img
= image_tag avatar_url(user)
.forimg= link_to user.fullname, user_path(user)
- if can? :remove_member, editable_object
%td.buttons
= link_to "#{remove_member_path}?member_id=#{user.id}", :method => :delete, :confirm => t("layout.confirm") do
%span.delete &nbsp;
- if can? :remove_memvers, editable_object
= submit_tag t("layout.delete"), :class => 'button'
.both
- if can? :add_member, editable_object
.hr.top
= form_tag add_member_path do
.admin-search
= autocomplete_field_tag 'member_id', params[:member_id], autocomplete_user_uname_users_path, :id_element => '#member_id_field'
= hidden_field_tag 'member_id', nil, :id => 'member_id_field'
= submit_tag t("layout.add"), :class => 'button'
.both

View File

@ -0,0 +1,15 @@
%p
Build project
- if @build_list.project
= link_to @build_list.project.name_with_owner, project_url(@build_list.project)
- else
= t("layout.projects.unexisted_project")
completed with status
= @build_list.human_status
for arch
= "#{@build_list.arch.name}."
%p
More detailed information you can get by link:
= link_to "task [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
%p== Support team «ROSA Build System»

View File

@ -0,0 +1,15 @@
%p
Сборка проекта
- if @build_list.project
= link_to @build_list.project.name_with_owner, project_url(@build_list.project)
- else
= t("layout.projects.unexisted_project")
завершена со статусом
= @build_list.human_status
для архитектуры
= "#{@build_list.arch.name}."
%p
Более подробную информацию можно получить по ссылке:
= link_to "задание [№ #{@build_list.bs_id ? @build_list.bs_id : t("layout.build_lists.bs_id_not_set")}]", build_list_url(@build_list)
%p== Команда поддержки «ROSA Build System»

View File

@ -0,0 +1,7 @@
%p== Hello, #{@register_request.name || @register_request.email}.
%p
You have been invited to project ABF. Please click on the following
= link_to 'link for registration', new_user_registration_url(:invitation_token => @register_request.token)
%p== Support team «ROSA Build System»

View File

@ -1,7 +0,0 @@
%p== Здравствуйте, #{@register_request.name || @register_request.email}.
%p
Вы приглашены в проект ABF. Чтобы зарегистрироваться перейдите по
= link_to 'ссылке', new_user_registration_url(:invitation_token => @register_request.token)
%p== Команда поддержки «ROSA Build System»

View File

@ -0,0 +1,7 @@
%p== Здравствуйте, #{@register_request.name || @register_request.email}.
%p
Вы приглашены в проект ABF. Пожалуйста, перейдите по
= link_to 'ссылке для регистрации', new_user_registration_url(:invitation_token => @register_request.token)
%p== Команда поддержки «ROSA Build System»

View File

@ -6,13 +6,13 @@
%h3= title @user.uname
= @user.name
%br
= link_to @user.email, "mailto:#{@user.email}"
= mail_to @user.email, @user.email, :encode => "javascript"
%br
%h4= t("activerecord.attributes.user.professional_experience") + ":"
%p= @user.professional_experience
%h4= t("layout.users.public_projects_list") + ":"
%p
- @user.projects.by_visibilities(['open']).each do |project|
- @projects.each do |project|
= link_to project.name, project
%br

View File

@ -0,0 +1,3 @@
.leftside.w25= f.check_box field
.leftside= f.label field, t("activerecord.attributes.settings.notifier.#{field}")
.both

View File

@ -7,32 +7,16 @@
%br
= form_for @user.notifier, :url => notifiers_settings_path, :html => {:class => :form} do |f|
.leftside.w25= f.check_box :can_notify
.leftside= f.label :can_notify, t('activerecord.attributes.settings.notifier.can_notify')
.both
= render 'notifier', :f => f, :field => :can_notify
%h3= t("layout.settings.notifiers.code_header")
.leftside.w25= f.check_box :new_comment_commit_owner, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_owner')
.both
.leftside.w25= f.check_box :new_comment_commit_repo_owner, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_repo_owner, t('activerecord.attributes.settings.notifier.new_comment_commit_repo_owner')
.both
.leftside.w25= f.check_box :new_comment_commit_commentor, :class => 'notify_cbx'
.leftside= f.label :new_comment_commit_commentor, t('activerecord.attributes.settings.notifier.new_comment_commit_commentor')
.both
- [:new_comment_commit_owner, :new_comment_commit_repo_owner, :new_comment_commit_commentor].each do |field|
= render 'notifier', :f => f, :field => field
%h3= t("layout.settings.notifiers.tracker_header")
.leftside.w25= f.check_box :new_comment, :class => 'notify_cbx'
.leftside= f.label :new_comment, t('activerecord.attributes.settings.notifier.new_comment')
.both
.leftside.w25= f.check_box :new_comment_reply, :class => 'notify_cbx'
.leftside= f.label :new_comment_reply, t('activerecord.attributes.settings.notifier.new_comment_reply')
.both
.leftside.w25= f.check_box :new_issue, :class => 'notify_cbx'
.leftside= f.label :new_issue, t('activerecord.attributes.settings.notifier.new_issue')
.both
.leftside.w25= f.check_box :issue_assign, :class => 'notify_cbx'
.leftside= f.label :issue_assign, t('activerecord.attributes.settings.notifier.issue_assign')
.both
- [:new_comment, :new_comment_reply, :new_issue, :issue_assign].each do |field|
= render 'notifier', :f => f, :field => field
%h3= t("layout.settings.notifiers.build_list_header")
- [:new_build, :new_associated_build].each do |field|
= render 'notifier', :f => f, :field => field
%br
.leftside.w25

View File

@ -55,7 +55,7 @@ namespace :deploy do
run "ln -nfs #{fetch :shared_path}/config/database.yml #{fetch :release_path}/config/database.yml"
# Setup application
run "cp -n #{fetch :release_path}/config/deploy/application.#{fetch :stage}.yml #{fetch :shared_path}/config/application.yml"
run "cp -n #{fetch :release_path}/config/application.yml.sample #{fetch :shared_path}/config/application.yml"
run "ln -nfs #{fetch :shared_path}/config/application.yml #{fetch :release_path}/config/application.yml"
# It will survive downloads folder between deployments
@ -101,3 +101,33 @@ namespace :rake_tasks do
mirror_rake_tasks 'db:seeds'
end
end
namespace :update do
desc "Copy remote production shared files to localhost"
task :shared do
run_locally "rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{shared_path}/shared_contents/uploads public/uploads"
end
desc "Dump remote production postgresql database, rsync to localhost"
task :postgresql do
get("#{current_path}/config/database.yml", "tmp/database.yml")
remote_settings = YAML::load_file("tmp/database.yml")[rails_env]
local_settings = YAML::load_file("config/database.yml")["development"]
run "export PGPASSWORD=#{remote_settings["password"]} && pg_dump --host=#{remote_settings["host"]} --port=#{remote_settings["port"]} --username #{remote_settings["username"]} --file #{current_path}/tmp/#{remote_settings["database"]}_dump -Fc #{remote_settings["database"]}"
run_locally "rsync --recursive --times --rsh=ssh --compress --human-readable --progress #{user}@#{domain}:#{current_path}/tmp/#{remote_settings["database"]}_dump tmp/"
run_locally "dropdb -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} #{local_settings["database"]}"
run_locally "createdb -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} -T template0 #{local_settings["database"]}"
run_locally "pg_restore -U #{local_settings["username"]} --host=#{local_settings["host"]} --port=#{local_settings["port"]} -d #{local_settings["database"]} tmp/#{remote_settings["database"]}_dump"
end
desc "Dump all remote data to localhost"
task :all do
# update.shared
update.postgresql
end
end

View File

@ -1,16 +0,0 @@
production:
action_mailer_host: "abf.rosalinux.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@rosalinux.ru
project_name: ABF
repo_project_name: ABF
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.144
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc
distr_types: ['mdv']

View File

@ -1,23 +0,0 @@
common: &common
project_name: ABF
repo_project_name: ABF
distr_types: ['mdv', 'nau5', 'suse', 'deb']
wiki_formats:
markdown: "Markdown"
textile: "Textile"
org: "Org-mode"
production:
<<: *common
action_mailer_host: "school.rosalab.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@school.rosalab.ru
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.19
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc

View File

@ -1,16 +0,0 @@
production:
action_mailer_host: "dev-abf.rosalinux.ru"
root_path: /share
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
do-not-reply-email: do-not-reply@dev-abf.rosalinux.ru
project_name: ABF
repo_project_name: ABF
build_server_ip: 127.0.0.1
build_server_port: 12555
build_server_path: /xmlrpc
product_builder_ip:
mdv: 192.168.122.19
nau5: 192.168.122.203
product_builder_port: 12554
product_builder_path: /xmlrpc
distr_types: ['mdv', 'nau5']

View File

@ -57,6 +57,7 @@ en:
change_email_link: Change email address
code_header: Code
tracker_header: Tracker
build_list_header: Build List
devise:
shared_links:
@ -167,7 +168,6 @@ en:
can_have_less_or_equal: You cannot have more than %{count} projects.
models:
arch: Arch
private_user: Private user
product_build_list: Product build list
@ -182,13 +182,9 @@ en:
new_comment_commit_owner: Notify about comments to my commit
new_comment_commit_repo_owner: Notify about comments to my repository commits
new_comment_commit_commentor: Notify about comments after my commit
new_build: Notify about my build tasks
new_associated_build: Notify about associated with me build tasks
private_user:
login: Login
password: Password
arch:
name: Name
created_at: Created
updated_at: Updated

View File

@ -1,5 +1,8 @@
en:
layout:
autoreload_page: Update page automatically
autoreload_log: Update log every
word_wrap: Word wrap
read_more: Read more
turned_on: on
turned_off: off

View File

@ -1,5 +1,8 @@
ru:
layout:
autoreload_page: Автоматически обновлять страницу
word_wrap: Перенос строк
autoreload_log: Обновлять лог каждые
read_more: Читать дальше
turned_on: включены
turned_off: выключены

View File

@ -18,6 +18,7 @@ en:
new_user_notification: Registered on project «%{ project_name }»
issue_assign_notification: New task assigned
invite_approve_notification: Invitation to ABF
for_arch: for arch %{arch}.
bodies:
new_comment_notification:

View File

@ -18,7 +18,7 @@ ru:
new_user_notification: Регистрация на проекте «%{ project_name }»
issue_assign_notification: Вам назначили задачу
invite_approve_notification: Приглашение в ABF
build_task: Сборочное задание
for_arch: для архитектуры %{arch}.
bodies:
new_comment_notification:

View File

@ -0,0 +1,16 @@
en:
layout:
arches:
unexisted_arch: Unexisted arch
flash:
arches:
activerecord:
models:
arch: Arch
attributes:
arch:
name: Name
created_at: Created
updated_at: Updated

View File

@ -0,0 +1,16 @@
ru:
layout:
arches:
unexisted_arch: Несуществующая архитектура
flash:
arches:
activerecord:
models:
arch: Архитектура
attributes:
arch:
name: Название
created_at: Создана
updated_at: Обновлена

View File

@ -18,8 +18,7 @@ en:
additional_repos: Additional repositories
include_repos: Included repositories
created_at: Created on
save_to_platform: Platform
save_to_repository: Repository
save_to_repository: Save to repository
build_for_platform: Build for platform
update_type: Update type
build_requires: Build with all the required packages
@ -74,7 +73,7 @@ en:
main_data: Main data
human_current_duration: Build currently takes %{hours} h. %{minutes} min.
human_duration: Builded in %{hours} h. %{minutes} min.
human_duration: Built in %{hours} h. %{minutes} min.
attached_advisory: Attached advisory
create_advisory: Create new advisory
@ -120,6 +119,21 @@ en:
project_not_found: Project not found
project_version_not_found: Project version not found
log:
build_log: Build Log
not_available: Log not available yet.
download: Download log
autoreload: Update log every
load_lines: Load last %{count} lines
reload_times:
10000: "10 s"
30000: "30 s"
60000: "1 m"
300000: "5 m"
600000: "10 m"
900000: "15 m"
flash:
build_list:
saved: Build list for project version '%{project_version}', platform '%{build_for_platform}' and architecture '%{arch}' has been created successfully

View File

@ -18,8 +18,7 @@ ru:
additional_repos: Дополнительные репозитории
include_repos: Подключаемые репозитории
created_at: Создан
save_to_platform: Платформа
save_to_repository: Репозиторий
save_to_repository: Сохранить в репозиторий
build_for_platform: Собрано для платформы
update_type: Критичность обновления
build_requires: Пересборка с зависимостями
@ -117,6 +116,21 @@ ru:
project_not_found: проект не найден
project_version_not_found: версия не найдена
log:
build_log: Лог сборки
not_available: В настоящий момент лог недоступен.
download: Загрузить лог
autoreload: Обновлять лог каждые
load_lines: Загружать последние %{count} строк
reload_times:
10000: "10 сек"
30000: "30 сек"
60000: "1 мин"
300000: "5 мин"
600000: "10 мин"
900000: "15 мин"
flash:
build_list:
saved: Билд лист для версии '%{project_version}', платформы '%{build_for_platform}' и архитектуры '%{arch}' создан успешно

View File

@ -16,6 +16,7 @@ en:
description: Descripton
leave_group: Leave group
projects_list: Projects list
public_projects_list: Public projects list
public_profile: Public profile
delete_warning: Attention! Deleted group can not be restored!

View File

@ -16,6 +16,7 @@ ru:
description: Описание
leave_group: Покинуть группу
projects_list: Список проектов
public_projects_list: Список публичных проектов
public_profile: Публичный профиль
delete_warning: Внимание! Удаленная группа восстановлению не подлежит.

View File

@ -41,6 +41,7 @@ en:
update_label: Update label
label_custom_color: Custom color
label_manage: Manage labels
assignee_manage: Manage assignee
assignee: Assignee
search_user: Find user...
search_labels: Find labels...

View File

@ -40,7 +40,8 @@ ru:
new_label: Название новой метки
update_label: Обновить метку
label_custom_color: Свой цвет
label_manage: Управление
label_manage: Управление метками
assignee_manage: Назначить исполнителя
assignee: Исполнитель
search_user: Найти пользователя...
search_labels: Найти метки...

View File

@ -0,0 +1,25 @@
en:
layout:
maintainers:
list_header: Maintainers
search_by_package: Search by package name
flash:
maintainer:
saved: Maintainer saved
created: Maintainer created
save_error: Maintainer saves error
create_error: Maintainer create error
destroyed: Maintainer deleted
activerecord:
models:
maintainer: Maintainer
attributes:
maintainer:
package_name: Package
package_type: Type
created_at: First Update
updated_at: Last Update
version: Version-Release

View File

@ -0,0 +1,25 @@
ru:
layout:
maintainers:
list_header: Майнтейнеры
search_by_package: Искать по имени пакета
flash:
maintainer:
saved: Майнтейнер успешно сохранен
created: Майнтейнер успешно добавлен
save_error: Не удалось сохранить майнтейнера
create_error: Не удалось создать майнтейнера
destroyed: Майнтейнер успешно удален
activerecord:
models:
maintainer: Майнтейнер
attributes:
maintainer:
package_name: Пакет
package_type: Тип
created_at: Создан
updated_at: Обновлен
version: Версия-Релиз

View File

@ -40,6 +40,7 @@ en:
target_platform: Target platform
target_architecture: Target architecture
members: Members
maintainers: Maintainers
project: Project
arch: Architecture
mass_build: Mass build
@ -62,7 +63,6 @@ en:
cancel_mass_build: Mass build canceled
clone_success: Cloned successfully
members:
already_added: "%{name} is already a member of platform"
successfully_added: "%{name} successfully added to the platform"
error_in_adding: "Unable to add %{name} as member"

View File

@ -40,6 +40,7 @@ ru:
target_platform: Целевая платформа
target_architecture: Целевая архитектура
members: Участники
maintainers: Майнтейнеры
arch: Архитектура
mass_build: Массовая сборка
build_task: Сборочное задание
@ -62,7 +63,6 @@ ru:
cancel_mass_build: Массовая сборка отменена
clone_success: Клонирование успешно
members:
already_added: "%{name} уже является участником платформы"
successfully_added: "Участник %{name} успешно добавлен к платформе"
error_in_adding: "Не удалось добавить участника %{name}"

View File

@ -10,7 +10,7 @@ en:
'2': 'build in progress'
build_failed: Build failed
build_started: Build in progress
build_completed: Builded
build_completed: Built
ownership:
header: Build list ownership

View File

@ -7,6 +7,7 @@ en:
fork_to: Fork to %{to}
fork_modal_header: Where do you want to fork this project?
already_exists: Project already exists
unexisted_project: Project not exists
list: List
list_header: Projects
edit_header: Edit project
@ -92,6 +93,8 @@ en:
group: Group
default_branch: Default branch
is_package: Project is a package
maintainer: Maintainer of project
maintainer_id: Maintainer of project
errors:
project:
uname: The name can only use lower case Latin letters (a-z), numbers (0-9) and underscore (_)

View File

@ -7,6 +7,7 @@ ru:
fork_to: Клонировать в %{to}
fork_modal_header: Куда Вы хотите клонировать проект?
already_exists: Проект уже существует
unexisted_project: Проект не существует
list: Список
list_header: Проекты
edit_header: Редактировать проект
@ -92,6 +93,8 @@ ru:
group: Группа
default_branch: Ветка по умолчанию
is_package: Проект является пакетом
maintainer_id: Майнтейнер проекта
maintainer: Майнтейнер проекта
errors:
project:
uname: В имени можно использовать только строчные символы латинского алфавита (a-z), цифры (0-9) и символ нижнего подчеркивания (_)

View File

@ -2,6 +2,7 @@ en:
layout:
repositories:
add_project_to: Add project to repository
edit: Settings
list: List
about: About repository
list_header: Repositories
@ -29,13 +30,18 @@ en:
flash:
repository:
saved: Repository added
updated: Repository updated
save_error: Unable to add repository
update_error: Unable to update repository
destroyed: Repository deleted
project_added: Project added to repository
project_not_added: Project adding error. A project with such name already exists in this repository. Remove the old project first
project_removed: Project deleted
project_not_removed: Unable to delete project from repository
clear: Platform successfully cleared!
members:
successfully_added: "%{name} successfully added to the repository"
error_in_adding: "Unable to add %{name} as member"
activerecord:
models:
@ -44,6 +50,7 @@ en:
repository:
name: Name
description: Description
publish_without_qa: Publication without QA
platform_id: Platform
platform: Platform
created_at: Created

View File

@ -2,6 +2,7 @@ ru:
layout:
repositories:
add_project_to: Добавить проект к репозиторию
edit: Настройки
list: Список
about: О репозитории
list_header: Репозитории
@ -29,13 +30,18 @@ ru:
flash:
repository:
saved: Репозиторий успешно добавлен
updated: Репозиторий успешно обновлен
save_error: Не удалось добавить репозиторий
update_error: Не удалось обновить репозиторий
destroyed: Репозиторий успешно удален
project_added: Проект добавлен к репозиторию
project_not_added: Не удалось добавить проект. В этом репозитории уже есть проект с таким именем. Сначала нужно удалить старый проект
project_removed: Проект удален из репозитория
project_not_removed: Не удалось удалить проект из репозитория
clear: Платформа успешно очищена!
members:
successfully_added: "Участник %{name} успешно добавлен к репозиторию"
error_in_adding: "Не удалось добавить участника %{name}"
activerecord:
models:
@ -44,6 +50,7 @@ ru:
repository:
name: Название
description: Описание
publish_without_qa: Публикация без участия QA
platform_id: Платформа
platform: Платформа
created_at: Создан

View File

@ -57,6 +57,7 @@ ru:
change_email_link: Изменить адрес электронной почты
code_header: Код
tracker_header: Трекер задач
build_list_header: Сборочные задания
devise:
shared_links:
@ -167,7 +168,6 @@ ru:
can_have_less_or_equal: Нельзя иметь больше, чем %{count} проектов.
models:
arch: Arch
private_user: Приватный пользователь
product_build_list: Сборочный лист продукта
auto_build_list: Автоматическая пересборка пакетов
@ -183,13 +183,9 @@ ru:
new_comment_commit_owner: Оповещать о комментариях к моему коммиту
new_comment_commit_repo_owner: Оповещать о комментариях к коммитам в моем репозитории
new_comment_commit_commentor: Оповещать о комментариях к коммиту после моего
new_build: Оповещать о моих сборочных заданиях
new_associated_build: Оповещать о связанных со мной сборочных заданиях
private_user:
login: Логин
password: Пароль
arch:
name: Название
created_at: Создана
updated_at: Обновлена

Some files were not shown because too many files have changed in this diff Show More