#29: merge master into branch

This commit is contained in:
Vokhmin Alexey V 2013-04-03 16:10:22 +04:00
commit 9e7eb7af94
95 changed files with 1093 additions and 478 deletions

11
Gemfile
View File

@ -1,11 +1,9 @@
source 'https://rubygems.org'
gem 'rails', '3.2.13.rc2' #, :git => 'git://github.com/rails/rails.git'
gem 'rails', '3.2.13' #, :git => 'git://github.com/rails/rails.git'
gem 'redhillonrails_core', :git => 'git://github.com/warpc/redhillonrails_core.git', :branch => 'rails31' # '~> 2.0.0.pre' # deprecated
gem 'pg', '~> 0.14.0'
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'
gem 'redhillonrails_core', :git => 'git://github.com/warpc/redhillonrails_core.git', :branch => 'rails31' # '~> 2.0.0.pre' # deprecated
# gem 'schema_plus', '~> 0.2.1' # buggy shit!
gem 'devise', '~> 2.1.2'
gem 'omniauth', '~> 1.1.0'
@ -22,11 +20,10 @@ gem 'russian', '~> 0.6.0'
gem 'highline', '~> 1.6.11'
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 'grit', :git => 'git://github.com/avokhmin/grit.git' #, :path => '~/Sites/code/grit'
# gem "grit", :git => 'git://github.com/warpc/grit.git' #, :path => '~/Sites/code/grit'
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.2.1', :require => 'linguist'
gem 'diff-display', '~> 0.0.1'

View File

@ -1,18 +1,18 @@
GIT
remote: git://github.com/rdblue/grack.git
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
specs:
grack (0.2.0)
GIT
remote: git://github.com/warpc/grit.git
revision: f04f779fb052725b964ba259f8073a34e493c0c7
remote: git://github.com/avokhmin/grit.git
revision: 2109888819d23f18cdc30c0fbb6280ec3208fa7d
specs:
grit (2.5.0)
diff-lcs (~> 1.1)
mime-types (~> 1.15)
posix-spawn (~> 0.3.6)
GIT
remote: git://github.com/rdblue/grack.git
revision: 020be3fef3fb308b9d214252522aa5945bf6584a
specs:
grack (0.2.0)
GIT
remote: git://github.com/warpc/redhillonrails_core.git
revision: c0945a4c6ad4bae4ca2750b105efcff162408b15
@ -25,12 +25,12 @@ GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
actionmailer (3.2.13.rc2)
actionpack (= 3.2.13.rc2)
actionmailer (3.2.13)
actionpack (= 3.2.13)
mail (~> 2.5.3)
actionpack (3.2.13.rc2)
activemodel (= 3.2.13.rc2)
activesupport (= 3.2.13.rc2)
actionpack (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
@ -38,21 +38,21 @@ GEM
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.2.1)
activemodel (3.2.13.rc2)
activesupport (= 3.2.13.rc2)
activemodel (3.2.13)
activesupport (= 3.2.13)
builder (~> 3.0.0)
activerecord (3.2.13.rc2)
activemodel (= 3.2.13.rc2)
activesupport (= 3.2.13.rc2)
activerecord (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.13.rc2)
activemodel (= 3.2.13.rc2)
activesupport (= 3.2.13.rc2)
activesupport (3.2.13.rc2)
activeresource (3.2.13)
activemodel (= 3.2.13)
activesupport (= 3.2.13)
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
airbrake (3.1.8)
airbrake (3.1.9)
activesupport
builder
json
@ -63,13 +63,13 @@ GEM
encryptor (>= 1.1.1)
bcrypt-ruby (3.0.1)
blankslate (3.1.2)
bluepill (0.0.60)
bluepill (0.0.62)
activesupport (>= 3.0.0)
daemons (~> 1.1.4, <= 1.1.6)
daemons (~> 1.1.4)
i18n (>= 0.5.0)
state_machine (~> 1.1.0)
bourne (1.1.2)
mocha (= 0.10.5)
bourne (1.4.0)
mocha (~> 0.13.2)
builder (3.0.4)
cancan (1.6.7)
cape (1.7.0)
@ -80,9 +80,9 @@ GEM
net-ssh (>= 2.0.14)
net-ssh-gateway (>= 1.1.0)
capistrano_colors (0.5.5)
charlock_holmes (0.6.9.1)
charlock_holmes (0.6.9.3)
chronic (0.6.7)
chunky_png (1.2.7)
chunky_png (1.2.8)
cocaine (0.4.2)
coffee-rails (3.2.2)
coffee-script (>= 2.2.0)
@ -90,7 +90,7 @@ GEM
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.1)
coffee-script-source (1.6.2)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
@ -98,7 +98,7 @@ GEM
compass-rails (1.0.3)
compass (>= 0.12.2, < 0.14)
creole (0.5.0)
daemons (1.1.6)
daemons (1.1.9)
devise (2.1.3)
bcrypt-ruby (~> 3.0)
orm_adapter (~> 0.1)
@ -158,7 +158,7 @@ GEM
railties (>= 3.1.0, < 5.0)
thor (~> 0.14)
json (1.7.7)
kgio (2.7.4)
kgio (2.8.0)
libv8 (3.3.10.4)
macaddr (1.6.1)
systemu (~> 2.5.0)
@ -178,11 +178,11 @@ GEM
meta-tags (1.2.6)
actionpack
metaclass (0.0.1)
mime-types (1.21)
mocha (0.10.5)
mime-types (1.22)
mocha (0.13.3)
metaclass (~> 0.0.1)
mock_redis (0.6.2)
multi_json (1.7.0)
multi_json (1.7.2)
mustache (0.99.4)
net-scp (1.1.0)
net-ssh (>= 2.6.5)
@ -192,7 +192,7 @@ GEM
net-ssh-gateway (1.2.0)
net-ssh (>= 2.6.5)
newrelic_rpm (3.5.8.72)
nokogiri (1.5.6)
nokogiri (1.5.9)
omniauth (1.1.3)
hashie (~> 1.2)
rack
@ -229,14 +229,14 @@ GEM
rack (>= 1.0)
rack-throttle (0.3.0)
rack (>= 1.0.0)
rails (3.2.13.rc2)
actionmailer (= 3.2.13.rc2)
actionpack (= 3.2.13.rc2)
activerecord (= 3.2.13.rc2)
activeresource (= 3.2.13.rc2)
activesupport (= 3.2.13.rc2)
rails (3.2.13)
actionmailer (= 3.2.13)
actionpack (= 3.2.13)
activerecord (= 3.2.13)
activeresource (= 3.2.13)
activesupport (= 3.2.13)
bundler (~> 1.0)
railties (= 3.2.13.rc2)
railties (= 3.2.13)
rails-backbone (0.7.2)
coffee-script (~> 2.2.0)
ejs (~> 1.0.0)
@ -245,20 +245,20 @@ GEM
railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.11)
rails (~> 3.0)
railties (3.2.13.rc2)
actionpack (= 3.2.13.rc2)
activesupport (= 3.2.13.rc2)
railties (3.2.13)
actionpack (= 3.2.13)
activesupport (= 3.2.13)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
raindrops (0.10.0)
rake (10.0.3)
rake (10.0.4)
rdiscount (2.0.7.1)
rdoc (3.12.2)
json (~> 1.4)
redcarpet (2.1.1)
redis (3.0.3)
redis (3.0.2)
redis-namespace (1.2.1)
redis (~> 3.0.0)
redisk (0.2.2)
@ -277,7 +277,7 @@ GEM
actionmailer (~> 3.0)
rest-client (1.6.7)
mime-types (>= 1.16)
rr (1.0.4)
rr (1.0.5)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
@ -311,13 +311,13 @@ GEM
tilt (~> 1.3)
shotgun (0.9)
rack (>= 1.0)
shoulda (3.3.2)
shoulda-context (~> 1.0.1)
shoulda-matchers (~> 1.4.1)
shoulda-context (1.0.2)
shoulda-matchers (1.4.2)
shoulda (3.4.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (~> 1.0, >= 1.4.1)
shoulda-context (1.1.0)
shoulda-matchers (1.5.6)
activesupport (>= 3.0.0)
bourne (~> 1.1.2)
bourne (~> 1.3)
sinatra (1.3.6)
rack (~> 1.4)
rack-protection (~> 1.3)
@ -336,11 +336,11 @@ GEM
systemu (2.5.2)
therubyracer (0.10.2)
libv8 (~> 3.3.10)
thin (1.5.0)
thin (1.5.1)
daemons (>= 1.0.9)
eventmachine (>= 0.12.6)
rack (>= 1.0.0)
thor (0.17.0)
thor (0.18.1)
tilt (1.3.6)
treetop (1.4.12)
polyglot
@ -410,7 +410,7 @@ DEPENDENCIES
perform_later (~> 1.3.0)
pg (~> 0.14.0)
rack-throttle
rails (= 3.2.13.rc2)
rails (= 3.2.13)
rails-backbone (~> 0.7.2)
rails3-generators
rails3-jquery-autocomplete (~> 1.0.7)

View File

@ -0,0 +1,47 @@
$(document).ready(function() {
jQuery(window).bind('hashchange', function(e) {
var hash = location.hash;
if (/^#(diff|discussion)-F[0-9]+(L|R)[0-9]+/.test(hash)) {
highlightDiff(hash);
} else if (/^#L[0-9]+/.test(hash)) {
highlightShow(hash);
}
});
// Since the event is only triggered when the hash changes, we need to trigger
// the event now, to handle the hash the page may have loaded with.
jQuery(window).trigger('hashchange');
});
function highlightShow(id) {
$('.highlight-line').remove();
var from = to = id.substring(2);
if (/[0-9]+\-L[0-9]+$/.test(from)) {
var index = to.indexOf('-');
to = to.substring(index + 2);
from = from.substring(0, index);
}
from = parseInt(from);
to = parseInt(to);
if (from && to) {
if (from > to) {
var x = to; to = from; from = x;
}
var el = $('#L' + from);
$(document).scrollTop( el.offset().top );
while (el.length > 0) {
el.append('<div class="highlight-line"></div>');
if (from == to) { return true; }
from += 1;
el = $('#L' + from);
}
}
}
function highlightDiff(id) {
$('.highlight-line').removeClass('highlight-line');
$(id).parent().find('td.code').addClass('highlight-line');
}

View File

@ -0,0 +1,14 @@
$(document).ready(function() {
$('#product_project').bind('railsAutocomplete.select', function(event, data){
var ppv = $("#product_project_version").empty().append('<option value=""></option>');
$(data.item.project_versions).each(function(k, i) {
var optgroup = $('<optgroup label="' + i[0] + '"></optgroup>');
$(i[1]).each(function(k, b) {
optgroup.append('<option value="' + b + '">' + b + '</option>');
});
ppv.append(optgroup);
});
});
});

View File

@ -1,21 +1,5 @@
$(document).ready(function() {
$("#closed-switcher").live('click', function() {
if ($("#blue-switch-select").css("margin-left") != "130px") {
$("#blue-switch-select").animate({"margin-left": "+=130px"}, "fast");
$("#table1").fadeOut(0);
$("#table2").fadeIn("slow");
$('#issues_status').val('closed');
}
else {
$("#blue-switch-select").animate({"margin-left": "-=130px"}, "fast");
$("#table2").fadeOut(0);
$("#table1").fadeIn("slow");
$('#issues_status').val('open');
}
return send_index_tracker_request('GET');
});
$("#manage-labels").live('click', function () {
var toggled = $(this).data('toggled');
$(this).data('toggled', !toggled);
@ -33,12 +17,45 @@ $(document).ready(function() {
return send_index_tracker_request('GET');
});
$("#table1.issues-table .pagination a").live('click', function() {
var a = $(this);
var page = parseInt($('.pagination .current').text());
if (a.hasClass('next_page')) {
page += 1;
} else {
if (a.hasClass('previous_page')) {
page -= 1;
} else {
page = a.text();
}
}
$('.pagination .current').html(page);
return send_index_tracker_request('GET');
});
$(".issues-filter .tabnav-tabs li").live('click', function() {
var li = $(this);
var items = $('.issues-filter .tabnav-tabs');
if (li.hasClass('list-browser-sorts')) {
if (li.hasClass('selected')) {
var direction = li.hasClass('asc') ? 'desc' : 'asc';
li.removeClass('asc').removeClass('desc').addClass(direction);
} else {
items.find('.list-browser-sorts').removeClass('selected');
}
} else {
items.find('.list-browser-filter-tabs').removeClass('selected');
}
li.addClass('selected');
return send_index_tracker_request('GET');
});
$("#filter_issues #myradio1").live('change', function(event) {
return send_index_tracker_request('GET');
});
$('.ajax_search_form').live('submit', function() {
return send_index_tracker_request('GET', $(this).attr("action"), $(this).serialize());
return send_index_tracker_request('GET', $(this).attr("action"));
});
$('#add_label').live('click', function() {
@ -77,11 +94,16 @@ $(document).ready(function() {
var filter_form = $('#filter_issues');
url = url || filter_form.attr("action");
var label_form = $('#filter_labels');
var status = 'status=' + $('#issues_status').attr('value');
var issues_filter = $('.issues-filter');
var status = 'status=' + (issues_filter.find('.open').hasClass('selected') ? 'open' : 'closed');
var direction = 'direction=' + (issues_filter.find('.list-browser-sorts').hasClass('asc') ? 'asc' : 'desc');
var sort = 'sort=' + (issues_filter.find('.list-browser-sorts.updated').hasClass('selected') ? 'updated' : 'created');
var page = $('.pagination .current').text();
page = 'page=' + (page.length == 0 ? 1 : page);
$.ajax({
type: type_request,
url: url,
data: filter_form.serialize() + '&' + label_form.serialize() + '&' + status + '&' + data,
data: filter_form.serialize() + '&' + label_form.serialize() + '&' + status + '&' + direction + '&' + sort + '&' + page + '&' + data + '&' + $('.ajax_search_form').serialize(),
success: function(data){
$('article').html(data);
$(".niceRadio").each(function() { changeRadioStart(jQuery(this)) });
@ -93,60 +115,48 @@ $(document).ready(function() {
return false;
};
$('#search_user').live('submit', function() {
var id = $(this).attr('id');
if(id.indexOf('user') != -1) { // FIXME
var which = 'users';
}
else if (id.indexOf('labels') != -1) {
var which = 'labels';
}
$.ajax({
var isSearchUser = null;
$('#search_user').on('keyup', function() {
if (isSearchUser != null) { isSearchUser.abort(); }
isSearchUser = $.ajax({
type: 'GET',
url: $(this).attr("action"),
url: $('#search_user_path').attr('path'),
data: $(this).serialize(),
success: function(data){
$('#manage_issue_'+ which +'_list').html(data);
},
error: function(data){
alert('error') // TODO remove
}
$('#manage_issue_users_list').html(data);
}
});
return false;
});
function remAssignee(form) {
var el = form.find('.people.selected.remove_assignee');
var id = el.attr('id');
$('#manage_issue_users_list .add_assignee.people.selected').removeClass('select');
el.remove();
}
$('.add_assignee.people.selected').live('click', function() {
var form_new = $('form.issue');
var form_edit = $('form.edit_form.issue');
form_new.find('#people-span').fadeOut(0);
remAssignee(form_new);
var clone = $(this).clone().removeClass('add_assignee').addClass('remove_assignee');
form_new.find('#issue_assignee').html(clone);
$('.current_assignee').html(clone.removeClass('select'));
$(this).addClass('select');
$('#assigned-popup .header .icon-remove-circle').live('click', function() {
$('#assigned-popup').hide();
});
$('.remove_assignee.people.selected').live('click', function() {
var form = $('form.issue, form.edit_form issue');
form.find('#people-span').fadeIn(0);
remAssignee(form);
$('#assigned-container .icon-share').live('click', function() {
$('#assigned-popup').show();
});
function remLabel(form, id) {
var el = form.find('.label.remove_label'+'#'+id);
var label = $('#'+id+'.remove_label.label.selected');
label.find('.flag').fadeIn(0);
label.find('.labeltext.selected').removeClass('selected').attr('style', '');
label.fadeIn('slow');
el.fadeOut('slow').remove();
}
$('#assigned-popup .people.selected').live('click', function() {
var form = $('#assigned-popup .edit_assignee');
var item = $(this);
if (form.length == 0) {
updateAssignedUser(item);
return false;
}
$.ajax({
type: 'PUT',
url: form.attr("action"),
data: $(this).find('input').serialize(),
success: function(data){
updateAssignedUser(item);
},
error: function(data){
alert('error'); // TODO remove
}
});
return false;
});
$('.add_label.label').live('click', function() {
$(this).addClass('selected').removeClass('add_label').addClass('remove_label');
@ -229,12 +239,6 @@ $(document).ready(function() {
return false;
});
$('.button.manage_assignee').live('click', function() {
$('form#search_user, .button.update_assignee').fadeIn(0);
$('.current_assignee .people').addClass('remove_assignee selected').removeClass('nopointer');
$(this).fadeOut(0);
});
$('.button.manage_labels').live('click', function() {
$('.button.update_labels').fadeIn(0);
$('.current_labels .label .labeltext.selected').parent().addClass('remove_label selected').removeClass('nopointer');
@ -242,25 +246,6 @@ $(document).ready(function() {
$(this).fadeOut(0);
});
$('.button.update_assignee').live('click', function() {
var form = $('form.edit_assignee.issue');
$.ajax({
type: 'POST',
url: form.attr("action"),
data: form.serialize(),
success: function(data){
$('.current_assignee .people').removeClass('remove_assignee selected').addClass('nopointer');
$('form#search_user, .button.update_assignee').fadeOut(0);
$('.button.manage_assignee').fadeIn(0);
$('#manage_issue_users_list').html('');
},
error: function(data){
alert('error'); // TODO remove
}
});
return false;
});
$('.button.update_labels').live('click', function() {
var form = $('form.edit_labels.issue');
$.ajax({
@ -281,3 +266,18 @@ $(document).ready(function() {
});
});
function updateAssignedUser(item) {
$('#assigned-popup').hide();
var container = item.find('.container').clone();
$('#assigned-container .user-container').empty().append(container.html()).append('<span class="icon-share"></span>');
}
function remLabel(form, id) {
var el = form.find('.label.remove_label'+'#'+id);
var label = $('#'+id+'.remove_label.label.selected');
label.find('.flag').fadeIn(0);
label.find('.labeltext.selected').removeClass('selected').attr('style', '');
label.fadeIn('slow');
el.fadeOut('slow').remove();
}

View File

@ -325,6 +325,18 @@ article div.file table {
background-color: #DDFFDD;
}
#repo-wrapper table.diff tr td.code.highlight-line {
background-color: #FFFFCC;
}
.gutter .highlight-line {
background-color: #FF9900;
width: 805px;
height: 12px;
margin: -12px 0 0 50px;
opacity: 0.2;
position: absolute;
}
#repo-wrapper table.diff tr td.code.ins .idiff {
background-color: #BAFBAD;
}
@ -383,6 +395,7 @@ div.comment textarea { resize: none }
table.tablesorter tbody td a .issue_title {
color: #58595B;
font-size: 13px;
}
.syntaxhighlighter {
@ -981,6 +994,10 @@ table.diff {
}
/* Mass build forms */
.mass-build-actions a.button {
margin-bottom: 5px;
}
form.mass_build input[type="checkbox"] {
width: 10px;
height: 11px;
@ -1536,6 +1553,10 @@ table.tablesorter.platform-maintainers.static-search thead tr.search th input[ty
width: 430px;
}
.tablesorter .right {
text-align: right;
}
.all_platforms {
> .both { margin: 0 0 5px; }
.build_for_pl { font-weight: bold; }
@ -1860,3 +1881,129 @@ table#myTable thead tr.search th form.button_to div input {
#clone-urls > .git-protocol-selector:first-child {
margin:0 0 0 10px;
}
#table1 .tracker {
border-top: none;
margin-top: 0;
}
#description-top.issues-filter {
background: #dcecfa;
font-size: 12px;
color: #292929;
border: 1px solid #a9c6dd;
margin: 0;
padding: 5px 0 0;
li {
cursor: pointer;
}
li.list-browser-sorts {
float: right;
margin: -6px 0 0;
border: 1px solid #a9c6dd;
border-right: none;
width: 90px;
text-align: center;
padding: 7px 5px 3px;
}
}
article .activity .top {
.created {
margin-left: 50px;
span, a {
font-size: 11px;
}
}
.issue_title.text {
max-width: none;
float: none;
margin-left: 50px;
padding: 0;
}
h3.issue_title {
margin: 5px 0 0;
font-size: 18px;
}
.assigned-header {
padding: 10px 20px;
border: 1px solid #D6D6D6;
margin: 10px -7px;
border-left: none;
border-right: none;
}
}
#assigned-container {
.icon-share {
cursor: pointer;
}
.image {
float: left;
width: auto;
height: auto;
margin: -1px 5px 0 0;
img {
width: 16px;
height: 16px;
}
}
.name {
margin-left: 5px;
}
}
#assigned-popup {
z-index: 1001;
position: absolute;
margin: 5px 0 0 130px;
display: none;
min-width: 240px;
border: 1px solid #b3cce0;
background: #FFF;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
box-shadow: 0 3px 7px rgba(0, 0, 0, 0.3);
border-radius: 5px;
.header .icon-remove-circle {
cursor: pointer;
float: right;
}
.header {
padding: 10px;
background: #dcecfa;
border-bottom: 1px solid #D6D6D6;
font-weight: bold;
.title { display: inline-block; }
}
.search-container {
padding: 10px 15px 10px 10px;
border-bottom: 1px solid #D6D6D6;
input {
width: 100%;
max-width: 100%;
}
}
.edit_assignee {
display: none;
}
#manage_issue_users_list {
overflow-y: auto;
overflow-x: hidden;
max-height: 280px;
.people, .nothing {
margin: 0;
width: 100%;
padding: 10px 20px 10px 10px;
}
.clear, .nothing {
opacity: 0.8;
}
.container {
display: none;
}
}
}

View File

@ -762,7 +762,7 @@ article div.activity div.top div.text {
font-size: 12px;
}
article div.activity div.top div.text span.name {
article div.activity div.top span.name {
font-weight: 700;
}
@ -1665,59 +1665,6 @@ table.tracker-lables div.label:hover {
background: none;
}
div.blue-switcher {
height: 19px;
width: 258px;
border: 1px solid #a0a0a1;
border-radius: 3px;
background-color: #292929;
color: #FFF;
-webkit-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
-moz-box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
box-shadow: inset 0px 2px 5px 0px rgba(0, 0, 0, 0.3);
float: right;
}
div.blue-switcher div.open {
float: left;
padding: 1px 0px 2px 0px;
width: 128px;
text-align: center;
cursor: pointer;
position: relative;
z-index: 3;
}
div.blue-switcher div.selected {
background-image: -webkit-gradient(linear, left top, left bottom, from(#619dd2), to(#125687));
background-image: -webkit-linear-gradient(top, #619dd2, #125687);
background-image: -moz-linear-gradient(top, #619dd2, #125687);
background-image: -ms-linear-gradient(top, #619dd2, #125687);
background-image: -o-linear-gradient(top, #619dd2, #125687);
background-image: linear-gradient(top, #619dd2, #125687);
filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#619dd2', EndColorStr='#125687');
border-radius: 2px;
height: 18px;
width: 128px;
-webkit-box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.5);
-moz-box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.5);
box-shadow: 0px 0px 2px 0px rgba(0, 0, 0, 0.5);
position: absolute;
margin: 0px;
z-index: 2;
}
div.blue-switcher div.closed {
float: right;
padding: 1px 0px 0px 0px;
width: 128px;
text-align: center;
cursor: pointer;
position: relative;
z-index: 3;
}
table.tablesorter.tracker th.th1{
width: 50px;
}

View File

@ -64,7 +64,7 @@ class Api::V1::BaseController < ApplicationController
def update_subject(subject)
class_name = subject.class.name
if subject.update_attributes(params[class_name.downcase.to_sym] || {})
if subject.update_attributes(params[class_name.underscore.to_sym] || {})
render_json_response subject, "#{class_name} has been updated successfully"
else
render_validation_error subject, "#{class_name} has not been updated"

View File

@ -32,6 +32,8 @@ class Api::V1::BuildListsController < Api::V1::BaseController
end
def publish
@build_list.publisher = current_user
@build_list.save
render_json :publish
end

View File

@ -26,6 +26,11 @@ class Api::V1::ProductBuildListsController < Api::V1::BaseController
def show
end
def update
params[:product_build_list] = {:not_delete => (params[:product_build_list] || {})[:not_delete]}
update_subject @product_build_list
end
def destroy
destroy_subject @product_build_list
end

View File

@ -17,10 +17,9 @@ class ApplicationController < ActionController::Base
helper_method :get_owner
unless Rails.env.development?
rescue_from Exception, :with => :render_500
rescue_from ActiveRecord::RecordNotFound,
ActionController::RoutingError,
# ActionController::RoutingError, # see: config/routes.rb:<last line>
ActionController::UnknownController,
AbstractController::ActionNotFound, :with => :render_404
end
@ -31,12 +30,13 @@ class ApplicationController < ActionController::Base
rescue_from Grit::NoSuchPathError, :with => :not_found
protected
def render_404
render_error 404
end
protected
def render_500(e)
#check for exceptions Airbrake ignores by default and exclude them from manual Airbrake notification
if Rails.env.production? && !AIRBRAKE_IGNORE.include?(e.class)

View File

@ -1,13 +1,14 @@
#class MassBuildsController < ApplicationController
class Platforms::MassBuildsController < Platforms::BaseController
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access']
load_and_authorize_resource :platform
load_and_authorize_resource
skip_load_and_authorize_resource :only => [:index, :create]
skip_load_and_authorize_resource :platform, :only => [:cancel, :failed_builds_list]
skip_authorize_resource :platform, :only => [:create, :index]
skip_load_and_authorize_resource :platform, :only => [:cancel, :failed_builds_list, :publish]
skip_authorize_resource :platform, :only => [:index, :create]
def create
mass_build = @platform.mass_builds.new(:arches => params[:arches],
@ -27,9 +28,16 @@ class Platforms::MassBuildsController < Platforms::BaseController
end
end
def index
authorize! :local_admin_manage, @platform
def publish
if params[:status] == 'test_failed'
@mass_build.publish_test_faild_builds current_user
else
@mass_build.publish_success_builds current_user
end
redirect_to(platform_mass_builds_path(@mass_build.platform), :notice => t("flash.platform.publish_success"))
end
def index
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
@auto_publish_selected = true
end

View File

@ -5,7 +5,7 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
load_and_authorize_resource :platform, :except => :index
load_and_authorize_resource :product, :through => :platform, :except => :index
load_and_authorize_resource :product_build_list, :through => :product, :except => :index
load_and_authorize_resource :only => [:index, :show, :log, :cancel]
load_and_authorize_resource :only => [:index, :show, :log, :cancel, :update]
def new
product = @product_build_list.product
@ -22,6 +22,16 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
def show
end
def update
if @product_build_list.update_attributes(:not_delete => (params[:product_build_list] || {})[:not_delete])
flash[:notice] = t('flash.product_build_list.updated')
else
flash[:error] = t('flash.product_build_list.update_error')
flash[:warning] = @product_build_list.errors.full_messages.join('. ')
end
redirect_to platform_product_product_build_list_path(@platform, @product, @product_build_list)
end
def cancel
if @product_build_list.cancel
notice = t('layout.build_lists.will_be_canceled')

View File

@ -1,4 +1,5 @@
class Platforms::ProductsController < Platforms::BaseController
include GitHelper
before_filter :authenticate_user!
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
@ -54,7 +55,12 @@ class Platforms::ProductsController < Platforms::BaseController
search(params[:term]).search_order
items.select! {|e| e.repo.branches.count > 0}
render :json => items.map{ |p|
{:id => p.id, :label => p.name_with_owner, :value => p.name_with_owner}
{
:id => p.id,
:label => p.name_with_owner,
:value => p.name_with_owner,
:project_versions => versions_for_group_select(p)
}
}
end

View File

@ -4,6 +4,13 @@ class Projects::BaseController < ApplicationController
protected
def find_collaborators
search = "%#{params[:search_user]}%"
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)
end
def find_project
@project = Project.find_by_owner_and_name!(params[:owner_name], params[:project_name]) if params[:owner_name] && params[:project_name]
end

View File

@ -172,6 +172,7 @@ class Projects::BuildListsController < Projects::BaseController
end
@build_list.publisher = current_user
if @build_list.save && @build_list.can_publish? && @build_list.now_publish
redirect_to :back, :notice => t('layout.build_lists.publish_success')
else

View File

@ -5,6 +5,7 @@ class Projects::IssuesController < Projects::BaseController
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
before_filter :find_collaborators, :only => [:new, :create, :show, :search_collaborators]
layout false, :only => [:update, :search_collaborators]
@ -14,17 +15,17 @@ class Projects::IssuesController < Projects::BaseController
@issues = @issues.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me'
@issues = @issues.joins(:labels).where(:labels => {:name => @labels}) unless @labels == []
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
@issues = @issues.search(params[:search_issue])
@issues = @issues.search(params[:search_issue]) if params[:search_issue] !~ /#{t('layout.issues.search')}/
@opened_issues, @closed_issues = @opened_issues_count, @issues.closed_or_merged.count
if params[:status] == 'closed'
@issues, @status = @issues.closed_or_merged, params[:status]
else
@issues, @status = @issues.not_closed_or_merged, 'open'
end
@opened_issues, @closed_issues = @issues.not_closed_or_merged.count, @issues.closed_or_merged.count
@status = params[:status] == 'closed' ? :closed : :open
@issues = @issues.send( (@status == :closed) ? :closed_or_merged : :not_closed_or_merged )
@issues = @issues.includes(:assignee, :user, :pull_request).def_order.uniq
.paginate :per_page => 10, :page => params[:page]
@sort = params[:sort] == 'updated' ? :updated : :created
@direction = params[:direction] == 'asc' ? :asc : :desc
@issues = @issues.order("issues.#{@sort}_at #{@direction}")
@issues = @issues.includes(:assignee, :user, :pull_request).uniq
.paginate :per_page => 20, :page => params[:page]
if status == 200
render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application'
else
@ -90,10 +91,6 @@ class Projects::IssuesController < Projects::BaseController
end
def search_collaborators
search = "%#{params[:search_user]}%"
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'
end

View File

@ -5,6 +5,7 @@ class Projects::PullRequestsController < Projects::BaseController
load_resource :issue, :through => :project, :find_by => :serial_id, :parent => false, :except => [:index, :autocomplete_to_project]
load_and_authorize_resource :instance_name => :pull, :through => :issue, :singleton => true, :except => [:index, :autocomplete_to_project]
before_filter :find_collaborators, :only => [:new, :create, :show]
def new
to_project = find_destination_project(false)
@ -36,6 +37,7 @@ class Projects::PullRequestsController < Projects::BaseController
authorize! :read, to_project
@pull = to_project.pull_requests.new pull_params
@pull.issue.assignee_id = (params[:issue] || {})[:assignee_id]
@pull.issue.user, @pull.issue.project, @pull.from_project = current_user, to_project, @project
@pull.from_project_owner_uname = @pull.from_project.owner.uname
@pull.from_project_name = @pull.from_project.name
@ -89,18 +91,21 @@ class Projects::PullRequestsController < Projects::BaseController
def index(status = 200)
@issues_with_pull_request = @project.issues.joins(:pull_request)
@issues_with_pull_request = @issues_with_pull_request.search(params[:search_pull_request])
@issues_with_pull_request = @issues_with_pull_request.where(:assignee_id => current_user.id) if @is_assigned_to_me = params[:filter] == 'to_me'
@issues_with_pull_request = @issues_with_pull_request.search(params[:search_pull_request]) if params[:search_pull_request] !~ /#{t('layout.pull_requests.search')}/
@opened_issues, @closed_issues = @opened_pull_requests_count, @issues_with_pull_request.closed_or_merged.count
if params[:status] == 'closed'
@issues_with_pull_request, @status = @issues_with_pull_request.closed_or_merged, params[:status]
else
@issues_with_pull_request, @status = @issues_with_pull_request.not_closed_or_merged, 'open'
end
@opened_issues, @closed_issues = @issues_with_pull_request.not_closed_or_merged.count, @issues_with_pull_request.closed_or_merged.count
@status = params[:status] == 'closed' ? :closed : :open
@issues_with_pull_request = @issues_with_pull_request.send( (@status == :closed) ? :closed_or_merged : :not_closed_or_merged )
@sort = params[:sort] == 'updated' ? :updated : :created
@direction = params[:direction] == 'asc' ? :asc : :desc
@issues_with_pull_request = @issues_with_pull_request.order("issues.#{@sort}_at #{@direction}")
@issues_with_pull_request = @issues_with_pull_request.
includes(:assignee, :user, :pull_request).def_order.uniq.
paginate :per_page => 10, :page => params[:page]
includes(:assignee, :user, :pull_request).uniq.
paginate :per_page => 20, :page => params[:page]
if status == 200
render 'index', :layout => request.xhr? ? 'with_sidebar' : 'application'
else

View File

@ -51,6 +51,7 @@ module DiffHelper
def prepare(args)
@url, @diff_counter, @in_discussion = args[:url], args[:diff_counter], args[:in_discussion]
@filepath, @line_comments = args[:filepath], args[:comments]
@diff_prefix = args[:diff_prefix] || 'diff'
@add_reply_id, @num_line = if @in_discussion
[@line_comments[0].id, @line_comments[0].data[:line].to_i - @line_comments[0].data[:strings].lines.count.to_i-1]
else
@ -73,7 +74,7 @@ module DiffHelper
set_line_number
"<tr class='changes'>
<td class='line_numbers'></td>
#{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number}
<td class='code ins'>
#{line_comment}
<pre>#{render_line(line)}</pre>
@ -85,7 +86,7 @@ module DiffHelper
def remline(line)
set_line_number
"<tr class='changes'>
#{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number}
<td class='line_numbers'></td>
<td class='code del'>
#{line_comment}
@ -98,8 +99,8 @@ module DiffHelper
def modline(line)
set_line_number
"<tr clas='chanes line'>
#{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number}
<td class='code unchanged modline'>
#{line_comment}
<pre>#{render_line(line)}</pre>
@ -111,8 +112,8 @@ module DiffHelper
def unmodline(line)
set_line_number
"<tr class='changes unmodline'>
#{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number}
<td class='code unchanged unmodline'>
#{line_comment}
<pre>#{render_line(line)}</pre>
@ -132,8 +133,8 @@ module DiffHelper
def nonewlineline(line)
set_line_number
"<tr class='changes'>
#{td_line_link "diff-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "diff-F#{@diff_counter}R#{line.new_number}", line.new_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number}
#{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number}
<td class='code modline unmodline'>
#{line_comment}
<pre>#{render_line(line)}</pre>

View File

@ -67,6 +67,7 @@ module GitHelper
end
def versions_for_group_select(project)
return [] unless project
[ ['Branches', project.repo.branches.map(&:name)],
['Tags', project.repo.tags.map(&:name)] ]
end

View File

@ -60,7 +60,7 @@ class UserMailer < ActionMailer::Base
mail(
:to => email_with_name(user, user.email),
:subject => subject,
:from => email_with_name(build_list.user)
:from => email_with_name(build_list.publisher || build_list.user)
) do |format|
format.html
end

View File

@ -25,6 +25,7 @@ class Ability
# Platforms block
can [:show, :members, :advisories], Platform, :visibility => 'open'
can :platforms_for_build, Platform, :visibility => 'open', :platform_type => 'main'
can(:get_list, MassBuild) {|mass_build| mass_build.platform.main? && can?(:show, mass_build.platform) }
can [:read, :projects_list, :projects], Repository, :platform => {:visibility => 'open'}
can :read, Product, :platform => {:visibility => 'open'}
@ -97,7 +98,7 @@ class Ability
can([:update, :destroy], Platform) {|platform| owner?(platform) }
can([:local_admin_manage, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner?(platform) || local_admin?(platform) }
can([:get_list, :create], MassBuild) {|mass_build| (owner?(mass_build.platform) || local_admin?(mass_build.platform)) && mass_build.platform.main?}
can([:create, :publish], 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, :projects], Repository, :platform => {:owner_type => 'User', :owner_id => user.id}
@ -116,7 +117,7 @@ class Ability
can(:read, Product, read_relations_for('products', 'platforms')) {|product| product.platform.main?}
can([:create, :update, :destroy, :clone], Product) {|product| local_admin? product.platform and product.platform.main?}
can([:create, :cancel], ProductBuildList) {|pbl| can?(:update, pbl.product)}
can([:create, :cancel, :update], ProductBuildList) {|pbl| can?(:update, pbl.product)}
can(:destroy, ProductBuildList) {|pbl| can?(:destroy, pbl.product)}
can [:read, :create], PrivateUser, :platform => {:owner_type => 'User', :owner_id => user.id}
@ -157,7 +158,7 @@ class Ability
cannot :create_container, BuildList, :new_core => false
cannot(:publish, BuildList) {|build_list| !build_list.can_publish? }
cannot([:get_list, :create], MassBuild) {|mass_build| mass_build.platform.personal?}
cannot([:get_list, :create, :publish], MassBuild) {|mass_build| mass_build.platform.personal?}
cannot(:cancel, MassBuild) {|mass_build| mass_build.platform.personal? || mass_build.stop_build}
cannot(:regenerate_metadata, Repository) {|repository| !repository.platform.main?}

View File

@ -135,21 +135,32 @@ class ActivityFeedObserver < ActiveRecord::Observer
end
when 'BuildList'
if [BuildList::BUILD_PUBLISHED,
if ( record.status_changed? &&
[BuildList::BUILD_PUBLISHED,
BuildList::SUCCESS,
BuildList::BUILD_ERROR,
BuildList::PROJECT_VERSION_NOT_FOUND,
BuildList::FAILED_PUBLISH,
BuildList::TESTS_FAILED
].include? record.status or
(record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
].include?(record.status)
) or (record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
record.project.admins.each do |recipient|
user = record.publisher || record.user
ActivityFeed.create(
:user => recipient,
:kind => 'build_list_notification',
:data => {:task_num => record.bs_id, :build_list_id => record.id, :status => record.status, :updated_at => record.updated_at,
:project_id => record.project_id, :project_name => record.project.name, :project_owner => record.project.owner.uname,
:user_name => record.user.name, :user_email => record.user.email, :user_id => record.user_id}
:data => {
:task_num => record.bs_id,
:build_list_id => record.id,
:status => record.status,
:updated_at => record.updated_at,
:project_id => record.project_id,
:project_name => record.project.name,
:project_owner => record.project.owner.uname,
:user_name => user.name,
:user_email => user.email,
:user_id => user.id
}
)
end
end

View File

@ -9,6 +9,7 @@ class BuildList < ActiveRecord::Base
belongs_to :save_to_repository, :class_name => 'Repository'
belongs_to :build_for_platform, :class_name => 'Platform'
belongs_to :user
belongs_to :publisher, :class_name => 'User'
belongs_to :advisory
belongs_to :mass_build, :counter_cache => true
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
@ -155,6 +156,7 @@ class BuildList < ActiveRecord::Base
after_transition :on => :published,
:do => [:set_version_and_tag, :actualize_packages]
after_transition :on => :publish, :do => :set_publisher
after_transition :on => :cancel, :do => :cancel_job
after_transition :on => [:published, :fail_publish, :build_error, :tests_failed], :do => :notify_users
@ -475,6 +477,11 @@ class BuildList < ActiveRecord::Base
self.use_save_to_repository = true if save_to_platform.main?
end
def set_publisher
self.publisher ||= user
save
end
def current_ability
@current_ability ||= Ability.new(user)
end

View File

@ -1,5 +1,5 @@
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
belongs_to :commentable, :polymorphic => true, :touch => true
belongs_to :user
belongs_to :project
serialize :data

View File

@ -29,7 +29,6 @@ class Issue < ActiveRecord::Base
scope :closed_or_merged, where(:issues => {:status => ['closed', 'merged']})
# Using mb_chars for correct transform to lowercase ('Русский Текст'.downcase => "Русский Текст")
scope :search, lambda {|q| where("#{table_name}.title ILIKE ?", "%#{q.mb_chars.downcase}%") if q.present?}
scope :def_order, order('issues.serial_id desc')
scope :without_pull_requests, where('NOT EXISTS (select null from pull_requests as pr where pr.issue_id = issues.id)')
def assign_uname

View File

@ -28,7 +28,7 @@ class MassBuild < ActiveRecord::Base
def build_all
# later with resque
arches_list = arches ? Arch.where(:id => arches) : Arch.all
arches_list = arch_names ? Arch.where(:name => arch_names.split(', ')) : Arch.all
auto_publish ||= false
projects_list.lines.each do |name|
@ -55,9 +55,16 @@ class MassBuild < ActiveRecord::Base
def generate_failed_builds_list
report = ""
BuildList.where(:status => BuildList::BUILD_ERROR, :mass_build_id => self.id).each do |build_list|
report << "ID: #{build_list.id}; "
report << "PROJECT_NAME: #{build_list.project.name}\n"
BuildList.select('build_lists.id, projects.name as project_name, arches.name as arch_name').
where(
:status => BuildList::BUILD_ERROR,
:mass_build_id => self.id
).joins(:project, :arch).find_in_batches(:batch_size => 100) do |build_lists|
build_lists.each do |build_list|
report << "ID: #{build_list.id}; "
report << "PROJECT_NAME: #{build_list.project_name}; "
report << "ARCH: #{build_list.arch_name}\n"
end
end
report
end
@ -70,8 +77,26 @@ class MassBuild < ActiveRecord::Base
end
later :cancel_all, :queue => :clone_build
def publish_success_builds(user)
publish user, BuildList::SUCCESS, BuildList::FAILED_PUBLISH
end
later :publish_success_builds, :queue => :clone_build
def publish_test_faild_builds(user)
publish user, BuildList::TESTS_FAILED
end
later :publish_test_faild_builds, :queue => :clone_build
private
def publish(user, *statuses)
builds = build_lists.where(:status => statuses)
builds.update_all(:publisher_id => user.id)
builds.order(:id).find_in_batches(:batch_size => 50) do |bls|
bls.each{ |bl| bl.can_publish? && bl.now_publish }
end
end
def set_data
if new_record?
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{platform.name}"

View File

@ -181,6 +181,9 @@ class Platform < ActiveRecord::Base
end
later :destroy, :queue => :clone_build
def default_host
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
end
protected
@ -188,9 +191,6 @@ class Platform < ActiveRecord::Base
system("mkdir -p -m 0777 #{build_path([name, 'repository'])}")
end
def default_host
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
end
def build_path(dir)
File.join(APP_CONFIG['root_path'], 'platforms', dir)

View File

@ -5,9 +5,22 @@ class Product < ActiveRecord::Base
belongs_to :project
has_many :product_build_lists, :dependent => :destroy
ONCE_A_12_HOURS = 0
ONCE_A_DAY = 1
ONCE_A_WEEK = 2
AUTOSTART_STATUSES = [ONCE_A_12_HOURS, ONCE_A_DAY, ONCE_A_WEEK]
HUMAN_AUTOSTART_STATUSES = {
ONCE_A_12_HOURS => :once_a_12_hours,
ONCE_A_DAY => :once_a_day,
ONCE_A_WEEK => :once_a_week
}
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
validates :project_id, :presence => true
validates :main_script, :params, :length => { :maximum => 255 }
validates :autostart_status, :numericality => true,
:inclusion => {:in => AUTOSTART_STATUSES}, :allow_blank => true
scope :recent, order("#{table_name}.name ASC")
@ -16,7 +29,9 @@ class Product < ActiveRecord::Base
:project_id,
:main_script,
:params,
:platform_id
:platform_id,
:autostart_status,
:project_version
attr_readonly :platform_id
def full_clone(attrs = {})
@ -29,4 +44,35 @@ class Product < ActiveRecord::Base
end
end
def human_autostart_status
self.class.human_autostart_status(autostart_status)
end
def self.human_autostart_status(autostart_status)
I18n.t("layout.products.autostart_statuses.#{HUMAN_AUTOSTART_STATUSES[autostart_status]}")
end
class << self
HUMAN_AUTOSTART_STATUSES.each do |autostart_status, human_autostart_status|
define_method "autostart_iso_builds_#{human_autostart_status}" do
autostart_iso_builds autostart_status
end
end
end
def self.autostart_iso_builds(autostart_status)
Product.where(:autostart_status => autostart_status).each do |product|
pbl = product.product_build_lists.new
[:params, :main_script, :project, :project_version].each do |k|
pbl.send "#{k}=", product.send(k)
end
owner = product.platform.owner
pbl.user = owner.is_a?(User) ? owner : owner.owner
pbl.autostarted = true
pbl.base_url = "http://#{product.platform.default_host}"
pbl.time_living = product.time_living / 60
pbl.save
end
end
end

View File

@ -5,6 +5,9 @@ class ProductBuildList < ActiveRecord::Base
include AbfWorker::ModelHelper
delegate :url_helpers, to: 'Rails.application.routes'
LIVE_TIME = 2.week # for autostart
MAX_LIVE_TIME = 3.month # for manual start;
BUILD_COMPLETED = 0
BUILD_FAILED = 1
BUILD_PENDING = 2
@ -33,7 +36,10 @@ class ProductBuildList < ActiveRecord::Base
belongs_to :arch
belongs_to :user
# see: Issue #6
before_validation lambda { self.arch_id = Arch.find_by_name('x86_64').id }, :on => :create
# field "not_delete" can be changed only if build has been completed
before_validation lambda { self.not_delete = false unless build_completed?; true }
validates :product_id,
:status,
:project_id,
@ -51,8 +57,8 @@ class ProductBuildList < ActiveRecord::Base
:params,
:project_version,
:commit_hash,
:arch_id,
:product_id
:product_id,
:not_delete
attr_readonly :product_id
serialize :results, Array
@ -62,6 +68,8 @@ class ProductBuildList < ActiveRecord::Base
scope :for_user, lambda { |user| where(:user_id => user.id) }
scope :scoped_to_product_name, lambda {|product_name| joins(:product).where('products.name LIKE ?', "%#{product_name}%")}
scope :recent, order("#{table_name}.updated_at DESC")
scope :outdated, where(:not_delete => false).
where("(#{table_name}.created_at < ? AND #{table_name}.autostarted is TRUE) OR #{table_name}.created_at < ?", Time.now - LIVE_TIME, Time.now - MAX_LIVE_TIME)
after_create :add_job_to_abf_worker_queue
before_destroy :can_destroy?

View File

@ -78,12 +78,21 @@ class PullRequest < ActiveRecord::Base
def merge!(who)
return false unless can_merging?
Dir.chdir(path) do
old_commit = to_project.repo.commits(to_ref).first
commit = repo.commits(to_ref).first
system "git config user.name \"#{who.uname}\" && git config user.email \"#{who.email}\""
if merge
system("export GL_ID=user-#{who.id} && git push origin HEAD")
res = merge
if commit.id != repo.commits(to_ref).first.id
res2 = %x(export GL_ID=user-#{who.id} && git push origin HEAD)
system("git reset --hard HEAD^") # for diff maybe FIXME
if old_commit.id == to_project.repo.commits(to_ref).first.id
raise "merge result pull_request #{id}: #{$?.exitstatus}; #{res2}; #{res}"
end
set_user_and_time who
merging
else # Try to catch no merge errors
raise "merge result pull_request #{id}: #{res}"
end
end
end
@ -177,8 +186,7 @@ class PullRequest < ActiveRecord::Base
Dir.chdir(path) do
system 'git', 'tag', '-d', from_ref, to_ref
system 'git fetch --tags -all'
system 'git fetch --all'
system 'git fetch --tags && git fetch --all'
tags, head = repo.tags.map(&:name), to_project == from_project ? 'origin' : 'head'
system 'git', 'checkout', to_ref

View File

@ -40,7 +40,13 @@ json.build_list do |json|
:json => json_build_for_platform
end
json.partial! 'api/v1/shared/owner', :owner => @build_list.project.owner
json.user do |json_user|
json.partial! 'api/v1/shared/member', :member => @build_list.user, :tag => json_user
end
json.publisher do |json_publisher|
json.partial! 'api/v1/shared/member', :member => @build_list.publisher, :tag => json_publisher
end if @build_list.publisher
inc_repos = Repository.includes(:platform).where(:id => @build_list.include_repos)
json.include_repos inc_repos do |json_include_repos, repo|

View File

@ -1,6 +1,6 @@
json.product_build_list do |json|
json.partial! 'product_build_list', :product_build_list => @product_build_list, :json => json
json.(@product_build_list, :commit_hash, :main_script, :params)
json.(@product_build_list, :commit_hash, :main_script, :params, :not_delete, :autostarted)
json.product do |json_product|
json.partial! 'api/v1/products/product',
@ -12,10 +12,6 @@ json.product_build_list do |json|
:project => @product_build_list.project, :json => json_project
end
json.arch do |json_arch|
json_arch.(@product_build_list.arch, :id, :name)
end
json.created_at @product_build_list.created_at.to_i
json.updated_at @product_build_list.updated_at.to_i

View File

@ -1,3 +1,3 @@
json.(product, :id, :name, :description, :main_script, :params, :time_living)
json.(product, :id, :name, :description, :main_script, :params, :time_living, :autostart_status)
json.url api_v1_product_path(product, :format => :json)

View File

@ -13,7 +13,7 @@
- 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
- if can? :show, @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

View File

@ -0,0 +1,17 @@
= form_for :build, :url => platform_mass_builds_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
%section.left
=render 'repos_or_list_choice'
%br
= f.submit t("layout.projects.build_button")
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.lefter
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
.both
%h3= t("activerecord.attributes.build_list.preferences")
.both.bottom_20
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
.both

View File

@ -1,24 +1,7 @@
= render 'platforms/base/submenu'
= render 'platforms/base/sidebar'
= form_for :build, :url => platform_mass_builds_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
%section.left
=render 'repos_or_list_choice'
%br
= f.submit t("layout.projects.build_button")
%section.right
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.lefter
= check_box_tag "arches[]", arch.id, (params[:arches]||[]).include?(arch.id.to_s), :id => "arches_#{arch.id}"
= label_tag "arches_#{arch.id}", arch.name
.both
%h3= t("activerecord.attributes.build_list.preferences")
.both.bottom_20
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
= label_tag :auto_publish, t('activerecord.attributes.build_list.auto_publish')
%br
%br
= render 'form' if can? :edit, @platform
%table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"}
%thead
@ -27,7 +10,7 @@
%th.lpadding16= t('activerecord.attributes.mass_build.name')
%th.lpadding16= t("layout.mass_builds.statuses")
%th.lpadding16= t("layout.mass_builds.failed_builds_list")
%th.lpadding16= t("layout.mass_builds.cancel_mass_build")
%th.lpadding16= t("layout.mass_builds.actions")
%th.lpadding16= t("layout.mass_builds.extended_data")
- @mass_builds.each do |mass_build|
%tr
@ -43,7 +26,20 @@
= mass_build.read_attribute 'missed_projects_count'
%td
=link_to_list @platform, mass_build, 'failed_builds_list'
%td= link_to image_tag('x.png'), cancel_platform_mass_build_path(@platform, mass_build.id), :method => :post, :confirm => t("layout.mass_builds.cancel_confirm") if can?(:cancel, mass_build)
%td.right.mass-build-actions
- if can?(:publish, mass_build)
- unless mass_build.auto_publish?
= link_to t('layout.mass_builds.publish_success'),
publish_platform_mass_build_path(@platform, mass_build.id),
:method => :post, :confirm => t("layout.confirm"), :class => 'button'
= link_to t('layout.mass_builds.publish_test_failed'),
publish_platform_mass_build_path(@platform, mass_build.id, :status => 'test_failed'),
:method => :post, :confirm => t("layout.confirm"), :class => 'button'
- if can?(:cancel, mass_build)
= link_to t('layout.cancel'),
cancel_platform_mass_build_path(@platform, mass_build.id),
:method => :post, :class => 'button',
:confirm => t('layout.mass_builds.cancel_confirm')
%td
%a.toggle_btn{:href => "#toggle_#{ mass_build.id }", :'data-target' => "#toggle_#{ mass_build.id }"}= t("layout.mass_builds.extended_data")
.toggle{:id => "toggle_#{ mass_build.id }"}

View File

@ -9,11 +9,7 @@
.both
.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), :class => :label
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || pbl.project.default_branch
.both
.leftlist= f.label :arch, t("activerecord.attributes.product_build_list.arch"), :class => :label
.rightlist= f.select :arch_id, Arch.recent.map{ |a| [a.name, a.id]}
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || @product.project_version || pbl.project.default_branch
.both
= render 'platforms/products/def_fields', :f => f

View File

@ -19,18 +19,40 @@
= render 'show_field', :key => :project_version, :value => product_build_list_version_link(pbl, true)
= render 'show_field', :key => :arch, :value => pbl.arch.name
- [:main_script, :params].each do |el|
= render 'show_field', :key => el, :value => pbl.send(el)
= render 'show_field', :key => :time_living, :value => (pbl.time_living / 60)
= render 'show_field', :key => :autostarted, :value => t("layout.#{pbl.autostarted}_")
= render 'show_field', :key => :notified_at, :value => l(pbl.updated_at, :format => :long)
- if pbl.can_cancel? && can?(:cancel, pbl)
= link_to t("layout.build_lists.cancel"), cancel_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl),
:method => :put, :confirm => t("layout.confirm"), :class => 'button'
.both
%br
- if pbl.build_completed? && can?(:update, pbl)
= form_for pbl, :url => platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) do |f|
.leftlist= f.label :not_delete
.rightlist
= f.select :not_delete, [false, true].collect{|status| [t("layout.#{status}_"), status]}, {:selected => pbl.not_delete}
.both
%br
= submit_tag t('layout.update')
.both
- unless pbl.not_delete
.flash_notify
.alert.alert-error
- days = pbl.autostarted? ? ProductBuildList::LIVE_TIME : ProductBuildList::MAX_LIVE_TIME
- days = (pbl.created_at.to_date - days.ago.to_date).to_i
- if days > 1
= t('layout.product_build_lists.will_be_removed_n_days', :n => days)
- else
= t('layout.product_build_lists.will_be_removed_today')
.both
- if pbl.build_started? || pbl.build_canceling?
= render 'shared/log', { :build_started => true, :get_log_path => log_platform_product_product_build_list_path(pbl.product.platform, pbl.product, pbl) }

View File

@ -1,17 +1,25 @@
.leftlist= f.label :name, t("activerecord.attributes.product.name"), :class => :label
.leftlist= f.label :name
.rightlist= f.text_field :name, :class => 'text_field'
.both
.leftlist= f.label :description, t("activerecord.attributes.product.description"), :class => :label
.leftlist= f.label :description
.rightlist= f.text_area :description, :class => 'text_field resizable', :cols => 80
.both
.leftlist= f.label :project, t("activerecord.attributes.product.project"), :class => :label
.leftlist= f.label :project
.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner)
.both
.leftlist= f.label :project_version
.rightlist= f.select :project_version, versions_for_group_select(@product.project), {:selected => params[:products].try(:fetch, :project_version) || @product.project_version, :include_blank => true}
.both
= render 'def_fields', :f => f
.leftlist= f.label :autostart_status
.rightlist= f.select :autostart_status, Product::AUTOSTART_STATUSES.collect{|status| [Product.human_autostart_status(status), status]}, {:include_blank => true, :selected => @product.autostart_status}
.both
.button_block
= submit_tag t("layout.save")
%span.text_button_padding= t("layout.or")

View File

@ -25,6 +25,10 @@
.rightlist
= link_to @build_list.user.try(:fullname), @build_list.user
.both
.leftlist= t("activerecord.attributes.build_list.publisher")
.rightlist
= link_to @build_list.publisher.try(:fullname), @build_list.publisher if @build_list.publisher
.both
.leftlist= t("activerecord.attributes.build_list.build_for_platform")
.rightlist
- bfp = @build_list.build_for_platform

View File

@ -10,6 +10,5 @@
:javascript
$(document).ready(function() {
var text = $('#code').text().replace(/&amp;/gi, '&');
CodeMirror.runMode(text, "#{@blob.raw_mime_type.content_type}", document.getElementById("output"));
});
CodeMirror.runMode($('#code').text().replace(/&amp;/gi, '&'), "#{@blob.raw_mime_type.content_type}", document.getElementById("output"));
});

View File

@ -0,0 +1,14 @@
#assigned-popup
.header
.title= t('layout.issues.assign_someone')
%span.icon-remove-circle
.search-container
#search_user_path{:path => search_collaborators_project_issues_path(@project)}
= tracker_search_field(:search_user, t('layout.issues.search_user'))
- unless [:new, :create].include?(action_name.to_sym)
= form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f|
= hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]'
#manage_issue_users_list
= render 'projects/issues/search_collaborators'

View File

@ -1,8 +1,7 @@
=render 'title_body', :f => f, :id => 'new'
.leftlist= t('activerecord.attributes.issue.assignee') + ':'
.rightlist
%span#people-span.small-text= t('layout.issues.choose_user_on_left')
#issue_assignee
#assigned-container.rightlist
=render 'user_container', :user => @issue.assignee
.both
.leftlist= t('layout.issues.labels') + ':'
.rightlist

View File

@ -1,13 +1,18 @@
%h3.issue_title=@issue.title
.activity
.top
.image
=image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user
.text
%span.name=link_to(@issue.user.fullname, user_path(@issue.user)) if @issue.user
%br/
%span.date=@issue.created_at.to_s(:long)
%br/
.created
%span=@issue.created_at.to_s(:long)
- if @issue.user
%span= t('layout.by')
%span.name=link_to(@issue.user.fullname, user_path(@issue.user))
.text.issue_title
%h3.issue_title=@issue.title
.both
#assigned-container.assigned-header
=render 'projects/issues/user_container', :user => @issue.assignee
=render 'projects/issues/assigned_popup'
.both
.fulltext.view.issue_body.formatted.cm-s-default.md_and_cm=markdown @issue.body
.both

View File

@ -1,8 +1,7 @@
-content_for :sidebar do
- if current_user
=form_tag project_issues_path(@project), :id => 'filter_issues', :method => :get do
.bordered.nopadding
%h3=t("layout.issues.accessory")
.bordered
%table
%tr
%td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
@ -14,7 +13,8 @@
%td.width30.right=@project.issues.without_pull_requests.where(:assignee_id => current_user.id).count
=form_tag project_issues_path(@project), :id => 'search_issue', :class => 'ajax_search_form', :method => :get do
.bordered.bpadding20
=tracker_search_field(:search_issue, t('layout.issues.search'))
- search = params[:search_issue].present? ? params[:search_issue] : t('layout.issues.search')
=tracker_search_field(:search_issue, search)
- if can? :new, @project.issues.new
.bordered.nopadding
%h3.bmargin10=t('layout.issues.new')

View File

@ -8,7 +8,7 @@
%a{:href => path}
%div.issue_title=issue.title
.smalltext
=issue.created_at.to_s(:long)
=issue.send(@sort == :created ? :created_at : :updated_at).to_s(:long)
=t("layout.by") if issue.user
=link_to(issue.user.uname, user_path(issue.user)) if issue.user
-issue.labels.each do |label|

View File

@ -1,18 +1,21 @@
#closed-switcher.blue-switcher
=hidden_field_tag :issues_status, @status, :id => 'issues_status'
.open
="#{t('layout.issues.statuses.open')} (#{@opened_issues})"
#closed-tasks.closed
="#{t('layout.issues.statuses.closed')} (#{@closed_issues})"
#blue-switch-select.selected{:style => "margin-left: #{@status == 'open' ? '0' : '130'}px;"}
.both
.both
#table1
#description-top.issues-filter
.project-tabnav
%ul.tabnav-tabs
%li.list-browser-filter-tabs.open{:class => ('selected' if @status == :open)}
%a= "#{t('layout.issues.statuses.open')} (#{@opened_issues})"
%li.list-browser-filter-tabs.closed{:class => ('selected' if @status != :open)}
%a= "#{t('layout.issues.statuses.closed')} (#{@closed_issues})"
%li.list-browser-sorts.updated{:class => ("selected #{@direction}" if @sort == :updated)}
- if @sort == :updated
%i{:class => (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')}
%a= t('layout.issues.sort.updated')
%li.list-browser-sorts.created{:class => ("selected #{@direction}" if @sort == :created)}
- if @sort == :created
%i{:class => (@direction == :asc ? 'icon-chevron-up' : 'icon-chevron-down')}
%a= t('layout.issues.sort.submitted')
#table1.issues-table
%table#myTable.tablesorter.tracker{:cellpadding => "0", :cellspacing => "0"}
%thead
%tr
%th.th1{:colspan => "2"}=t('layout.issues.number')
%th{:colspan => "2"}=t('layout.issues.description')
%tbody
= render :partial => 'projects/issues/issue', :collection => issues
= will_paginate issues

View File

@ -9,32 +9,6 @@
- if can_manage
=form_tag [@project, @issue], :id => 'update_issue_status', :method => :put do
=hidden_field_tag "issue_status", @issue.closed? ? 'closed' : 'open', :name => "issue[status]"
.bordered.nopadding
%h3=t('layout.issues.assignee')
- if @issue.persisted?
-if can_manage
=form_for :issue, :url => [@project, @issue], :method => :put, :html => { :class => 'edit_assignee issue'} do |f|
=hidden_field_tag "user-default_assignee", nil, :name => 'issue[assignee_id]'
.current_assignee
- if @issue.assignee
#user-0.people.nopointer
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
.name=@issue.assignee.fullname
=hidden_field_tag "user-0", @issue.assignee.id, :name => 'issue[assignee_id]'
.both
- elsif @issue.assignee
.people.nopointer
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
.name=@issue.assignee.fullname
.both
=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'))
#manage_issue_users_list
=render 'search_collaborators'
=link_to(t('layout.issues.done'), '#', :class => "button tmargin10 update_assignee", :style => 'display:none') if can_manage
.block
%h3=t('layout.issues.labels')
- if can_manage

View File

@ -1,6 +1,21 @@
- (@users || []).each_with_index do |user, index|
.people.clear.selected
%span.icon-remove-circle
= t('layout.issues.clear_assignee')
.container
%span= t('layout.issues.no_one_is_assigned')
= hidden_field_tag "user-nil", nil, :name => "issue[assignee_id]"
- users = (@users || [])
- users.each_with_index do |user, index|
.people.selected{:id => "user-#{index}", :class => 'add_assignee'}
.avatar= image_tag(avatar_url(user), :alt => 'avatar')
.name=user.fullname
=hidden_field_tag "user-#{index}", user.id, :name => 'issue[assignee_id]'
.name= user.fullname
.container
.image
= image_tag(avatar_url(user, :micro), :alt => 'avatar')
%span.name= link_to(user.fullname, user_path(user))
%span= t('layout.issues.is_assigned')
= hidden_field_tag "user-#{index}", user.id, :name => "issue[assignee_id]"
.both
- if users.empty?
.nothing= t('layout.issues.nothing_to_show')

View File

@ -0,0 +1,10 @@
.user-container
- if user
.image
=image_tag(avatar_url(user, :micro), :alt => 'avatar')
%span.name= link_to(user.fullname, user_path(user))
%span= t('layout.issues.is_assigned')
- else
%span= t('layout.issues.no_one_is_assigned')
-if can?(:update, @issue) || @issue.new_record?
%span.icon-share

View File

@ -3,8 +3,8 @@
-render 'manage_sidebar'
%h3.bpadding10= t("layout.issues.create_header")
= form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue' } do |f|
=render 'projects/issues/assigned_popup'
= form_for :issue, :url => project_issues_path(@project), :html => { :class => 'form issue new' } do |f|
= render "form", :f => f
=hidden_field_tag :preview_url, project_md_preview_path(@project)
= render "projects/comments/markdown_help"
= render "projects/comments/markdown_help"

View File

@ -1,5 +1,6 @@
.hr
-commits_queue = []
- commits_queue = []
- diff_counter = 0
-merge_activity(@comments, @commits).each do |item| #
-if item.is_a? Comment
=render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present?
@ -16,8 +17,9 @@
=t '.show_outdated_diff'
%span.data-expander.collapsed{:id => exp_id} &nbsp;
.hidden{:id => "content-#{exp_id}"}
=render 'projects/pull_requests/discussion_comments', :item => item, :add_id => nil
=render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter
-else
=render 'projects/pull_requests/discussion_comments', :item => item, :add_id => nil
=render 'projects/pull_requests/discussion_comments', :item => item, :diff_counter => diff_counter
- diff_counter += 1
=render 'projects/git/commits/commits_small', :commits => commits_queue if commits_queue.present?

View File

@ -11,5 +11,5 @@
=t'projects.pull_requests.outdated_diff'
=image_tag 'x.png'
.clear
.diff_data=render_diff(comment.inline_diff, :diff_counter => 0, :comments => item[1], :filepath => comment.data[:path])
.diff_data=render_diff(comment.inline_diff, :diff_counter => diff_counter, :comments => item[1], :filepath => comment.data[:path], :diff_prefix => 'discussion')

View File

@ -1,4 +1,17 @@
-content_for :sidebar do
- if current_user
=form_tag project_pull_requests_path(@project), :id => 'filter_issues', :method => :get do
.bordered
%table
%tr
%td.width18=radio_button_tag :myradio, 'all', !@is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td.width135=t("layout.pull_requests.all")
%td.width30.right=@project.issues.joins(:pull_request).count
%tr
%td=radio_button_tag :myradio, 'to_me', @is_assigned_to_me, {:id => 'myradio1', :class => 'niceRadio', :name => 'filter'}
%td=t("layout.pull_requests.to_me")
%td.width30.right=@project.issues.joins(:pull_request).where(:assignee_id => current_user.id).count
=form_tag project_pull_requests_path(@project), :id => 'filter_pull_requests', :method => :get, :class => 'ajax_search_form' do
.bordered.bpadding20
=tracker_search_field(:search_pull_request, t('layout.pull_requests.search'))
- search = params[:search_pull_request].present? ? params[:search_pull_request] : t('layout.pull_requests.search')
=tracker_search_field(:search_pull_request, search)

View File

@ -7,6 +7,7 @@
.tab-content.pull_diff_fix
#discussion.tab-pane.active
=hidden_field_tag :update_action, new_project_pull_request_path
=render 'projects/issues/assigned_popup'
=form_for @pull, :url => (@pull.already? ? new_project_pull_request_path : project_pull_requests_path), :html => {:class => 'well well-large', :method => (@pull.already? ? :get : :post)} do |f|
.leftlist=f.label :from_project, t("#{ar}.from_project"), :class => :label
@ -31,6 +32,11 @@
%div{:class => @pull.ready? ? 'notice' : 'alert'}
=pull_status @pull
.both
.leftlist.big-list= t('activerecord.attributes.issue.assignee') + ':'
#assigned-container.rightlist
=render 'projects/issues/user_container', :user => @pull.assignee
.both
.leftlist.big-list
.rightlist
=f.submit t('.submit'), :class => 'btn btn-primary disabled', 'data-loading-text' => t('layout.processing'), :id => 'create_pull' unless @pull.already?

View File

@ -29,6 +29,7 @@ en:
auto_publish: Automated publising
project_version: Version
user: User
publisher: Publisher
preferences: Preferences
started_at: Build started at
duration: Build duration in seconds

View File

@ -29,6 +29,7 @@ ru:
auto_publish: Автоматическая публикация
project_version: Версия
user: Пользователь
publisher: Публикатор
preferences: Настройки
duration: Длительность билда в секундах
mass_build_id: Массовая сборка

View File

@ -11,9 +11,13 @@ en:
layout:
issues:
accessory: Accessory issues
is_assigned: is assigned
clear_assignee: Clear assignee
nothing_to_show: Nothing to show
no_one_is_assigned: No one is assigned
assign_someone: Assign someone to this issue
list: List
all: All
all: All issues
to_me: Assigned to me
edit: Edit
search: Find issue...
@ -23,6 +27,9 @@ en:
confirm_delete: Are you sure you want to delete this task?
edit_header: Edit task
create_header: Create task
sort:
updated: Updated
submitted: Submitted
statuses:
open: Open
closed: Closed

View File

@ -11,9 +11,13 @@ ru:
layout:
issues:
accessory: Принадлежность заданий
is_assigned: назначен
clear_assignee: Убрать назначение
nothing_to_show: Никто не найден
no_one_is_assigned: Никто не назначен
assign_someone: Назначить кого-либо на задачу
list: Список
all: Все
all: Все задачи
to_me: Назначенные мне
edit: Редактировать
search: Найти задачу...
@ -23,6 +27,9 @@ ru:
confirm_delete: Вы уверены, что хотите удалить эту задачу?
edit_header: Редактирование задачи
create_header: Создать задачу
sort:
updated: Обновлены
submitted: Созданы
statuses:
open: Открытые
closed: Закрытые

View File

@ -1,11 +1,13 @@
en:
layout:
mass_builds:
publish_success: Publish success builds
publish_test_failed: Publish test failed builds
repositories: Repositories
extended_data: Extended data
failed_builds_list: Failed Builds List
statuses: Statuses
cancel_mass_build: Cancel
actions: Actions
cancel_confirm: Are you sure you want to cancel mass build?
projects_list: Projects list
missed_projects_list: 'Missed projects: '

View File

@ -1,11 +1,13 @@
ru:
layout:
mass_builds:
publish_success: Опубликовать успешные сборки
publish_test_failed: Опубликовать сборки с проваленными тестами
repositories: Репозитории
extended_data: Параметры задания
failed_builds_list: Список ошибок сборок
statuses: Статусы
cancel_mass_build: Отмена
actions: Действия
cancel_confirm: Вы уверены, что хотите отменить массовую сборку?
projects_list: Список проектов
missed_projects_list: 'Несуществующие проекты: '

View File

@ -62,6 +62,7 @@ en:
build_all_success: All project build in progress
build_all_error: Mass build failed
cancel_mass_build: Mass build canceled
publish_success: Builds have been sent to queue for publishing successfully
clone_success: Cloned successfully
members:
successfully_added: "%{name} successfully added to the platform"

View File

@ -62,6 +62,7 @@ ru:
build_all_success: Все проекты успешно отправлены на сборку
build_all_error: Сборка не удалась!
cancel_mass_build: Массовая сборка отменена
publish_success: Сборки успешно отправлены в очередь на публикацию
clone_success: Клонирование успешно
members:
successfully_added: "Участник %{name} успешно добавлен к платформе"

View File

@ -11,6 +11,10 @@ en:
new_header: New product
edit_header: Product editing
confirm_delete: Are you sure you want to delete this product?
autostart_statuses:
once_a_12_hours: Once a 12 hours
once_a_day: Once a day
once_a_week: Once a week
flash:
product:
@ -25,8 +29,10 @@ en:
product: Product
attributes:
product:
autostart_status: Autostart
name: Name
description: Description
project_version: Version
platform_id: Platform
build_status: Build status
created_at: Created

View File

@ -11,6 +11,10 @@ ru:
new_header: Новый продукт
edit_header: Редактирование продукта
confirm_delete: Вы уверены, что хотите удалить этот продукт?
autostart_statuses:
once_a_12_hours: Раз в 12 часов
once_a_day: Раз в день
once_a_week: Раз в неделю
flash:
product:
@ -25,8 +29,10 @@ ru:
product: Продукт
attributes:
product:
autostart_status: Автостарт
name: Название
description: Описание
project_version: Версия
platform_id: Платформа
build_status: Статус последней сборки
created_at: Создан

View File

@ -1,6 +1,8 @@
en:
layout:
product_build_lists:
will_be_removed_n_days: Product build list will be removed through %{n} d.
will_be_removed_today: Product build list will be removed today
logs: Logs (last 100 lines)
work_env: Work environment
iso_builder_folder: folder with contents of the GIT project
@ -29,6 +31,8 @@ en:
activerecord:
attributes:
product_build_list:
autostarted: Autostart
not_delete: Not delete
id: Id
user: User
product: Product
@ -52,4 +56,6 @@ en:
product_build_list:
no_project: Project for build should be exist
delete: Product build list deleted
delete_error: Unable to delete product build list
delete_error: Unable to delete product build list
updated: Product build list updated
update_error: Unable to update product build list

View File

@ -1,6 +1,8 @@
ru:
layout:
product_build_lists:
will_be_removed_n_days: Cборочный лист продукта будет удален через %{n} д.
will_be_removed_today: Cборочный лист продукта будет удален в течение дня
logs: Логи (последнии 100 строк)
work_env: Рабочее пространство
iso_builder_folder: папка с содержимым GIT проекта
@ -29,6 +31,8 @@ ru:
activerecord:
attributes:
product_build_list:
autostarted: Автоматически запущен
not_delete: Не удалять
id: Id
user: Пользователь
product: Продукт
@ -52,4 +56,6 @@ ru:
product_build_list:
no_project: Проект для сборки должен присутствовать
delete: Сборочный лист продукта удален
delete_error: Не удалось удалить cборочный лист продукта
delete_error: Не удалось удалить cборочный лист продукта
updated: Cборочный лист продукта успешно обновлен
update_error: Не удалось обновить cборочный лист продукта

View File

@ -56,4 +56,6 @@ en:
layout:
pull_requests:
search: Find pull request...
all: All requests
to_me: Assigned to me
view_full_changes: View full changes

View File

@ -57,4 +57,6 @@ ru:
layout:
pull_requests:
search: Найти пул реквест...
all: Все пул реквесты
to_me: Назначенные мне
view_full_changes: Посмотреть все изменения

View File

@ -77,7 +77,7 @@ Rosa::Application.routes.draw do
resources :products, :only => [:show, :update, :create, :destroy] do
resources :product_build_lists, :only => :index
end
resources :product_build_lists, :only => [:index, :show, :destroy, :create] do
resources :product_build_lists, :only => [:index, :show, :destroy, :create, :update] do
put :cancel, :on => :member
end
#resources :ssh_keys, :only => [:index, :create, :destroy]
@ -144,6 +144,7 @@ Rosa::Application.routes.draw do
resources :mass_builds, :only => [:create, :index] do
member do
post :cancel
post :publish
get '/:kind.:format' => "mass_builds#get_list", :as => :get_list, :kind => /failed_builds_list|missed_projects_list|projects_list/
end
end
@ -161,7 +162,7 @@ Rosa::Application.routes.draw do
end
resources :key_pairs, :only => [:create, :index, :destroy]
resources :products do
resources :product_build_lists, :only => [:create, :destroy, :new, :show] do
resources :product_build_lists, :only => [:create, :destroy, :new, :show, :update] do
member {
get :log
put :cancel
@ -342,4 +343,9 @@ Rosa::Application.routes.draw do
get '/' => 'groups/profile#show', :as => :group
end
end
# As of Rails 3.0.1, using rescue_from in your ApplicationController to
# recover from a routing error is broken!
# see: https://rails.lighthouseapp.com/projects/8994/tickets/4444-can-no-longer-rescue_from-actioncontrollerroutingerror
match '*a', :to => 'application#render_404'
end

View File

@ -6,22 +6,40 @@
# runner "Download.parse_and_remove_nginx_log"
#end
every 1.day, :at => '4:00 am' do
# TODO: Uncomment when all needed product build lists will be updated.
# every :day, :at => '4:10 am' do
# rake "product_build_list:clear:outdated", :output => 'log/product_build_list_clear.log'
# end
every :day, :at => '4:00 am' do
rake "import:sync:all", :output => 'log/sync.log'
end
every 1.day, :at => '3:50 am' do
every :day, :at => '3:50 am' do
rake "buildlist:clear:outdated", :output => 'log/build_list_clear.log'
end
every 1.day, :at => '3:30 am' do
every :day, :at => '3:30 am' do
rake "pull_requests:clear", :output => 'log/pull_requests_clear.log'
end
every 1.day, :at => '3:00 am' do
every :day, :at => '3:00 am' do
rake "activity_feeds:clear", :output => 'log/activity_feeds.log'
end
every 3.minute do
runner 'AbfWorker::BuildListsPublishTaskManager.new.run', :output => 'log/task_manager.log'
end
every :day, :at => '4am' do
runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log'
runner 'Product.autostart_iso_builds_once_a_day', :output => 'log/autostart_iso_builds.log'
end
every :day, :at => '4pm' do
runner 'Product.autostart_iso_builds_once_a_12_hours', :output => 'log/autostart_iso_builds.log'
end
every :sunday, :at => '4am' do
runner 'Product.autostart_iso_builds_once_a_week', :output => 'log/autostart_iso_builds.log'
end

View File

@ -0,0 +1,7 @@
class AutostartIsoBuildOnRegularBasis < ActiveRecord::Migration
def change
add_column :products, :autostart_status, :integer, :default => nil
add_column :product_build_lists, :not_delete, :boolean, :default => false
add_column :product_build_lists, :autostarted, :boolean, :default => false
end
end

View File

@ -0,0 +1,5 @@
class AddProjectVersionToProduct < ActiveRecord::Migration
def change
add_column :products, :project_version, :string
end
end

View File

@ -0,0 +1,5 @@
class AddPublishedUserToBuildList < ActiveRecord::Migration
def change
add_column :build_lists, :publisher_id, :integer
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130227102900) do
ActiveRecord::Schema.define(:version => 20130328112110) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -137,6 +137,7 @@ ActiveRecord::Schema.define(:version => 20130227102900) do
t.boolean "auto_create_container", :default => false
t.text "extra_repositories"
t.text "extra_build_lists"
t.integer "publisher_id"
end
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
@ -302,7 +303,7 @@ ActiveRecord::Schema.define(:version => 20130227102900) do
create_table "product_build_lists", :force => true do |t|
t.integer "product_id"
t.integer "status", :default => 2, :null => false
t.integer "status", :default => 2, :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
@ -314,13 +315,15 @@ ActiveRecord::Schema.define(:version => 20130227102900) do
t.integer "arch_id"
t.integer "time_living"
t.integer "user_id"
t.boolean "not_delete", :default => false
t.boolean "autostarted", :default => false
end
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
create_table "products", :force => true do |t|
t.string "name", :null => false
t.integer "platform_id", :null => false
t.string "name", :null => false
t.integer "platform_id", :null => false
t.datetime "created_at"
t.datetime "updated_at"
t.text "description"
@ -328,6 +331,8 @@ ActiveRecord::Schema.define(:version => 20130227102900) do
t.string "params"
t.string "main_script"
t.integer "time_living"
t.integer "autostart_status"
t.string "project_version"
end
create_table "project_imports", :force => true do |t|

View File

@ -6,4 +6,7 @@ end
%w(rosa_system iso_worker_1 file_store).each do |uname|
user = User.new uname: uname, email: "#{uname}@rosalinux.ru", password: SecureRandom.base64
user.confirmed_at, user.role = Time.now.utc, 'system'; user.save
end
end
admin = User.new uname: 'admin_user', email: 'admin_user@rosalinux.ru', password: 'admin_user'
admin.confirmed_at, admin.role = Time.now.utc, 'admin'; admin.save

View File

@ -32,7 +32,7 @@ module AbfWorker
def sort_results_and_save(results, item = subject)
item.results = results.sort_by{ |r| r['file_name'] }
item.save!
item.save(:validate => false)
end
end

View File

@ -227,6 +227,17 @@ module AbfWorker
end
def create_rpm_build_task(save_to_repository_id, build_for_platform_id)
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ }
# We should not to publish new builds into repository
# if project of builds has been removed from repository.
BuildList.where(
:project_id => projects_for_cleanup.map{ |k| k.split('-')[0] }.uniq,
:save_to_repository_id => save_to_repository_id,
:status => BuildList::BUILD_PUBLISH
).update_all(:status => BuildList::FAILED_PUBLISH)
build_lists = BuildList.
where(:new_core => true, :status => BuildList::BUILD_PUBLISH).
where(:save_to_repository_id => save_to_repository_id).
@ -236,9 +247,6 @@ module AbfWorker
build_lists = build_lists.where('build_lists.id NOT IN (?)', locked_ids) unless locked_ids.empty?
build_lists = build_lists.limit(50)
projects_for_cleanup = @redis.lrange(PROJECTS_FOR_CLEANUP, 0, -1).
select{ |k| k =~ /#{save_to_repository_id}\-#{build_for_platform_id}$/ }
old_packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}}
projects_for_cleanup.each do |key|

View File

@ -36,9 +36,10 @@ module AbfWorker
update_results build_list
case status
when COMPLETED
build_list.published
# 'update_column' - when project of build_list has been removed from repository
build_list.published || build_list.update_column(:status, BuildList::BUILD_PUBLISHED)
when FAILED, CANCELED
build_list.fail_publish
build_list.fail_publish || build_list.update_column(:status, BuildList::FAILED_PUBLISH)
end
AbfWorker::BuildListsPublishTaskManager.unlock_build_list build_list
end

View File

@ -1,4 +1,13 @@
module Grit
class Commit
# Fix: NoMethodError: undefined method 'touch' for Grit::Commit
# see: model Comment belongs_to :commentable
def touch
true
end
end
class Blob
include Linguist::BlobHelper

View File

View File

@ -4,17 +4,25 @@ namespace :buildlist do
namespace :clear do
desc 'Remove outdated BuildLists and MassBuilds'
task :outdated => :environment do
say "Removing outdated BuildLists"
outdated = BuildList.outdated
say "There are #{outdated.count} outdated BuildLists at #{Time.now}"
BuildList.outdated.destroy_all
say "[#{Time.zone.now}] Removing outdated BuildLists"
say "[#{Time.zone.now}] There are #{BuildList.outdated.count} outdated BuildLists"
counter = 0
BuildList.outdated.order(:id).find_in_batches(:batch_size => 100) do |build_lists|
build_lists.each do |bl|
bl.destroy && (counter += 1) if bl.id != bl.last_published.first.try(:id)
end
end
say "[#{Time.zone.now}] #{counter} outdated BuildLists have been removed"
say "Removing outdated MassBuilds"
outdated = MassBuild.outdated
say "There are #{outdated.count} outdated MassBuilds at #{Time.now}"
MassBuild.outdated.destroy_all
say "[#{Time.zone.now}] Removing outdated MassBuilds"
say "[#{Time.zone.now}] There are #{MassBuild.outdated.count} outdated MassBuilds"
counter = 0
MassBuild.outdated.each do |mb|
mb.destroy && (counter += 1) if mb.build_lists.count == 0
end
say "[#{Time.zone.now}] #{counter} outdated MassBuilds have been removed"
say "Outdated BuildLists and MassBuilds was successfully removed"
say "[#{Time.zone.now}] Outdated BuildLists and MassBuilds was successfully removed"
end
end

View File

@ -0,0 +1,14 @@
namespace :product_build_list do
namespace :clear do
desc 'Remove outdated ProductBuildLists'
task :outdated => :environment do
say "[#{Time.zone.now}] Removing outdated ProductBuildLists"
say "[#{Time.zone.now}] There are #{ProductBuildList.outdated.count} outdated ProductBuildLists"
ProductBuildList.outdated.destroy_all
say "[#{Time.zone.now}] Outdated BuildLists have been removed"
end
end
end

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
public/pics/abf-logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.6 KiB

View File

@ -63,7 +63,7 @@ shared_examples_for 'api user with admin rights' do
params = {:product_id => @product_build_list.product_id, :arch_id => Arch.last.id,
:commit_hash => commit_hash, :main_script => @product_build_list.main_script}
@create_params = {:product_build_list =>{:time_living => 150}.merge(params)}
@update_params = {:product_build_list =>{:time_living => 250}}
@update_params = {:product_build_list =>{:time_living => 250, :not_delete => true}}
end
it 'should be able to perform show action' do
@ -95,14 +95,15 @@ shared_examples_for 'api user with admin rights' do
lambda { put :destroy, :id => @product_build_list.id, :format => :json }.should change{ ProductBuildList.count }.by(-1)
end
it "should not be able to perform update action" do
put :update, :id => @product_build_list.id, :format => :json
response.should_not be_success
it "should be able to perform update action" do
put :update, @update_params.merge(:id => @product_build_list.id), :format => :json
response.should be_success
end
it "ensures that product has not been updated" do
it "ensures that only not_delete field of product build list has been updated" do
put :update, @update_params.merge(:id => @product_build_list.id), :format => :json
@product_build_list.reload.time_living.should == 150*60 # in seconds
@product_build_list.not_delete.should be_true
end
it 'ensures that return correct answer for wrong creating action' do

View File

@ -21,6 +21,16 @@ shared_examples_for 'mass_build platform owner' do
@mass_build.reload.stop_build.should == true
end
it 'should be able to perform publish action' do
post :publish, :platform_id => @platform, :id => @mass_build
response.should redirect_to(platform_mass_builds_path(@platform))
end
it 'should change build_publish on publish' do
post :publish, :platform_id => @platform, :id => @mass_build
@mass_build.reload.build_publish_count.should == 1
end
it 'should not be able to perform cancel action if stop_build is true' do
@mass_build.stop_build = true; @mass_build.save
post :cancel, :platform_id => @platform, :id => @mass_build
@ -31,12 +41,17 @@ shared_examples_for 'mass_build platform owner' do
lambda { post :create, @create_params }.should change{ MassBuild.count }.by(1)
end
it 'should be able to perform get_list action' do
get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list'
response.should be_success
end
context 'for personal platform' do
before(:each) do
Platform.update_all("platform_type = 'personal'")
Platform.update_all(:platform_type => 'personal')
end
[:cancel, :get_list, :create].each do |action|
[:cancel, :get_list, :create, :publish].each do |action|
it "should not be able to perform #{ action } action" do
get action, :platform_id => @platform, :id => @mass_build.id
response.should redirect_to(forbidden_path)
@ -46,14 +61,22 @@ shared_examples_for 'mass_build platform owner' do
end
shared_examples_for 'mass_build platform reader' do
[:index, :create].each do |action|
it "should not be able to perform #{ action } action" do
get action, :platform_id => @platform
response.should redirect_to(forbidden_path)
end
it 'should be able to perform index action' do
get :index, :platform_id => @platform
response.should render_template(:index)
end
[:cancel, :get_list].each do |action|
it 'should be able to perform get_list action' do
get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list'
response.should be_success
end
it "should not be able to perform create action" do
get :create, :platform_id => @platform
response.should redirect_to(forbidden_path)
end
[:cancel, :publish].each do |action|
it "should not be able to perform #{ action } action" do
get action, :platform_id => @platform, :id => @mass_build.id
response.should redirect_to(forbidden_path)
@ -68,6 +91,11 @@ shared_examples_for 'mass_build platform reader' do
post :cancel, :platform_id => @platform, :id => @mass_build
@mass_build.reload.stop_build.should == false
end
it 'should not change build_publish on publish' do
post :publish, :platform_id => @platform, :id => @mass_build
@mass_build.reload.build_publish_count.should == 0
end
end
@ -91,26 +119,43 @@ describe Platforms::MassBuildsController do
}
@mass_build = FactoryGirl.create(:mass_build, :platform => @platform, :user => @user, :projects_list => project.name)
FactoryGirl.create(:build_list_core, :mass_build => @mass_build, :status => BuildList::SUCCESS)
end
context 'for guest' do
[:index, :create].each do |action|
it "should not be able to perform #{ action } action" do
get action, :platform_id => @platform
response.should redirect_to(new_user_session_path)
end
it 'should be able to perform index action', :anonymous_access => true do
get :index, :platform_id => @platform
response.should render_template(:index)
end
it "should not be able to get failed builds list" do
it 'should not be able to perform index action', :anonymous_access => false do
get :index, :platform_id => @platform
response.should redirect_to(new_user_session_path)
end
it 'should be able to perform get_list action', :anonymous_access => true do
get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list'
response.should be_success
end
it "should not be able to get failed builds list", :anonymous_access => false do
get :get_list, :platform_id => @platform, :id => @mass_build, :kind => 'failed_builds_list'
response.should redirect_to(new_user_session_path)
end
it "should not be able to perform cancel action" do
post :cancel, :platform_id => @platform, :id => @mass_build
it "should not be able to perform create action" do
get :create, :platform_id => @platform
response.should redirect_to(new_user_session_path)
end
[:cancel, :publish].each do |action|
it "should not be able to perform #{action} action" do
post action, :platform_id => @platform, :id => @mass_build
response.should redirect_to(new_user_session_path)
end
end
it 'should not change objects count on create success' do
lambda { post :create, @create_params }.should change{ MassBuild.count }.by(0)
end
@ -119,6 +164,12 @@ describe Platforms::MassBuildsController do
post :cancel, :platform_id => @platform, :id => @mass_build
@mass_build.reload.stop_build.should == false
end
it 'should not change build_publish_count on publish' do
post :publish, :platform_id => @platform, :id => @mass_build
@mass_build.reload.build_publish_count.should == 0
end
end
context 'for global admin' do

View File

@ -34,6 +34,18 @@ shared_examples_for 'product build list admin' do
response.should render_template(:show)
end
it 'should be able to perform update action' do
put :update, valid_attributes_for_show.merge(:product_build_list => {:time_living => 100,:not_delete => true})
response.should redirect_to(platform_product_product_build_list_path(@product.platform, @product, @pbl))
end
it "ensures that only not_delete field of product build list has been updated" do
put :update, valid_attributes_for_show.merge(:product_build_list => {:time_living => 100,:not_delete => true})
time_living = @pbl.time_living
@pbl.reload.time_living.should == time_living
@pbl.not_delete.should be_true
end
it 'should be able to perform log action' do
get :log, valid_attributes_for_show
response.should be_success

View File

@ -4,5 +4,8 @@ FactoryGirl.define do
association :platform, :factory => :platform
association :project, :factory => :project_with_commit
time_living 150
# see: before_validation in ProductBuildList model
before(:create) { Arch.find_or_create_by_name('x86_64') }
end
end

View File

@ -186,11 +186,18 @@ describe AbfWorker::BuildListsPublishTaskManager do
:save_to_repository => build_list.save_to_repository,
:build_for_platform => build_list.build_for_platform
) }
let(:build_list3) { FactoryGirl.create(:build_list_core,
:new_core => true,
:save_to_platform => build_list.save_to_platform,
:save_to_repository => build_list.save_to_repository,
:build_for_platform => build_list.build_for_platform
) }
before do
stub_redis
build_list.update_column(:status, BuildList::BUILD_PUBLISH)
build_list2.update_column(:status, BuildList::BUILD_PUBLISHED)
ProjectToRepository.where(:project_id => build_list.project_id, :repository_id => build_list.save_to_repository_id).destroy_all
build_list3.update_column(:status, BuildList::BUILD_PUBLISHED)
ProjectToRepository.where(:project_id => build_list3.project_id, :repository_id => build_list3.save_to_repository_id).destroy_all
2.times{ subject.new.run }
end
@ -212,7 +219,7 @@ describe AbfWorker::BuildListsPublishTaskManager do
it "ensure that 'locked projects for cleanup' has only one item" do
queue = @redis_instance.lrange(subject::LOCKED_PROJECTS_FOR_CLEANUP, 0, -1)
queue.should have(1).item
queue.should include("#{build_list.project_id}-#{build_list.save_to_repository_id}-#{build_list.build_for_platform_id}")
queue.should include("#{build_list3.project_id}-#{build_list3.save_to_repository_id}-#{build_list3.build_for_platform_id}")
end
it "ensure that new task for publishing has been created" do

View File

@ -17,7 +17,7 @@ describe UserMailer do
end
it 'should have correct subject' do
@email.subject.should == I18n.t("notifications.subjects.new_issue_notification")
@email.subject.should == "[#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})"
end
it 'should render receiver email' do
@ -28,16 +28,12 @@ describe UserMailer do
@email.from.should == [APP_CONFIG['do-not-reply-email']]
end
it 'should assign user name' do
@email.body.encoded.should match(@issue_user.name)
end
it 'should assign issue project name' do
@email.body.encoded.should match(@issue.project.name)
end
it 'should assign issue title' do
@email.body.encoded.should match(@issue.title)
it 'should assign issue body' do
@email.body.encoded.should match(@issue.body)
end
end
@ -56,7 +52,7 @@ describe UserMailer do
end
it 'should have correct subject' do
@email.subject.should == I18n.t("notifications.subjects.issue_assign_notification")
@email.subject.should == "Re: [#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})"
end
it 'should render receiver email' do
@ -93,7 +89,7 @@ describe UserMailer do
end
it 'should have correct subject' do
@email.subject.should == I18n.t("notifications.subjects.new_comment_notification")
@email.subject.should == "Re: [#{@issue.project.name}] #{@issue.title} (##{@issue.serial_id})"
end
it 'should render receiver email' do
@ -104,16 +100,8 @@ describe UserMailer do
@email.from.should == [APP_CONFIG['do-not-reply-email']]
end
it 'should assign user name' do
@email.body.encoded.should match(@issue_user.name)
end
it 'should assign comment body' do
@email.body.encoded.should match(@comment.body)
end
it 'should assign issue title' do
@email.body.encoded.should match(@issue.title)
end
end
end

View File

@ -1,8 +1,10 @@
require 'spec_helper'
describe ProductBuildList do
before(:all) do
before do
stub_symlink_methods
stub_redis
FactoryGirl.create(:product_build_list)
end
it { should belong_to(:product) }
@ -28,9 +30,8 @@ describe ProductBuildList do
# see app/ability.rb
# can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
it 'should generate correct sql to get product build lists' do
stub_symlink_methods
user = FactoryGirl.create(:user)
ability = Ability.new user
ProductBuildList.accessible_by(ability).count.should == 0
ProductBuildList.accessible_by(ability).count.should == 1
end
end

View File

@ -1,15 +1,7 @@
require 'spec_helper'
describe Product do
before(:all) do
stub_symlink_methods
Platform.delete_all
User.delete_all
Product.delete_all
init_test_root
# Need for validate_uniqueness_of check
FactoryGirl.create(:product)
end
let!(:product) { FactoryGirl.create(:product) }
it { should belong_to(:platform) }
it { should have_many(:product_build_lists)}
@ -26,11 +18,35 @@ describe Product do
#it { should_not allow_mass_assignment_of(:platform_id) }
it { should_not allow_mass_assignment_of(:product_build_lists) }
after(:all) do
Platform.delete_all
User.delete_all
Product.delete_all
clear_test_root
context '#autostart_iso_builds' do
Product::HUMAN_AUTOSTART_STATUSES.each do |autostart_status, human_autostart_status|
it "new product_build_lists should not be created if no products which should be autostarted #{human_autostart_status}" do
lambda { Product.autostart_iso_builds(autostart_status) }.should_not change{ ProductBuildList.count }
end
end
context 'by autostart_status = once_a_12_hours' do
before do
stub_symlink_methods
stub_redis
params = {:main_script => 'text.sh', :project_version => product.project.default_branch}
product.update_attributes params.merge(:autostart_status => Product::ONCE_A_12_HOURS)
FactoryGirl.create :product, params.merge(:autostart_status => Product::ONCE_A_DAY)
end
it 'should be created only one product_build_list' do
lambda { Product.autostart_iso_builds(Product::ONCE_A_12_HOURS) }.should change{ ProductBuildList.count }.by(1)
end
it 'product should has product_build_list' do
Product.autostart_iso_builds Product::ONCE_A_12_HOURS
product.product_build_lists.should have(1).item
end
end
end
end

View File

@ -816,16 +816,28 @@ a.badge:hover {
background-color: #1a1a1a;
}
[class^="icon-"], [class*=" icon-"] {
display: inline-block;
width: 14px;
height: 14px;
margin-top: 1px;
line-height: 14px;
vertical-align: text-top;
background-image: url("glyphicons-halflings.png");
background-position: 14px 14px;
background-repeat: no-repeat;
display: inline-block;
width: 14px;
height: 14px;
margin-top: 1px;
line-height: 14px;
vertical-align: text-top;
background-image: url("glyphicons-halflings.png");
background-position: 14px 14px;
background-repeat: no-repeat;
}
.icon-question-sign {
background-position: -96px -96px;
background-position: -96px -96px;
}
.icon-chevron-up {
background-position: -288px -120px;
}
.icon-chevron-down {
background-position: -313px -119px;
}
.icon-share {
background-position: -120px -72px;
}
.icon-remove-circle {
background-position: -168px -96px;
}