#794: small refactoring

This commit is contained in:
Vokhmin Alexey V 2013-01-16 19:16:42 +04:00
parent 097ffacf61
commit c6f13c60b7
3 changed files with 3 additions and 8 deletions

View File

@ -154,7 +154,7 @@ class Ability
cannot([:get_list, :create], MassBuild) {|mass_build| mass_build.platform.personal?}
cannot(:cancel, MassBuild) {|mass_build| mass_build.platform.personal? || mass_build.stop_build}
if @user.uname == 'iso_worker_1'
if @user.system?
can :key_pair, Repository
else
cannot :key_pair, Repository

View File

@ -14,16 +14,12 @@ class KeyPair < ActiveRecord::Base
validates :repository_id, :uniqueness => {:message => I18n.t("activerecord.errors.key_pair.repo_key_exists")}
validate :check_keys
before_create :set_key_id
before_create { |record| record.key_id = @fingerprint }
after_create :resign_rpms,
:unless => Proc.new { |key_pair| key_pair.repository.platform.personal? }
protected
def set_key_id
self.key_id = @fingerprint
end
def resign_rpms
platform = repository.platform
type = platform.distrib_type

View File

@ -52,8 +52,7 @@ APP_CONFIG['git_path'] = "#{Rails.root}/tmp/test_root"
def init_test_root
clear_test_root
%x(mkdir -p #{APP_CONFIG['root_path']}/platforms)
%x(mkdir -p #{APP_CONFIG['root_path']}/tmp)
%x(mkdir -p #{APP_CONFIG['root_path']}/{platforms,tmp})
end
def clear_test_root