#156: removed unnecessary code
This commit is contained in:
parent
e6a0a4d299
commit
f3bcf89ab6
|
@ -1,24 +1,10 @@
|
|||
#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, :publish]
|
||||
# skip_authorize_resource :platform, :only => [:index, :create]
|
||||
|
||||
|
||||
|
||||
NESTED_ACTIONS = [:index, :new, :create]
|
||||
|
||||
before_filter :authenticate_user!
|
||||
skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access']
|
||||
|
||||
# before_filter :find_mass_build, :only => [:publish, :cancel]
|
||||
|
||||
load_and_authorize_resource :platform, :only => NESTED_ACTIONS
|
||||
load_and_authorize_resource :mass_build, :through => :platform, :only => NESTED_ACTIONS, :shallow => true
|
||||
load_and_authorize_resource :except => NESTED_ACTIONS
|
||||
|
|
|
@ -113,38 +113,6 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
}
|
||||
end
|
||||
|
||||
# def autocomplete_to_extra_repos_and_builds
|
||||
# results, save_to_platform = [], Platform.find(params[:platform_id])
|
||||
# if params[:search_repos].present? && save_to_platform.personal?
|
||||
# # Only personal repositories can be attached to the build
|
||||
# platforms = Platform.includes(:repositories).personal.search(params[:term]).
|
||||
# accessible_by(current_ability, :read).search_order.limit(5)
|
||||
# platforms.each{ |p| p.repositories.each{ |r| results << {:id => r.id, :label => "#{p.name}/#{r.name}", :value => "#{p.name}/#{r.name}"} } }
|
||||
# elsif params[:search_repos].blank?
|
||||
# bl = BuildList.where(:id => params[:term]).published_container.accessible_by(current_ability, :read)
|
||||
# bl = bl.where(:save_to_platform_id => save_to_platform.id) if save_to_platform.main?
|
||||
# bl = bl.first
|
||||
# results << {:id => bl.id, :value => bl.id, :label => "#{bl.id} (#{bl.project.name} - #{bl.arch.name})"} if bl
|
||||
# end
|
||||
# render json: results.to_json
|
||||
# end
|
||||
|
||||
# def update_extra_repos_and_builds
|
||||
# results, save_to_repository = [], Repository.find(params[:build_list][:save_to_repository_id])
|
||||
# if params[:update_repos].present?
|
||||
# extra_repos = params[:build_list][:extra_repositories] || []
|
||||
# extra_repos << params[:extra_repos] if params[:extra_repos].present?
|
||||
# results = Repository.where(:id => extra_repos).accessible_by(current_ability, :read) if save_to_repository.platform.personal?
|
||||
# results |= [save_to_repository] if save_to_repository.platform.personal?
|
||||
# else
|
||||
# extra_bls = params[:build_list][:extra_build_lists] || []
|
||||
# extra_bls << params[:extra_build_lists] if params[:extra_build_lists].present?
|
||||
# results = BuildList.where(:id => extra_bls).published_container.accessible_by(current_ability, :read)
|
||||
# results = results.where(:save_to_platform_id => save_to_repository.platform_id) if save_to_repository.platform.main?
|
||||
# end
|
||||
# render :partial => 'extra', :collection => results
|
||||
# end
|
||||
|
||||
protected
|
||||
|
||||
def find_build_list
|
||||
|
|
|
@ -78,7 +78,6 @@ class Ability
|
|||
|
||||
can([:read, :create, :edit, :destroy, :update], Hook) {|hook| can?(:edit, hook.project)}
|
||||
|
||||
# can [:autocomplete_to_extra_repos_and_builds, :update_extra_repos_and_builds], BuildList
|
||||
can [:read, :log, :owned, :everything], BuildList, :user_id => user.id
|
||||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'User', :owner_id => user.id}
|
||||
can [:read, :log, :related, :everything], BuildList, :project => {:owner_type => 'Group', :owner_id => user.group_ids}
|
||||
|
|
|
@ -18,7 +18,7 @@ class MassBuild < ActiveRecord::Base
|
|||
validates :save_to_platform_id, :build_for_platform_id, :arch_names, :name, :user_id, :projects_list, :presence => true
|
||||
validates_inclusion_of :auto_publish, :in => [true, false]
|
||||
|
||||
after_commit :build_all
|
||||
after_create :build_all
|
||||
before_validation :set_data, :on => :create
|
||||
|
||||
COUNT_STATUSES = [
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
require 'highline/import'
|
||||
require 'open-uri'
|
||||
|
||||
namespace :build do
|
||||
desc "Build projects from list"
|
||||
task :projects => :environment do
|
||||
source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/rebuild_list.txt'
|
||||
owner = User.find_by_uname!(ENV['OWNER'] || 'warpc')
|
||||
platform = Platform.find_by_name!(ENV['PLATFORM'] || 'rosa2012lts')
|
||||
arch = Arch.find_by_name!(ENV['ARCH'] || 'i586')
|
||||
|
||||
say "START build projects from #{source} for platform=#{platform.name}, owner=#{owner.uname}, arch=#{arch.name}"
|
||||
open(source).readlines.each do |name|
|
||||
name.chomp!; name.strip! #; name.downcase!
|
||||
if p = Project.joins(:repositories).where('repositories.id IN (?)', platform.repositories).find_by_name(name)
|
||||
# Old code p.build_for(platform, platform, owner, arch)
|
||||
say "== Build #{p.name} =="
|
||||
else
|
||||
say "== Not found #{name} =="
|
||||
end
|
||||
sleep 0.2
|
||||
end
|
||||
say 'DONE'
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue