Merge branch 'master' into 90-pull
Conflicts: db/schema.rb
This commit is contained in:
commit
89abd20c95
|
@ -71,4 +71,14 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
|
||||
$(".toggle_btn").click(function() {
|
||||
var target = $( $(this).attr('data-target') );
|
||||
//target.toggle();
|
||||
if ( target.css('visibility') == 'hidden' ) {
|
||||
target.css('visibility', 'visible');
|
||||
} else {
|
||||
target.css('visibility', 'hidden');
|
||||
}
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,157 +0,0 @@
|
|||
/* =============================================================
|
||||
* bootstrap-collapse.js v2.0.4
|
||||
* http://twitter.github.com/bootstrap/javascript.html#collapse
|
||||
* =============================================================
|
||||
* Copyright 2012 Twitter, Inc.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* ============================================================ */
|
||||
|
||||
|
||||
!function ($) {
|
||||
|
||||
"use strict"; // jshint ;_;
|
||||
|
||||
|
||||
/* COLLAPSE PUBLIC CLASS DEFINITION
|
||||
* ================================ */
|
||||
|
||||
var Collapse = function (element, options) {
|
||||
this.$element = $(element)
|
||||
this.options = $.extend({}, $.fn.collapse.defaults, options)
|
||||
|
||||
if (this.options.parent) {
|
||||
this.$parent = $(this.options.parent)
|
||||
}
|
||||
|
||||
this.options.toggle && this.toggle()
|
||||
}
|
||||
|
||||
Collapse.prototype = {
|
||||
|
||||
constructor: Collapse
|
||||
|
||||
, dimension: function () {
|
||||
var hasWidth = this.$element.hasClass('width')
|
||||
return hasWidth ? 'width' : 'height'
|
||||
}
|
||||
|
||||
, show: function () {
|
||||
var dimension
|
||||
, scroll
|
||||
, actives
|
||||
, hasData
|
||||
|
||||
if (this.transitioning) return
|
||||
|
||||
dimension = this.dimension()
|
||||
scroll = $.camelCase(['scroll', dimension].join('-'))
|
||||
actives = this.$parent && this.$parent.find('> .accordion-group > .in')
|
||||
|
||||
if (actives && actives.length) {
|
||||
hasData = actives.data('collapse')
|
||||
if (hasData && hasData.transitioning) return
|
||||
actives.collapse('hide')
|
||||
hasData || actives.data('collapse', null)
|
||||
}
|
||||
|
||||
this.$element[dimension](0)
|
||||
this.transition('addClass', $.Event('show'), 'shown')
|
||||
this.$element[dimension](this.$element[0][scroll])
|
||||
}
|
||||
|
||||
, hide: function () {
|
||||
var dimension
|
||||
if (this.transitioning) return
|
||||
dimension = this.dimension()
|
||||
this.reset(this.$element[dimension]())
|
||||
this.transition('removeClass', $.Event('hide'), 'hidden')
|
||||
this.$element[dimension](0)
|
||||
}
|
||||
|
||||
, reset: function (size) {
|
||||
var dimension = this.dimension()
|
||||
|
||||
this.$element
|
||||
.removeClass('collapse')
|
||||
[dimension](size || 'auto')
|
||||
[0].offsetWidth
|
||||
|
||||
this.$element[size !== null ? 'addClass' : 'removeClass']('collapse')
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
, transition: function (method, startEvent, completeEvent) {
|
||||
var that = this
|
||||
, complete = function () {
|
||||
if (startEvent.type == 'show') that.reset()
|
||||
that.transitioning = 0
|
||||
that.$element.trigger(completeEvent)
|
||||
}
|
||||
|
||||
this.$element.trigger(startEvent)
|
||||
|
||||
if (startEvent.isDefaultPrevented()) return
|
||||
|
||||
this.transitioning = 1
|
||||
|
||||
this.$element[method]('in')
|
||||
|
||||
$.support.transition && this.$element.hasClass('collapse') ?
|
||||
this.$element.one($.support.transition.end, complete) :
|
||||
complete()
|
||||
}
|
||||
|
||||
, toggle: function () {
|
||||
this[this.$element.hasClass('in') ? 'hide' : 'show']()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/* COLLAPSIBLE PLUGIN DEFINITION
|
||||
* ============================== */
|
||||
|
||||
$.fn.collapse = function (option) {
|
||||
return this.each(function () {
|
||||
var $this = $(this)
|
||||
, data = $this.data('collapse')
|
||||
, options = typeof option == 'object' && option
|
||||
if (!data) $this.data('collapse', (data = new Collapse(this, options)))
|
||||
if (typeof option == 'string') data[option]()
|
||||
})
|
||||
}
|
||||
|
||||
$.fn.collapse.defaults = {
|
||||
toggle: true
|
||||
}
|
||||
|
||||
$.fn.collapse.Constructor = Collapse
|
||||
|
||||
|
||||
/* COLLAPSIBLE DATA-API
|
||||
* ==================== */
|
||||
|
||||
$(function () {
|
||||
$('body').on('click.collapse.data-api', '[data-toggle=collapse]', function ( e ) {
|
||||
var $this = $(this), href
|
||||
, target = $this.attr('data-target')
|
||||
|| e.preventDefault()
|
||||
|| (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7
|
||||
, option = $(target).data('collapse') ? 'toggle' : $this.data()
|
||||
$(target).collapse(option)
|
||||
})
|
||||
})
|
||||
|
||||
}(window.jQuery);
|
|
@ -1088,3 +1088,14 @@ form.mass_build section.left {
|
|||
form.mass_build section.right {
|
||||
margin-right: 50px;
|
||||
}
|
||||
|
||||
.toggle {
|
||||
overflow: hidden;
|
||||
padding-top: 10px;
|
||||
display: block;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.min_width_120 {
|
||||
min-width: 120px;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
if mass_build.save
|
||||
redirect_to(mass_builds_platform_path(@platform), :notice => t("flash.platform.build_all_success"))
|
||||
else
|
||||
@auto_publish_selected = params[:auto_publish].present?
|
||||
@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")
|
||||
|
@ -26,9 +27,15 @@ class Platforms::PlatformsController < Platforms::BaseController
|
|||
|
||||
def mass_builds
|
||||
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
||||
@auto_publish_selected = true
|
||||
render :action => :build_all
|
||||
end
|
||||
|
||||
def failed_builds_list
|
||||
@mass_build = MassBuild.find params[:mass_build_id]
|
||||
render :text => @mass_build.generate_failed_builds_list
|
||||
end
|
||||
|
||||
def index
|
||||
@platforms = @platforms.accessible_by(current_ability, :related).paginate(:page => params[:page], :per_page => 20)
|
||||
end
|
||||
|
|
|
@ -11,14 +11,13 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
before_filter :find_product_build_list, :only => [:status_build]
|
||||
|
||||
def create
|
||||
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}", :notified_at => Time.current
|
||||
@product.product_build_lists.create! :base_url => "http://#{request.host_with_port}"
|
||||
flash[:notice] = t('flash.product.build_started')
|
||||
redirect_to [@platform, @product]
|
||||
end
|
||||
|
||||
def status_build
|
||||
@product_build_list.status = params[:status].to_i # ProductBuildList::BUILD_COMPLETED : ProductBuildList::BUILD_FAILED)
|
||||
@product_build_list.notified_at = Time.current
|
||||
@product_build_list.save!
|
||||
render :nothing => true
|
||||
end
|
||||
|
@ -46,7 +45,8 @@ class Platforms::ProductBuildListsController < Platforms::BaseController
|
|||
end
|
||||
|
||||
def authenticate_product_builder!
|
||||
unless APP_CONFIG['product_builder_ip'].values.include?(request.remote_ip)
|
||||
# FIXME: Rails(?) interpret the internal IP as 127.0.0.1
|
||||
unless (APP_CONFIG['product_builder_ip'].values + ["127.0.0.1"]).include?(request.remote_ip)
|
||||
render :nothing => true, :status => 403
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ class Ability
|
|||
can :read, PullRequest, :project => {:visibility => 'open'}
|
||||
can :search, BuildList
|
||||
can :read, BuildList, :project => {:visibility => 'open'}
|
||||
can :read, ProductBuildList, :product => {:platform => {:visibility => 'open'}}
|
||||
can :read, ProductBuildList#, :product => {:platform => {:visibility => 'open'}} # double nested hash don't work
|
||||
can :read, Advisory
|
||||
can(:advisories, Platform) {APP_CONFIG['anonymous_access']}
|
||||
# Core callbacks
|
||||
|
|
|
@ -6,7 +6,7 @@ class BuildList < ActiveRecord::Base
|
|||
belongs_to :build_for_platform, :class_name => 'Platform'
|
||||
belongs_to :user
|
||||
belongs_to :advisory
|
||||
belongs_to :mass_build
|
||||
belongs_to :mass_build, :counter_cache => true
|
||||
has_many :items, :class_name => "BuildList::Item", :dependent => :destroy
|
||||
has_many :packages, :class_name => "BuildList::Package", :dependent => :destroy
|
||||
|
||||
|
@ -103,6 +103,19 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
state_machine :status, :initial => :waiting_for_response do
|
||||
|
||||
# WTF? around_transition -> infinite loop
|
||||
before_transition do |build_list, transition|
|
||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
|
||||
MassBuild.decrement_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
after_transition do |build_list, transition|
|
||||
if build_list.mass_build && MassBuild::COUNT_STATUSES.include?(build_list.status)
|
||||
MassBuild.increment_counter "#{BuildList::HUMAN_STATUSES[build_list.status].to_s}_count", build_list.mass_build_id
|
||||
end
|
||||
end
|
||||
|
||||
after_transition :on => :published, :do => :set_version_and_tag
|
||||
|
||||
event :place_build do
|
||||
|
@ -172,6 +185,8 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
def set_version_and_tag
|
||||
pkg = self.packages.where(:package_type => 'source', :project_id => self.project_id).first
|
||||
# TODO: remove 'return' after deployment ABF kernel 2.0
|
||||
return if pkg.nil? # For old client that does not sends data about packages
|
||||
self.package_version = "#{pkg.platform.name}-#{pkg.version}-#{pkg.release}"
|
||||
system("cd #{self.project.git_repository.path} && git tag #{self.package_version} #{self.commit_hash}") # TODO REDO through grit
|
||||
save
|
||||
|
@ -179,7 +194,7 @@ class BuildList < ActiveRecord::Base
|
|||
|
||||
#TODO: Share this checking on product owner.
|
||||
def can_cancel?
|
||||
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include? status && bs_id
|
||||
[BUILD_PENDING, BuildServer::PLATFORM_PENDING].include?(status) && bs_id
|
||||
end
|
||||
|
||||
def can_publish?
|
||||
|
|
|
@ -12,6 +12,15 @@ class MassBuild < ActiveRecord::Base
|
|||
|
||||
after_create :build_all
|
||||
|
||||
COUNT_STATUSES = [
|
||||
:build_lists,
|
||||
:build_published,
|
||||
:build_pending,
|
||||
:build_started,
|
||||
:build_publish,
|
||||
:build_error
|
||||
]
|
||||
|
||||
def initialize(args = nil)
|
||||
super
|
||||
|
||||
|
@ -32,4 +41,13 @@ class MassBuild < ActiveRecord::Base
|
|||
:auto_publish => self.auto_publish
|
||||
) # later with resque
|
||||
end
|
||||
|
||||
def generate_failed_builds_list
|
||||
report = ""
|
||||
BuildList.where(:status => BuildServer::BUILD_ERROR, :mass_build_id => self.id).each do |build_list|
|
||||
report << "ID: #{build_list.id}; "
|
||||
report << "PROJECT_NAME: #{build_list.project.name}\n"
|
||||
end
|
||||
report
|
||||
end
|
||||
end
|
||||
|
|
|
@ -20,11 +20,11 @@ class ProductBuildList < ActiveRecord::Base
|
|||
validates :status, :inclusion => { :in => [BUILD_STARTED, BUILD_COMPLETED, BUILD_FAILED] }
|
||||
|
||||
attr_accessor :base_url
|
||||
attr_accessible :status, :notified_at, :base_url
|
||||
attr_accessible :status, :base_url
|
||||
attr_readonly :product_id
|
||||
|
||||
|
||||
scope :default_order, order('notified_at DESC')
|
||||
scope :default_order, order('updated_at DESC')
|
||||
scope :for_status, lambda {|status| where(:status => status) }
|
||||
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}%")}
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
.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'
|
||||
= check_box_tag :auto_publish, true, @auto_publish_selected, :id => 'auto_publish'
|
||||
= label_tag :auto_publish
|
||||
|
||||
%br
|
||||
|
@ -30,16 +30,31 @@
|
|||
%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')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.auto_publish')
|
||||
%th.lpadding16= t('activerecord.attributes.mass_build.created_at')
|
||||
%th.lpadding16= t("layout.mass_builds.statuses")
|
||||
%th.lpadding16= t("layout.mass_builds.failed_builds_list")
|
||||
%th.lpadding16= t("layout.mass_builds.extended_data")
|
||||
- @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= link_to mass_build.user.fullname, mass_build.user
|
||||
%td= mass_build.auto_publish
|
||||
%td= mass_build.created_at
|
||||
%td.min_width_120
|
||||
- MassBuild::COUNT_STATUSES.each do |status|
|
||||
= link_to t("layout.build_lists.statuses.#{status}") + ": ", build_lists_path(:filter => {:status => status, :mass_build_id => mass_build.id})
|
||||
= mass_build.read_attribute "#{status}_count"
|
||||
.both
|
||||
%td= link_to t("layout.mass_builds.failed_builds_list"), failed_builds_list_platforms_path(:mass_build_id => mass_build.id), :target => "_blank"
|
||||
%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 }"}
|
||||
= t('activerecord.attributes.mass_build.arch_names') + ": "
|
||||
= mass_build.arch_names
|
||||
.both
|
||||
= t('activerecord.attributes.mass_build.user') + ": "
|
||||
= link_to mass_build.user.fullname, mass_build.user
|
||||
.both
|
||||
= t('activerecord.attributes.mass_build.auto_publish') + ": "
|
||||
= mass_build.auto_publish
|
||||
.both
|
||||
= t('activerecord.attributes.mass_build.created_at') + ": "
|
||||
= mass_build.created_at
|
||||
= will_paginate @mass_builds
|
||||
|
|
|
@ -3,6 +3,5 @@
|
|||
%td= product_build_list.human_status
|
||||
%td= link_to nil, product_build_list.container_path
|
||||
%td= link_to product_build_list.product.name, platform_product_path(product_build_list.product.platform, product_build_list.product)
|
||||
-#%td= link_to product_build_list.user.try(:fullname), product_build_list.user
|
||||
%td= link_to image_tag('x.png'), platform_product_product_build_list_path(product_build_list.product.platform, product_build_list.product, product_build_list), :method => :delete, :confirm => t("layout.confirm") if can? :destroy, product_build_list
|
||||
%td= l(product_build_list.notified_at, :format => :long)
|
||||
%td= l(product_build_list.updated_at, :format => :long)
|
|
@ -6,7 +6,6 @@
|
|||
%th.lpadding16= t("activerecord.attributes.product_build_list.status")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.container_path")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.product")
|
||||
-#%th.lpadding16= t("activerecord.attributes.product_build_list.user")
|
||||
%th= t("layout.product_build_lists.action")
|
||||
%th.lpadding16= t("activerecord.attributes.product_build_list.notified_at")
|
||||
%tbody= render :partial => 'platforms/product_build_lists/product_build_list', :collection => @product_build_lists
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
%td= link_to build_list.project_version, "#"
|
||||
%td= build_list.arch.name
|
||||
%td= link_to build_list.user.try(:fullname), build_list.user
|
||||
%td= link_to image_tag('x.png', :class => 'delete-row', :id => "delete-row#{build_list_counter}"), cancel_build_list_path(build_list), :method => :put, :confirm => t('layout.confirm') if build_list.can_cancel? and can?(:cancel, build_list)
|
||||
%td= link_to image_tag('x.png', :class => 'delete-row', :id => "delete-row#{build_list_counter}"), cancel_build_list_path(build_list), :method => :put, :confirm => t('layout.confirm') if can?(:cancel, build_list)
|
||||
%td= build_list.updated_at
|
||||
|
|
|
@ -97,6 +97,7 @@ en:
|
|||
git_error: Git error
|
||||
|
||||
statuses:
|
||||
build_lists: All
|
||||
build_error: Build error
|
||||
build_published: Build has been published
|
||||
rejected_publish: Publishing rejected
|
||||
|
|
|
@ -96,6 +96,7 @@ ru:
|
|||
git_error: проблема с гит
|
||||
|
||||
statuses:
|
||||
build_lists: Всего
|
||||
build_error: ошибка сборки
|
||||
build_published: опубликован
|
||||
rejected_publish: публикация отклонена
|
||||
|
|
|
@ -2,6 +2,9 @@ en:
|
|||
layout:
|
||||
mass_builds:
|
||||
repositories: Repositories
|
||||
extended_data: Extended data
|
||||
failed_builds_list: Failed Builds List
|
||||
statuses: Statuses
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Mass Build
|
||||
|
|
|
@ -2,6 +2,9 @@ ru:
|
|||
layout:
|
||||
mass_builds:
|
||||
repositories: Репозитории
|
||||
extended_data: Параметры задания
|
||||
failed_builds_list: Список ошибок сборок
|
||||
statuses: Статусы
|
||||
activerecord:
|
||||
models:
|
||||
mass_build: Массовая Сборка
|
||||
|
|
|
@ -10,7 +10,7 @@ en:
|
|||
'2': 'build in progress'
|
||||
build_failed: Build failed
|
||||
build_started: Build in progress
|
||||
build_completed: Build
|
||||
build_completed: Builded
|
||||
|
||||
ownership:
|
||||
header: Build list ownership
|
||||
|
|
|
@ -55,6 +55,9 @@ Rosa::Application.routes.draw do
|
|||
get :mass_builds
|
||||
get :advisories
|
||||
end
|
||||
collection do
|
||||
get :failed_builds_list
|
||||
end
|
||||
get :autocomplete_user_uname, :on => :collection
|
||||
resources :repositories do
|
||||
member do
|
||||
|
@ -71,6 +74,7 @@ Rosa::Application.routes.draw do
|
|||
match '/private/:platform_name/*file_path' => 'privates#show'
|
||||
|
||||
resources :product_build_lists, :only => [:index]
|
||||
match 'product_status', :to => 'product_build_lists#status_build'
|
||||
end
|
||||
|
||||
scope :module => 'users' do
|
||||
|
@ -115,7 +119,6 @@ Rosa::Application.routes.draw do
|
|||
match 'build_lists/pre_build', :to => "build_lists#pre_build"
|
||||
match 'build_lists/circle_build', :to => "build_lists#circle_build"
|
||||
match 'build_lists/new_bbdt', :to => "build_lists#new_bbdt"
|
||||
match 'product_status', :to => 'product_build_lists#status_build'
|
||||
|
||||
resources :build_lists, :only => [:index, :show, :update] do
|
||||
member do
|
||||
|
@ -190,31 +193,33 @@ Rosa::Application.routes.draw do
|
|||
get '/sections' => 'projects#sections', :as => :sections_project
|
||||
post '/sections' => 'projects#sections'
|
||||
delete '/remove_user' => 'projects#remove_user', :as => :remove_user_project
|
||||
# Tree
|
||||
get '/' => "git/trees#show", :as => :project
|
||||
get '/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree, :format => false
|
||||
# Commits
|
||||
get '/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false
|
||||
get '/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
||||
# Commit comments
|
||||
post '/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
|
||||
get '/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
|
||||
put '/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
||||
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
||||
# Commit subscribes
|
||||
post '/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
||||
delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
||||
# Editing files
|
||||
get '/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
|
||||
put '/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
|
||||
# Blobs
|
||||
get '/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :format => false
|
||||
# Blame
|
||||
get '/blame/:treeish/*path' => "git/blobs#blame", :defaults => {:treeish => :master}, :as => :blame, :format => false
|
||||
# Raw
|
||||
get '/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
|
||||
# Archive
|
||||
get '/archive/:format/tree/:treeish' => "git/trees#archive", :defaults => {:treeish => :master}, :as => :archive, :format => /zip|tar/
|
||||
constraints :treeish => /[^\/]+/ do
|
||||
# Tree
|
||||
get '/' => "git/trees#show", :as => :project
|
||||
get '/tree/:treeish(/*path)' => "git/trees#show", :defaults => {:treeish => :master}, :as => :tree, :format => false
|
||||
# Commits
|
||||
get '/commits/:treeish(/*path)' => "git/commits#index", :defaults => {:treeish => :master}, :as => :commits, :format => false
|
||||
get '/commit/:id(.:format)' => "git/commits#show", :as => :commit
|
||||
# Commit comments
|
||||
post '/commit/:commit_id/comments(.:format)' => "comments#create", :as => :project_commit_comments
|
||||
get '/commit/:commit_id/comments/:id(.:format)' => "comments#edit", :as => :edit_project_commit_comment
|
||||
put '/commit/:commit_id/comments/:id(.:format)' => "comments#update", :as => :project_commit_comment
|
||||
delete '/commit/:commit_id/comments/:id(.:format)' => "comments#destroy"
|
||||
# Commit subscribes
|
||||
post '/commit/:commit_id/subscribe' => "commit_subscribes#create", :as => :subscribe_commit
|
||||
delete '/commit/:commit_id/unsubscribe' => "commit_subscribes#destroy", :as => :unsubscribe_commit
|
||||
# Editing files
|
||||
get '/blob/:treeish/*path/edit' => "git/blobs#edit", :defaults => {:treeish => :master}, :as => :edit_blob
|
||||
put '/blob/:treeish/*path' => "git/blobs#update", :defaults => {:treeish => :master}, :format => false
|
||||
# Blobs
|
||||
get '/blob/:treeish/*path' => "git/blobs#show", :defaults => {:treeish => :master}, :as => :blob, :format => false
|
||||
# Blame
|
||||
get '/blame/:treeish/*path' => "git/blobs#blame", :defaults => {:treeish => :master}, :as => :blame, :format => false
|
||||
# Raw
|
||||
get '/raw/:treeish/*path' => "git/blobs#raw", :defaults => {:treeish => :master}, :as => :raw, :format => false
|
||||
# Archive
|
||||
get '/archive/:format/tree/:treeish' => "git/trees#archive", :defaults => {:treeish => :master}, :as => :archive, :format => /zip|tar/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
class AddCountersToMassBuilds < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :mass_builds, :build_lists_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_published_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_pending_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_started_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_publish_count, :integer, :default => 0
|
||||
add_column :mass_builds, :build_error_count, :integer, :default => 0
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class RemoveProductNotifiedAt < ActiveRecord::Migration
|
||||
def up
|
||||
remove_column :product_build_lists, :notified_at
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :product_build_lists, :notified_at, :datetime
|
||||
end
|
||||
end
|
21
db/schema.rb
21
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120627101821) do
|
||||
ActiveRecord::Schema.define(:version => 20120628165702) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -199,11 +199,17 @@ ActiveRecord::Schema.define(:version => 20120627101821) 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", :default => false, :null => false
|
||||
t.boolean "auto_publish", :default => false, :null => false
|
||||
t.integer "build_lists_count", :default => 0
|
||||
t.integer "build_published_count", :default => 0
|
||||
t.integer "build_pending_count", :default => 0
|
||||
t.integer "build_started_count", :default => 0
|
||||
t.integer "build_publish_count", :default => 0
|
||||
t.integer "build_error_count", :default => 0
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
@ -233,10 +239,9 @@ ActiveRecord::Schema.define(:version => 20120627101821) do
|
|||
|
||||
create_table "product_build_lists", :force => true do |t|
|
||||
t.integer "product_id"
|
||||
t.integer "status", :default => 2, :null => false
|
||||
t.datetime "notified_at"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.integer "status", :default => 2, :null => false
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
|
|
@ -20,12 +20,13 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|||
end
|
||||
|
||||
def stop_workers
|
||||
ps = 'ps aux | grep resque | grep -v grep'
|
||||
run "#{ps} && kill -QUIT `#{ps} | awk '{ print $2 }'` || echo 'Workers already stopped!'"
|
||||
# ps = 'ps aux | grep resque | grep -v grep'
|
||||
# run "#{ps} && kill -QUIT `#{ps} | awk '{ print $2 }'` || echo 'Workers already stopped!'"
|
||||
run "cd #{fetch :current_path} && #{rails_env} bundle exec rake resque:stop_workers"
|
||||
end
|
||||
|
||||
def start_workers
|
||||
run "cd #{fetch :current_path} && COUNT=#{ workers_count } QUEUE=fork_import,hook,clone_build,notification #{ rails_env } BACKGROUND=yes bundle exec rake resque:workers"
|
||||
run "cd #{fetch :current_path} && COUNT=#{workers_count} QUEUE=fork_import,hook,clone_build,notification #{rails_env} BACKGROUND=yes bundle exec rake resque:workers"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
namespace :resque do
|
||||
desc 'Stop all Resque workers'
|
||||
task :stop_workers => :environment do
|
||||
pids = []
|
||||
Resque.workers.each do |worker|
|
||||
pids << worker.to_s.split(/:/).second
|
||||
end
|
||||
system("kill -QUIT #{pids.join(' ')}") if pids.size > 0
|
||||
end
|
||||
end
|
|
@ -13,23 +13,14 @@
|
|||
<!--Main menu-->
|
||||
<menu>
|
||||
<div class="logo">
|
||||
<a href="#"><img src="/pics/logo-mini.png" alt="Logo"></a>
|
||||
<a href="/"><img src="/pics/logo-mini.png" alt="Logo"></a>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/">Main</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/projects">Projects</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/groups">Groups</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/build_lists">Monitoring</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/platforms">Platforms</a>
|
||||
<a href="/advisories">Advisories</a>
|
||||
</li>
|
||||
</ul>
|
||||
</menu>
|
||||
|
@ -41,7 +32,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="right">
|
||||
</div>
|
||||
|
@ -51,12 +42,12 @@
|
|||
|
||||
<div class="both">
|
||||
</div>
|
||||
|
||||
|
||||
<!--Page-->
|
||||
<article>
|
||||
<!--Single page content-->
|
||||
<div class="all error404">
|
||||
|
||||
|
||||
<h1>Error <span>404</span></h1>
|
||||
<h2>Page not found</h2>
|
||||
<p class="pages">
|
||||
|
@ -66,9 +57,9 @@
|
|||
Or use the search.
|
||||
</p>
|
||||
<div class="both"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="both">
|
||||
</div>
|
||||
</article>
|
||||
|
|
|
@ -13,23 +13,14 @@
|
|||
<!--Main menu-->
|
||||
<menu>
|
||||
<div class="logo">
|
||||
<a href="#"><img src="/pics/logo-mini.png" alt="Logo"></a>
|
||||
<a href="/"><img src="/pics/logo-mini.png" alt="Logo"></a>
|
||||
</div>
|
||||
<ul>
|
||||
<li>
|
||||
<a href="/">Main</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/projects">Projects</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/groups">Groups</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/build_lists">Monitoring</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/platforms">Platforms</a>
|
||||
<a href="/advisories">Advisories</a>
|
||||
</li>
|
||||
</ul>
|
||||
</menu>
|
||||
|
@ -41,7 +32,7 @@
|
|||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="right">
|
||||
</div>
|
||||
|
@ -51,12 +42,12 @@
|
|||
|
||||
<div class="both">
|
||||
</div>
|
||||
|
||||
|
||||
<!--Page-->
|
||||
<article>
|
||||
<!--Single page content-->
|
||||
<div class="all error500">
|
||||
|
||||
|
||||
<h1>Error <span>500</span></h1>
|
||||
<h2>Something went wrong.<br>
|
||||
We've been notified about this issue<br>
|
||||
|
@ -68,9 +59,9 @@
|
|||
Or use the search.
|
||||
</p>
|
||||
<div class="both"></div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<div class="both">
|
||||
</div>
|
||||
</article>
|
||||
|
|
|
@ -21,7 +21,14 @@ describe ProductBuildList do
|
|||
it { should_not allow_mass_assignment_of(:product_id) }
|
||||
|
||||
it { should allow_mass_assignment_of(:status) }
|
||||
it { should allow_mass_assignment_of(:notified_at) }
|
||||
it { should allow_mass_assignment_of(:base_url) }
|
||||
|
||||
|
||||
# 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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -36,8 +36,9 @@ describe Projects::Git::TreesController do
|
|||
|
||||
it "routes to #show" do
|
||||
get("/import/glib2.0-mib").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib')
|
||||
get("/import/glib2.0-mib/tree/branch").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'branch')
|
||||
get("/import/glib2.0-mib/tree/branch/some/path.to").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'branch', :path => 'some/path.to')
|
||||
get("/import/glib2.0-mib/tree/lib2safe-0.03").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'lib2safe-0.03')
|
||||
get("/import/glib2.0-mib/tree/branch-with.dot/folder_with.dot/path-with.dot").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'branch-with.dot', :path => 'folder_with.dot/path-with.dot')
|
||||
# get("/import/glib2.0-mib/tree/ветка-с.точкой/папка_с.точкой/путь-с.точкой").should route_to("projects/git/trees#show", :owner_name => 'import', :project_name => 'glib2.0-mib', :treeish => 'ветка-с.точкой', :path => 'папка_с.точкой/путь-с.точкой')
|
||||
end
|
||||
|
||||
# TODO write more specs also with slash in branch name!
|
||||
|
|
Loading…
Reference in New Issue