Merge branch 'master' of github.com:warpc/rosa-build
This commit is contained in:
commit
69a0277c58
|
@ -20,7 +20,7 @@ class Platform < ActiveRecord::Base
|
|||
after_create :make_owner_rel
|
||||
# before_save :create_directory
|
||||
before_save :make_owner_rel
|
||||
after_destroy :remove_directory
|
||||
# after_destroy :remove_directory
|
||||
before_create :xml_rpc_create
|
||||
before_destroy :xml_rpc_destroy
|
||||
# before_update :check_freezing
|
||||
|
@ -118,7 +118,7 @@ class Platform < ActiveRecord::Base
|
|||
|
||||
def xml_rpc_clone(new_unixname)
|
||||
# return true
|
||||
result = BuildServer.clone_platform new_unixname, self.unixname, APP_CONFIG['root_path']
|
||||
result = BuildServer.clone_platform new_unixname, self.unixname, APP_CONFIG['root_path'] + '/platforms'
|
||||
if result == BuildServer::SUCCESS
|
||||
return true
|
||||
else
|
||||
|
|
|
@ -20,13 +20,12 @@ class Project < ActiveRecord::Base
|
|||
validates :owner, :presence => true
|
||||
validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
||||
|
||||
# attr_accessible :visibility
|
||||
attr_accessible :category_id, :name, :unixname, :description, :visibility
|
||||
attr_readonly :unixname
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
scope :by_name, lambda { |name| {:conditions => ['name like ?', '%' + name + '%']} }
|
||||
scope :by_visibilities, lambda {|v| {:conditions => ['visibility in (?)', v.join(',')]}}
|
||||
|
||||
scope :addable_to_repository, lambda { |repository_id| where("projects.id NOT IN (SELECT project_to_repositories.project_id FROM project_to_repositories WHERE (project_to_repositories.repository_id != #{ repository_id }))") }
|
||||
|
||||
before_create :create_git_repo, :make_owner_rel
|
||||
|
@ -34,15 +33,8 @@ class Project < ActiveRecord::Base
|
|||
before_destroy :destroy_git_repo
|
||||
# before_create :xml_rpc_create
|
||||
# before_destroy :xml_rpc_destroy
|
||||
|
||||
before_save :make_owner_rel
|
||||
after_create :attach_to_personal_repository
|
||||
|
||||
# before_create :xml_rpc_create
|
||||
# before_destroy :xml_rpc_destroy
|
||||
|
||||
attr_accessible :visibility
|
||||
|
||||
def attach_to_personal_repository
|
||||
repositories << self.owner.personal_repository if !repositories.exists?(:id => self.owner.personal_repository)
|
||||
end
|
||||
|
@ -60,9 +52,6 @@ class Project < ActiveRecord::Base
|
|||
def git_repo_path
|
||||
@git_repo_path ||= File.join(APP_CONFIG['root_path'], 'git_projects', "#{git_repo_name}.git")
|
||||
end
|
||||
def git_repo_clone_path
|
||||
"git@gitolite:#{git_repo_name}.git"
|
||||
end
|
||||
def git_repo_name
|
||||
[owner.uname, unixname].join('/')
|
||||
end
|
||||
|
|
|
@ -15,8 +15,8 @@ class Repository < ActiveRecord::Base
|
|||
has_many :members, :through => :objects, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true
|
||||
validates :unixname, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
|
||||
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true
|
||||
validates :unixname, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-zA-Z0-9\-.]+$/ }
|
||||
validates :platform_id, :presence => true
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
|
@ -33,7 +33,7 @@ class Repository < ActiveRecord::Base
|
|||
add_downloads_symlink unless self.hidden?
|
||||
}
|
||||
|
||||
attr_accessible :visibility
|
||||
attr_accessible :visibility, :name, :unixname, :platform_id
|
||||
|
||||
def path
|
||||
build_path(unixname)
|
||||
|
|
35
db/seeds.rb
35
db/seeds.rb
|
@ -1,38 +1,3 @@
|
|||
require 'digest/md5'
|
||||
|
||||
TEST_USERS =
|
||||
[
|
||||
['yaroslav@markin.net' , 'Yaroslav Markin'] ,
|
||||
['timothy.tsvetkov@gmail.com' , 'Timothy Tsvetkov'] ,
|
||||
['alexey.nayden@gmail.com' , 'Alexey Nayden']
|
||||
]
|
||||
|
||||
TEST_USERS.each do |tuser|
|
||||
email = tuser[0]
|
||||
next if User.find_by_email(email)
|
||||
name = tuser[1]
|
||||
pass = Digest::MD5.hexdigest(name)[0..6]
|
||||
user = User.create! :name => name, :email => email, :password => pass, :password_confirmation => pass
|
||||
puts "Created user #{name} (#{email}) and password #{pass}"
|
||||
end
|
||||
|
||||
|
||||
=begin
|
||||
TEST_PLATFORMS = %w(cooker Mandriva2010-10 Mandriva2011.4)
|
||||
TEST_PROJECTS = %w(gcc glibc mysql-dev ruby ruby1.9 mc mesa avrdude vim gvim openssh-server openssh nethack binutils build-essentials rpm rpmtools ffmpeg mkvtoolnix libogg mpg123 openbox openoffice.org)
|
||||
|
||||
|
||||
TEST_PLATFORMS.each do |platform|
|
||||
p = Platform.find_or_create_by_name(platform)
|
||||
TEST_PROJECTS.each do |project|
|
||||
pr = Project.find_or_initialize_by_platform_id_and_name(p.id, project)
|
||||
pr.unixname = pr.name
|
||||
puts "#{project} added to #{platform}" if pr.new_record?
|
||||
pr.save!
|
||||
end
|
||||
end
|
||||
=end
|
||||
|
||||
ARCHES = %w(i586 i686 x86_64 mips powerpc)
|
||||
ARCHES.each do |arch|
|
||||
Arch.find_or_create_by_name arch
|
||||
|
|
|
@ -19,8 +19,8 @@ class BuildServer
|
|||
end
|
||||
|
||||
|
||||
def self.add_platform name, root_folder, distrib_type, repos = {:src => [], :rpm => []}
|
||||
self.client.call('add_platform', name, root_folder, repos, distrib_type)
|
||||
def self.add_platform name, platforms_root_folder, distrib_type, repos = {:src => [], :rpm => []}
|
||||
self.client.call('add_platform', name, platforms_root_folder, repos, distrib_type)
|
||||
end
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue