2012-07-04 13:15:12 +01:00
|
|
|
class Platforms::MassBuildsController < Platforms::BaseController
|
2013-06-04 20:59:08 +01:00
|
|
|
|
2012-07-02 15:50:47 +01:00
|
|
|
before_filter :authenticate_user!
|
2013-04-01 11:52:12 +01:00
|
|
|
skip_before_filter :authenticate_user!, :only => [:index, :get_list] if APP_CONFIG['anonymous_access']
|
2012-07-02 15:50:47 +01:00
|
|
|
|
2013-06-05 14:48:11 +01:00
|
|
|
load_resource :platform
|
|
|
|
load_and_authorize_resource :through => :platform, :shallow => true
|
|
|
|
|
2013-06-04 20:59:08 +01:00
|
|
|
|
|
|
|
def new
|
|
|
|
end
|
2012-07-03 15:34:07 +01:00
|
|
|
|
|
|
|
def create
|
2013-06-05 14:48:11 +01:00
|
|
|
@mass_build = @platform.mass_builds.build params[:mass_build]
|
|
|
|
@mass_build.user = current_user
|
|
|
|
@mass_build.arches = params[:arches]
|
2013-06-04 20:59:08 +01:00
|
|
|
|
|
|
|
if @mass_build.save
|
2012-07-03 15:34:07 +01:00
|
|
|
redirect_to(platform_mass_builds_path(@platform), :notice => t("flash.platform.build_all_success"))
|
|
|
|
else
|
2013-06-04 20:59:08 +01:00
|
|
|
flash[:warning] = @mass_build.errors.full_messages.join('. ')
|
|
|
|
flash[:error] = t('flash.platform.build_all_error')
|
|
|
|
render :action => :new
|
2012-07-03 15:34:07 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-03-21 14:41:45 +00:00
|
|
|
def publish
|
|
|
|
if params[:status] == 'test_failed'
|
2013-04-02 14:54:18 +01:00
|
|
|
@mass_build.publish_test_faild_builds current_user
|
2013-03-21 14:41:45 +00:00
|
|
|
else
|
2013-04-02 14:54:18 +01:00
|
|
|
@mass_build.publish_success_builds current_user
|
2013-03-21 14:41:45 +00:00
|
|
|
end
|
2013-06-05 14:48:11 +01:00
|
|
|
redirect_to(platform_mass_builds_path(@mass_build.save_to_platform), :notice => t("flash.platform.publish_success"))
|
2013-03-21 14:41:45 +00:00
|
|
|
end
|
|
|
|
|
2012-07-03 15:34:07 +01:00
|
|
|
def index
|
2013-06-04 20:59:08 +01:00
|
|
|
@mass_builds = MassBuild.by_platform(@platform).order('created_at DESC').paginate(:page => params[:page], :per_page => 20)
|
2012-07-03 15:34:07 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
def cancel
|
2012-07-02 15:50:47 +01:00
|
|
|
@mass_build.cancel_all
|
|
|
|
flash[:notice] = t("flash.platform.cancel_mass_build")
|
2013-06-05 14:48:11 +01:00
|
|
|
redirect_to platform_mass_builds_path(@mass_build.save_to_platform)
|
2012-07-02 15:50:47 +01:00
|
|
|
end
|
|
|
|
|
2012-12-06 17:59:17 +00:00
|
|
|
def get_list
|
2013-06-05 14:48:11 +01:00
|
|
|
text = if params[:kind] == 'failed_builds_list'
|
|
|
|
@mass_build.generate_failed_builds_list
|
|
|
|
elsif ['projects_list', 'missed_projects_list'].include? params[:kind]
|
|
|
|
@mass_build.send params[:kind]
|
|
|
|
end
|
2012-12-06 17:59:17 +00:00
|
|
|
render :text => text
|
2012-07-02 15:50:47 +01:00
|
|
|
end
|
|
|
|
end
|