[issue #428] Merge branch 'master' into 428-advisory
Conflicts: app/assets/stylesheets/design/custom.scss
This commit is contained in:
commit
e7c0eab736
|
@ -14,3 +14,4 @@ public/downloads/*
|
|||
*.swp
|
||||
*.tmproj
|
||||
.sass-cache/
|
||||
dump.rdb
|
||||
|
|
1
Gemfile
1
Gemfile
|
@ -15,6 +15,7 @@ gem 'cancan', '~> 1.6.7'
|
|||
gem 'ancestry', '~> 1.2.5'
|
||||
gem 'paperclip', '~> 3.0.2'
|
||||
gem 'delayed_job_active_record', '~> 0.3.2'
|
||||
gem 'resque'
|
||||
gem 'russian', '~> 0.6.0'
|
||||
gem 'highline', '~> 1.6.11'
|
||||
|
||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -235,6 +235,14 @@ GEM
|
|||
rdoc (3.12)
|
||||
json (~> 1.4)
|
||||
redcarpet (1.17.2)
|
||||
redis (2.2.2)
|
||||
redis-namespace (1.0.3)
|
||||
redis (< 3.0.0)
|
||||
resque (1.20.0)
|
||||
multi_json (~> 1.0)
|
||||
redis-namespace (~> 1.0.2)
|
||||
sinatra (>= 0.9.2)
|
||||
vegas (~> 0.1.2)
|
||||
rr (1.0.4)
|
||||
rspec (2.9.0)
|
||||
rspec-core (~> 2.9.0)
|
||||
|
@ -303,6 +311,8 @@ GEM
|
|||
kgio (~> 2.6)
|
||||
rack
|
||||
raindrops (~> 0.7)
|
||||
vegas (0.1.11)
|
||||
rack (>= 1.0.0)
|
||||
warden (1.1.1)
|
||||
rack (>= 1.0)
|
||||
whenever (0.7.3)
|
||||
|
@ -356,6 +366,7 @@ DEPENDENCIES
|
|||
rdiscount
|
||||
redcarpet (= 1.17.2)
|
||||
redhillonrails_core!
|
||||
resque
|
||||
rr (~> 1.0.4)
|
||||
rspec-rails (~> 2.9.0)
|
||||
ruby-haml-js (~> 0.0.3)
|
||||
|
|
6
Rakefile
6
Rakefile
|
@ -3,5 +3,11 @@
|
|||
|
||||
require File.expand_path('../config/application', __FILE__)
|
||||
require 'rake'
|
||||
require 'resque/tasks'
|
||||
|
||||
# This fixes connection fail with Postgres server on new fork:
|
||||
task "resque:setup" => :environment do
|
||||
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
||||
end
|
||||
|
||||
Rosa::Application.load_tasks
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
$(document).ready(function() {
|
||||
// TODO: Refactor this handler!! It's too complicated.
|
||||
$('#build_list_save_to_platform_id').change(function() {
|
||||
var platform_id = $(this).val();
|
||||
var base_platforms = $('.all_platforms input[type=checkbox].build_bpl_ids');
|
||||
|
@ -8,8 +9,10 @@ $(document).ready(function() {
|
|||
if ($(this).val() == platform_id) {
|
||||
if ($(this).attr('data-released') === '1') {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
disableUpdateTypes();
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
enableUpdateTypes();
|
||||
}
|
||||
|
||||
$(this).attr('checked', 'checked').removeAttr('disabled').trigger('change');
|
||||
|
@ -31,6 +34,12 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
if ($.inArray(platform_id, base_platforms.map(function(){ return $(this).val() }).get()) == -1) {
|
||||
// For personal platforms update types always enebaled:
|
||||
enableUpdateTypes();
|
||||
}
|
||||
|
||||
|
||||
setBranchSelected();
|
||||
});
|
||||
$('#build_list_save_to_platform_id').trigger('change');
|
||||
|
@ -46,23 +55,6 @@ $(document).ready(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
$("select#build_list_save_to_platform_id").change(function() {
|
||||
if ( $.inArray(parseInt($("select#build_list_save_to_platform_id").val()), FROZEN_PLS) == 0 ) {
|
||||
$("select#build_list_update_type option").each(function(i,el) {
|
||||
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
|
||||
$(el).attr("disabled", "disabled");
|
||||
// If disabled option is selected - select 'bugfix':
|
||||
if ( $(el).attr("selected") ) {
|
||||
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$("select#build_list_update_type option").removeAttr("disabled");
|
||||
}
|
||||
});
|
||||
$("select#build_list_update_type").trigger('change');
|
||||
|
||||
});
|
||||
|
||||
function setPlChecked(pointer, checked) {
|
||||
|
@ -89,15 +81,18 @@ function setBranchSelected() {
|
|||
}
|
||||
}
|
||||
|
||||
function platformChange() {
|
||||
var rel = !!$('input[type="checkbox"].build_bpl_ids').filter(function(index) {
|
||||
var $this = $(this);
|
||||
return !!$this.attr('checked') && ($this.attr('data-released') === '1');
|
||||
}).length;
|
||||
|
||||
if (rel) {
|
||||
$('#build_list_auto_publish').removeAttr('checked').attr('disabled', 'disabled');
|
||||
} else {
|
||||
$('#build_list_auto_publish').removeAttr('disabled').attr('checked', 'checked');
|
||||
function disableUpdateTypes() {
|
||||
$("select#build_list_update_type option").each(function(i,el) {
|
||||
if ( $.inArray($(el).attr("value"), ["security", "bugfix"]) == -1 ) {
|
||||
$(el).attr("disabled", "disabled");
|
||||
// If disabled option is selected - select 'bugfix':
|
||||
if ( $(el).attr("selected") ) {
|
||||
$( $('select#build_list_update_type option[value="bugfix"]') ).attr("selected", "selected");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function enableUpdateTypes() {
|
||||
$("select#build_list_update_type option").removeAttr("disabled");
|
||||
}
|
||||
|
|
|
@ -1067,3 +1067,16 @@ div#new_advisory_form, div#advisory_preview {
|
|||
.fade.in {
|
||||
opacity: 1;
|
||||
}
|
||||
/*=============== popovers end ===============*/
|
||||
|
||||
.bottom_20 {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
form.mass_build section.left {
|
||||
margin-left: 50px;
|
||||
}
|
||||
|
||||
form.mass_build section.right {
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
|
|
@ -8,18 +8,24 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
autocomplete :user, :uname
|
||||
|
||||
def build_all
|
||||
mass_build = MassBuild.create!(:platform => @platform, :user => current_user)
|
||||
mass_build.delay.build_all(
|
||||
mass_build = MassBuild.new(
|
||||
:platform => @platform,
|
||||
:user => current_user,
|
||||
:repositories => params[:repositories],
|
||||
:arches => params[:arches],
|
||||
:auto_publish => params[:auto_publish]
|
||||
:auto_publish => params[:auto_publish] || false
|
||||
)
|
||||
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
if mass_build.save
|
||||
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
else
|
||||
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
||||
flash[:warning] = mass_build.errors.full_messages.join('. ')
|
||||
flash[:error] = t("flash.platform.build_all_error")
|
||||
end
|
||||
end
|
||||
|
||||
def mass_builds
|
||||
@mass_builds = MassBuild.paginate(:page => params[:page], :per_page => 20)
|
||||
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
||||
render :action => :build_all
|
||||
end
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ class Projects::IssuesController < Projects::BaseController
|
|||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:index, :show] if APP_CONFIG['anonymous_access']
|
||||
load_resource :project
|
||||
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create]
|
||||
load_and_authorize_resource :issue, :through => :project, :find_by => :serial_id, :only => [:show, :edit, :update, :destroy, :new, :create, :index]
|
||||
before_filter :load_and_authorize_label, :only => NON_RESTFUL_ACTION
|
||||
|
||||
layout 'application'
|
||||
|
|
|
@ -8,8 +8,8 @@ module ApplicationHelper
|
|||
'right slim'
|
||||
when controller_name == 'build_lists' && ['new', 'create'].include?(action_name)
|
||||
nil
|
||||
#when controller_name == 'platforms' && action_name == 'build_all'
|
||||
# nil
|
||||
when controller_name == 'platforms' && ['build_all', 'mass_builds'].include?(action_name)
|
||||
'right slim'
|
||||
when controller_name == 'platforms' && action_name == 'show'
|
||||
'right bigpadding'
|
||||
when controller_name == 'platforms' && action_name == 'clone'
|
||||
|
|
|
@ -29,6 +29,8 @@ class Ability
|
|||
else # Registered user rights
|
||||
if user.admin?
|
||||
can :manage, :all
|
||||
# Resque authorize
|
||||
can :manage, Resque
|
||||
# Protection
|
||||
cannot :approve, RegisterRequest, :approved => true
|
||||
cannot :reject, RegisterRequest, :rejected => true
|
||||
|
|
|
@ -5,20 +5,31 @@ class MassBuild < ActiveRecord::Base
|
|||
|
||||
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }
|
||||
|
||||
def build_all(opts={})
|
||||
auto_publish = opts[:auto_publish] || false
|
||||
set_data opts[:repositories], opts[:arches], auto_publish
|
||||
attr_accessor :repositories, :arches
|
||||
|
||||
platform.build_all opts.merge({:mass_build_id => self.id})
|
||||
validates :platform_id, :arch_names, :name, :user_id, :repositories, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
||||
after_create :build_all
|
||||
|
||||
def initialize(args = nil)
|
||||
super
|
||||
|
||||
if new_record?
|
||||
rep_names = Repository.where(:id => self.repositories).map(&:name).join(", ")
|
||||
self.name = "#{Time.now.utc.to_date.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
|
||||
self.arch_names = Arch.where(:id => self.arches).map(&:name).join(", ")
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_data(repositories_ids, arches, auto_publish=false)
|
||||
rep_names = Repository.where(:id => repositories_ids).map(&:name).join(", ")
|
||||
self.name = "#{Date.today.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
|
||||
self.arch_names = Arch.where(:id => arches).map(&:name).join(", ")
|
||||
self.auto_publish = auto_publish
|
||||
self.save
|
||||
# ATTENTION: repositories and arches must be set before calling this method!
|
||||
def build_all
|
||||
platform.delay.build_all(
|
||||
:mass_build_id => self.id,
|
||||
:user => self.user,
|
||||
:repositories => self.repositories,
|
||||
:arches => self.arches,
|
||||
:auto_publish => self.auto_publish
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,12 +41,12 @@ class Project < ActiveRecord::Base
|
|||
|
||||
after_create :attach_to_personal_repository
|
||||
after_create :create_git_repo
|
||||
after_create {|p| p.delay(:queue => 'fork', :priority => 20).fork_git_repo unless is_root?}
|
||||
after_create {|p| p.async(:fork_git_repo) unless is_root?}
|
||||
after_save :create_wiki
|
||||
|
||||
after_destroy :destroy_git_repo
|
||||
after_destroy :destroy_wiki
|
||||
after_save {|p| p.delay(:queue => 'import', :priority => 10).import_attached_srpm if p.srpm?} # should be after create_git_repo
|
||||
after_save {|p| p.async(:import_attached_srpm) if p.srpm?} # should be after create_git_repo
|
||||
# after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||
|
||||
has_ancestry
|
||||
|
@ -55,6 +55,20 @@ class Project < ActiveRecord::Base
|
|||
|
||||
include Modules::Models::Owner
|
||||
|
||||
@queue = :fork_and_import
|
||||
|
||||
# This will be called by a worker when a job needs to be processed
|
||||
def self.perform(id, method, *args)
|
||||
find(id).send(method, *args)
|
||||
end
|
||||
|
||||
# We can pass this any Repository instance method that we want to
|
||||
# run later.
|
||||
def async(method, *args)
|
||||
Resque.enqueue(Project, id, method, *args)
|
||||
end
|
||||
|
||||
|
||||
def to_param
|
||||
name
|
||||
end
|
||||
|
@ -252,7 +266,7 @@ class Project < ActiveRecord::Base
|
|||
def create_git_repo
|
||||
if is_root?
|
||||
Grit::Repo.init_bare(path)
|
||||
write_hook.delay(:queue => 'fork', :priority => 15)
|
||||
async(:write_hook)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
%li{:class => (contr == :repositories) ? 'active' : ''}
|
||||
= link_to t("layout.repositories.list_header"), platform_repositories_path(@platform)
|
||||
- if can? :mass_builds, @platform
|
||||
%li= link_to t("layout.platforms.mass_build"), mass_builds_platform_path(@platform)
|
||||
%li{:class => (contr == :platforms && [:mass_builds, :build_all].include?(act)) ? 'active' : ''}
|
||||
= link_to t("layout.platforms.mass_build"), mass_builds_platform_path(@platform)
|
||||
- if can? :read, @platform.products.build
|
||||
%li{:class => (contr == :products) ? 'active' : ''}
|
||||
= link_to t("layout.products.list_header"), platform_products_path(@platform)
|
||||
|
|
|
@ -1,50 +1,34 @@
|
|||
- content_for(:sidebar) do
|
||||
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
|
||||
.bordered.nopadding
|
||||
.table
|
||||
%h3= t("activerecord.attributes.build_list.build_for_platform")
|
||||
- @platform.repositories.each do |rep|
|
||||
.lefter
|
||||
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}"
|
||||
= label_tag "repositories_#{rep.id}", rep.name
|
||||
.both
|
||||
.both
|
||||
.table
|
||||
%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
|
||||
.both
|
||||
.table
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
.lefter
|
||||
= check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : true, :id => 'auto_publish'
|
||||
= label_tag t('activerecord.attributes.mass_build.auto_publish')
|
||||
.both
|
||||
= render 'submenu'
|
||||
= render 'sidebar'
|
||||
|
||||
= form_for :build, :url => build_all_platform_path(@platform), :html => { :class => 'form mass_build', :method => :post } do |f|
|
||||
%section.left
|
||||
%h3= t("layout.mass_builds.repositories")
|
||||
- @platform.repositories.each do |rep|
|
||||
.both
|
||||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
= check_box_tag "repositories[]", rep.id, (params[:repositories]||[]).include?(rep.id.to_s), :id => "repositories_#{rep.id}"
|
||||
= label_tag "repositories_#{rep.id}", rep.name
|
||||
%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, params[:auto_publish].present? ? params[:auto_publish].present? : false, :id => 'auto_publish'
|
||||
= label_tag :auto_publish
|
||||
|
||||
%br
|
||||
%br
|
||||
.bordered.nopadding
|
||||
.table
|
||||
- ['BuildList::BUILD_PUBLISHED', 'BuildServer::SUCCESS', 'BuildServer::BUILD_STARTED', 'BuildList::BUILD_PENDING', 'BuildServer::BUILD_ERROR'].each do |state|
|
||||
.lefter
|
||||
= t("layout.build_lists.statuses.#{state.demodulize.downcase}")
|
||||
.righter
|
||||
= BuildList.for_status(state.constantize).for_user(current_user).for_platform(@platform).count
|
||||
.both
|
||||
%br
|
||||
= link_to t("layout.activity_feed.all_my_builds"), build_lists_path
|
||||
%br
|
||||
%br
|
||||
|
||||
%h3.fix= t("layout.platforms.mass_build")
|
||||
|
||||
%table.tablesorter.unbordered
|
||||
%table.tablesorter.unbordered{:cellpadding => "0", :cellspacing => "0"}
|
||||
%thead
|
||||
%tr
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.id')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.name')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.arch_names')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.user')
|
||||
|
@ -52,9 +36,10 @@
|
|||
%th.lpadding16= t('activerecord.attributes.mass_build.created_at')
|
||||
- @mass_builds.each do |mass_build|
|
||||
%tr
|
||||
%td= mass_build.id
|
||||
%td= link_to mass_build.name, build_lists_path(:filter => {:mass_build_id => mass_build.id})
|
||||
%td= mass_build.arch_names
|
||||
%td= mass_build.user.name
|
||||
%td= link_to mass_build.user.fullname, mass_build.user
|
||||
%td= mass_build.auto_publish
|
||||
%td= mass_build.created_at
|
||||
= will_paginate @mass_builds
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
%td
|
||||
.img
|
||||
= image_tag avatar_url(user)
|
||||
.forimg= link_to "#{user.uname} (#{user.name})", user_path(user)
|
||||
.forimg= link_to user.fullname, user_path(user)
|
||||
- if can? :remove_member, @platform
|
||||
%td.buttons
|
||||
= link_to remove_member_platform_path(@platform, :member_id => user.id), :method => :delete, :confirm => t("layout.confirm") do
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
%tr{:id => "row#{build_list_counter}", :class => "#{build_list_status_color(build_list.status)}"}
|
||||
%td= link_to (build_list.bs_id.present? ? build_list.bs_id : t("layout.build_lists.bs_id_not_set")), build_list
|
||||
%td= build_list.mass_build_id ? build_list.mass_build.name : ""
|
||||
%td= build_list.mass_build_id ? link_to(build_list.mass_build.name, mass_builds_platform_path(build_list.save_to_platform)) : ""
|
||||
%td= build_list.human_status
|
||||
%td= link_to build_list.project.name, build_list.project
|
||||
%td= link_to build_list.project_version, "#"
|
||||
|
|
|
@ -34,7 +34,4 @@
|
|||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
|
||||
:javascript
|
||||
var FROZEN_PLS = [#{ @project.repositories.map { |r| r.id if r.platform.released }.delete_if { |i| i.nil? }.join(", ") }];
|
||||
|
||||
= render 'projects/base/submenu'
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
%td
|
||||
.img
|
||||
= image_tag avatar_url(user)
|
||||
.forimg= link_to "#{user.uname} (#{user.name})", user_path(user)
|
||||
.forimg= link_to user.fullname, user_path(user)
|
||||
- Relation::ROLES.each_with_index do |role, i|
|
||||
%td
|
||||
.radio
|
||||
|
|
|
@ -19,13 +19,13 @@
|
|||
- if @issue.assignee
|
||||
#user-0.people.nopointer
|
||||
.avatar=image_tag avatar_url(@issue.assignee), :alt => 'avatar'
|
||||
.name="#{@issue.user.uname} (#{@issue.assignee.name})"
|
||||
.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.uname} (#{@issue.assignee.name})"
|
||||
.name=@issue.assignee.fullname
|
||||
.both
|
||||
=link_to(t('layout.issues.label_manage'), '#', :class => "button tmargin10 manage_assignee") if can_manage
|
||||
- if can_manage
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
- (@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.uname} (#{user.name})"
|
||||
.name=user.fullname
|
||||
=hidden_field_tag "user-#{index}", user.id, :name => 'issue[assignee_id]'
|
||||
.both
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
.state=t('layout.issues.status.closed')
|
||||
.text
|
||||
.avatar= image_tag(avatar_url(@issue.closer), :alt => 'avatar')
|
||||
.name="#{@issue.closer.uname} (#{@issue.closer.name}) #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
.name="#{@issue.closer.fullname} #{t('layout.issues.at')} #{@issue.closed_at.to_s(:long)}"
|
||||
.both
|
||||
%br/
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.image
|
||||
=image_tag(avatar_url(@issue.user, :medium), :alt => 'avatar') if @issue.user
|
||||
.text
|
||||
%span.name=link_to("#{@issue.user.uname} (#{@issue.user.name})", user_path(@issue.user)) if @issue.user
|
||||
%span.name=link_to(@issue.user.fullname, user_path(@issue.user)) if @issue.user
|
||||
%br/
|
||||
%span.date=@issue.created_at.to_s(:long)
|
||||
%br/
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
= image_tag avatar_url_by_email(v.author.email), :alt => "avatar: #{v.author.name}", :class => 'mini-gravatar'
|
||||
.name
|
||||
= link_to user_path_by_user(user) do
|
||||
%span.username= user.present? ? "#{user.uname} (#{user.name})" : v.author.name
|
||||
%span.username= user.present? ? user.fullname : v.author.name
|
||||
.both
|
||||
%td.td3
|
||||
%span.wiki-gray= "#{l v.committed_date.to_date, :format => :long}:"
|
||||
|
|
|
@ -37,6 +37,7 @@ require './lib/recipes/nginx'
|
|||
require './lib/recipes/unicorn'
|
||||
require './lib/recipes/bluepill'
|
||||
require './lib/recipes/delayed_job'
|
||||
require './lib/recipes/resque'
|
||||
|
||||
namespace :deploy do
|
||||
task :stub_xml_rpc do
|
||||
|
@ -89,6 +90,11 @@ after "deploy:stop", "delayed_job:stop"
|
|||
after "deploy:start", "delayed_job:start"
|
||||
after "deploy:restart", "delayed_job:restart"
|
||||
|
||||
# Resque
|
||||
after "deploy:stop", "resque:stop"
|
||||
after "deploy:start", "resque:start"
|
||||
after "deploy:restart", "resque:restart"
|
||||
|
||||
after "deploy:restart", "deploy:cleanup"
|
||||
|
||||
namespace :rake_tasks do
|
||||
|
|
|
@ -2,7 +2,7 @@ production:
|
|||
action_mailer_host: "abf.rosalinux.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@rosalinux.ru
|
||||
project_name: ABF
|
||||
repo_project_name: ABF
|
||||
build_server_ip: 127.0.0.1
|
||||
|
|
|
@ -12,7 +12,7 @@ production:
|
|||
action_mailer_host: "school.rosalab.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@school.rosalab.ru
|
||||
build_server_ip: 127.0.0.1
|
||||
build_server_port: 12555
|
||||
build_server_path: /xmlrpc
|
||||
|
|
|
@ -2,7 +2,7 @@ production:
|
|||
action_mailer_host: "dev-abf.rosalinux.ru"
|
||||
root_path: /share
|
||||
nginx_log: /srv/rosa_build/shared/log/nginx.access.log
|
||||
do-not-reply-email: do-not-reply@rosalab.ru
|
||||
do-not-reply-email: do-not-reply@dev-abf.rosalinux.ru
|
||||
project_name: ABF
|
||||
repo_project_name: ABF
|
||||
build_server_ip: 127.0.0.1
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# config/initializers/admin.rb
|
||||
class CanAccessResque
|
||||
def self.matches?(request)
|
||||
current_user = request.env['warden'].user
|
||||
return false if current_user.blank?
|
||||
Ability.new(current_user).can? :manage, Resque
|
||||
end
|
||||
end
|
|
@ -100,7 +100,7 @@ en:
|
|||
build_error: Build error
|
||||
build_published: Build has been published
|
||||
rejected_publish: Publishing rejected
|
||||
build_publish: Build is being publishing
|
||||
build_publish: Build is being published
|
||||
failed_publish: Publishing error
|
||||
dependencies_fail: Dependences not found
|
||||
waiting_for_response: Waiting for response
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
en:
|
||||
layout:
|
||||
mass_builds:
|
||||
repositories: Repositories
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Mass Build
|
||||
attributes:
|
||||
mass_build:
|
||||
id: Id
|
||||
name: Name
|
||||
created_at: Created
|
||||
updated_at: Updated
|
||||
arch_names: Architectures
|
||||
user: User
|
||||
auto_publish: Auto Publish
|
||||
repositories: Repositories
|
||||
|
|
|
@ -1,12 +1,17 @@
|
|||
ru:
|
||||
layout:
|
||||
mass_builds:
|
||||
repositories: Репозитории
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Массовая Сборка
|
||||
attributes:
|
||||
mass_build:
|
||||
id: Id
|
||||
name: Название
|
||||
created_at: Создан
|
||||
updated_at: Обновлен
|
||||
arch_names: Архитектуры
|
||||
user: Пользователь
|
||||
auto_publish: Авто Публикация
|
||||
repositories: Репозитории
|
||||
|
|
|
@ -58,6 +58,7 @@ en:
|
|||
unfreeze_error: Platform unfreezing error, try again
|
||||
destroyed: Platform deleted
|
||||
build_all_success: All project build in progress
|
||||
build_all_error: Mass build failed
|
||||
clone_success: Cloned successfully
|
||||
members:
|
||||
already_added: "%{name} is already a member of platform"
|
||||
|
|
|
@ -58,6 +58,7 @@ ru:
|
|||
unfreeze_error: Не удалось разморозить платформу, попробуйте еще раз
|
||||
destroyed: Платформа успешно удалена
|
||||
build_all_success: Все проекты успешно отправлены на сборку
|
||||
build_all_error: Сборка не удалась!
|
||||
clone_success: Клонирование успешно
|
||||
members:
|
||||
already_added: "%{name} уже является участником платформы"
|
||||
|
|
|
@ -4,7 +4,7 @@ app_name = ENV['APP_NAME'] || 'rosa_build'
|
|||
Bluepill.application(app_name) do |app|
|
||||
app.uid = app.gid = 'rosa'
|
||||
app.working_dir = "/srv/#{app_name}/current"
|
||||
%w(fork import hook default).each do |queue|
|
||||
%w(hook default).each do |queue|
|
||||
app.process("delayed_job_#{queue}_queue") do |process|
|
||||
process.start_grace_time = 10.seconds
|
||||
process.stop_grace_time = 10.seconds
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
Rosa::Application.routes.draw do
|
||||
require 'resque/server'
|
||||
|
||||
devise_scope :users do
|
||||
get '/users/auth/:provider' => 'users/omniauth_callbacks#passthru'
|
||||
end
|
||||
|
@ -22,6 +24,10 @@ Rosa::Application.routes.draw do
|
|||
end
|
||||
|
||||
namespace :admin do
|
||||
constraints CanAccessResque do
|
||||
mount Resque::Server, at: 'resque'
|
||||
end
|
||||
|
||||
resources :users do
|
||||
get :list, :on => :collection
|
||||
end
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class SetMassBuildUserIdToFirstIfNil < ActiveRecord::Migration
|
||||
def up
|
||||
MassBuild.update_all(:user_id => nil, :user_id => 1)
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class AddDefaultFalseToAutoPublishOfMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
change_column :mass_builds, :auto_publish, :boolean, :default => false, :null => false
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120523113925) do
|
||||
ActiveRecord::Schema.define(:version => 20120529130537) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -215,11 +215,11 @@ ActiveRecord::Schema.define(:version => 20120523113925) do
|
|||
create_table "mass_builds", :force => true do |t|
|
||||
t.integer "platform_id"
|
||||
t.string "name"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.string "arch_names"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish"
|
||||
t.boolean "auto_publish", :default => false, :null => false
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
Capistrano::Configuration.instance(:must_exist).load do
|
||||
namespace :delayed_job do
|
||||
def dj_queues
|
||||
%w(fork import hook default)
|
||||
%w(hook default)
|
||||
end
|
||||
|
||||
def rails_env
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
Capistrano::Configuration.instance(:must_exist).load do
|
||||
namespace :resque do
|
||||
task :start do
|
||||
start_workers
|
||||
end
|
||||
|
||||
task :stop do
|
||||
stop_workers
|
||||
end
|
||||
|
||||
task :restart do
|
||||
stop_workers
|
||||
start_workers
|
||||
end
|
||||
|
||||
def rails_env
|
||||
fetch(:rails_env, false) ? "RAILS_ENV=#{fetch(:rails_env)}" : ''
|
||||
end
|
||||
|
||||
def stop_workers
|
||||
pids = Array.new
|
||||
|
||||
Resque.workers.each do |worker|
|
||||
pids << worker.to_s.split(/:/).second
|
||||
end
|
||||
|
||||
if pids.size > 0
|
||||
system("kill -QUIT #{pids.join(' ')}")
|
||||
end
|
||||
end
|
||||
|
||||
def start_workers
|
||||
run "cd #{fetch :release_path} && QUEUE=* bundle exec rake resque:work"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -11,6 +11,12 @@ shared_examples_for 'issue user with project reader rights' do
|
|||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
|
||||
it 'should be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should render_template(:index)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples_for 'issue user with project writer rights' do
|
||||
|
@ -187,7 +193,22 @@ describe Projects::IssuesController do
|
|||
|
||||
context 'for guest' do
|
||||
if APP_CONFIG['anonymous_access']
|
||||
it_should_behave_like 'issue user with project reader rights'
|
||||
# it_should_behave_like 'issue user with project reader rights'
|
||||
it 'should be able to perform index action' do
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should render_template(:index)
|
||||
end
|
||||
|
||||
it 'should be able to perform show action' do
|
||||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should render_template(:show)
|
||||
end
|
||||
|
||||
it 'should not be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(forbidden_path)
|
||||
end
|
||||
else
|
||||
it 'should not be able to perform index action' do
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
|
@ -198,6 +219,12 @@ describe Projects::IssuesController do
|
|||
get :show, :owner_name => @project.owner.uname, :project_name => @project.name, :id => @issue.serial_id
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
|
||||
it 'should not be able to perform index action on hidden project' do
|
||||
@project.update_attribute :visibility, 'hidden'
|
||||
get :index, :owner_name => @project.owner.uname, :project_name => @project.name
|
||||
response.should redirect_to(new_user_session_path)
|
||||
end
|
||||
end
|
||||
|
||||
it 'should not be able to perform create action' do
|
||||
|
|
Loading…
Reference in New Issue