Merge branch 'master' of github.com:warpc/rosa-build
This commit is contained in:
commit
68ae986fde
|
@ -1,6 +1,6 @@
|
||||||
#require 'lib/build_server.rb'
|
#require 'lib/build_server.rb'
|
||||||
class Platform < ActiveRecord::Base
|
class Platform < ActiveRecord::Base
|
||||||
DOWNLOADS_PATH = RAILS_ROOT + '/public/downloads'
|
DOWNLOADS_PATH = Rails.root + '/public/downloads'
|
||||||
VISIBILITIES = ['open', 'hidden']
|
VISIBILITIES = ['open', 'hidden']
|
||||||
|
|
||||||
relationable :as => :target
|
relationable :as => :target
|
||||||
|
|
|
@ -17,7 +17,7 @@ class Project < ActiveRecord::Base
|
||||||
has_many :auto_build_lists, :dependent => :destroy
|
has_many :auto_build_lists, :dependent => :destroy
|
||||||
|
|
||||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :allow_nil => false, :allow_blank => false
|
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :allow_nil => false, :allow_blank => false
|
||||||
validates :unixname, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_]+$/ }, :allow_nil => false, :allow_blank => false
|
validates :unixname, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }, :allow_nil => false, :allow_blank => false
|
||||||
validates :owner, :presence => true
|
validates :owner, :presence => true
|
||||||
validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ class Project < ActiveRecord::Base
|
||||||
after_create :create_git_repo
|
after_create :create_git_repo
|
||||||
before_update :update_git_repo
|
before_update :update_git_repo
|
||||||
after_destroy :destroy_git_repo
|
after_destroy :destroy_git_repo
|
||||||
|
after_rollback lambda { destroy_git_repo rescue true }
|
||||||
|
|
||||||
def project_versions
|
def project_versions
|
||||||
#tags.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ }
|
#tags.collect { |tag| [tag.name, tag.name.gsub(/^\w+\./, "")] }.select { |pv| pv[0] =~ /^v\./ }
|
||||||
|
|
|
@ -9,13 +9,9 @@ class ProjectToRepository < ActiveRecord::Base
|
||||||
#after_destroy :remove_link
|
#after_destroy :remove_link
|
||||||
#after_destroy :remove_compability_link
|
#after_destroy :remove_compability_link
|
||||||
|
|
||||||
after_create lambda {
|
after_create lambda { project.xml_rpc_create(repository) }
|
||||||
project.xml_rpc_create(repository)
|
after_destroy lambda { project.xml_rpc_destroy(repository) }
|
||||||
}
|
after_rollback lambda { project.xml_rpc_destroy(repository) rescue true }
|
||||||
|
|
||||||
after_destroy lambda {
|
|
||||||
project.xml_rpc_destroy(repository)
|
|
||||||
}
|
|
||||||
|
|
||||||
#def path
|
#def path
|
||||||
# build_path(project.unixname)
|
# build_path(project.unixname)
|
||||||
|
|
|
@ -27,9 +27,9 @@
|
||||||
= link_to @repository.owner.name, url_for(@repository.owner)
|
= link_to @repository.owner.name, url_for(@repository.owner)
|
||||||
%p
|
%p
|
||||||
%b
|
%b
|
||||||
= t("activerecord.attributes.repository.visibility")
|
= t("activerecord.attributes.platform.visibility")
|
||||||
\:
|
\:
|
||||||
= @repository.visibility
|
= @repository.platform.visibility
|
||||||
%p
|
%p
|
||||||
%b
|
%b
|
||||||
= t("activerecord.attributes.repository.platform")
|
= t("activerecord.attributes.repository.platform")
|
||||||
|
|
|
@ -7,9 +7,9 @@
|
||||||
%h2.title= t("layout.personal_repositories.settings_header")
|
%h2.title= t("layout.personal_repositories.settings_header")
|
||||||
.inner
|
.inner
|
||||||
.group
|
.group
|
||||||
%span= t("activerecord.attributes.repository.visibility") + ":"
|
%span= t("activerecord.attributes.platform.visibility") + ":"
|
||||||
%span
|
%span
|
||||||
%i= t("activerecord.attributes.repository.visibility_types.#{ @repository.platform.visibility }")
|
%i= t("activerecord.attributes.platform.visibility_types.#{ @repository.platform.visibility }")
|
||||||
.group
|
.group
|
||||||
= link_to t("layout.personal_repositories.change_visibility_from_#{ @repository.platform.visibility }"), change_visibility_personal_repository_path(@repository)
|
= link_to t("layout.personal_repositories.change_visibility_from_#{ @repository.platform.visibility }"), change_visibility_personal_repository_path(@repository)
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
%ul.wat-cf
|
%ul.wat-cf
|
||||||
%li.first.active= link_to t("layout.projects.list"), personal_repository_path(@repository) + "#projects"
|
%li.first.active= link_to t("layout.projects.list"), personal_repository_path(@repository) + "#projects"
|
||||||
%li= link_to t("layout.projects.add"), add_project_personal_repository_path(@repository)
|
%li= link_to t("layout.projects.add"), add_project_personal_repository_path(@repository)
|
||||||
%li= link_to t("layout.products.new"), new_platform_product_path(@repository.platform)
|
%li= link_to t("layout.projects.new"), new_project_path(@repository.platform)
|
||||||
.content
|
.content
|
||||||
%h2.title
|
%h2.title
|
||||||
= t("layout.projects.list_header")
|
= t("layout.projects.list_header")
|
||||||
|
|
|
@ -428,6 +428,10 @@ ru:
|
||||||
created_at: Создана
|
created_at: Создана
|
||||||
updated_at: Обновлена
|
updated_at: Обновлена
|
||||||
distrib_type: Тип дистрибутива
|
distrib_type: Тип дистрибутива
|
||||||
|
visibility: Статус
|
||||||
|
visibility_types:
|
||||||
|
open: Открытый
|
||||||
|
hidden: Закрытый
|
||||||
|
|
||||||
event_log:
|
event_log:
|
||||||
kind: Тип события
|
kind: Тип события
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
personal_repositories:
|
personal_repositories:
|
||||||
- index
|
- index
|
||||||
- show
|
- show
|
||||||
|
- settings
|
||||||
- add_project
|
- add_project
|
||||||
- remove_project
|
- remove_project
|
||||||
downloads:
|
downloads:
|
||||||
|
@ -224,6 +225,10 @@
|
||||||
- index
|
- index
|
||||||
personal_repositories:
|
personal_repositories:
|
||||||
- show
|
- show
|
||||||
|
- add_project
|
||||||
|
- settings
|
||||||
|
- change_visibility
|
||||||
|
- remove_project
|
||||||
auto_build_lists:
|
auto_build_lists:
|
||||||
- index
|
- index
|
||||||
repositories:
|
repositories:
|
||||||
|
|
|
@ -2,7 +2,8 @@ require 'gitolito'
|
||||||
|
|
||||||
class Object
|
class Object
|
||||||
def with_ga(&block)
|
def with_ga(&block)
|
||||||
::Gitolito::GitoliteAdmin.thread_safe(File.join(APP_CONFIG['root_path'], 'gitolite-admin'), {:wait_lock => true, :seconds => 30}) do |ga|
|
Grit::Git.git_timeout = 60
|
||||||
|
::Gitolito::GitoliteAdmin.thread_safe(File.join(APP_CONFIG['root_path'], 'gitolite-admin'), {:wait_lock => true, :seconds => 60}) do |ga|
|
||||||
block.call(ga)
|
block.call(ga)
|
||||||
end
|
end
|
||||||
# ga = Gitolito::GitoliteAdmin.new File.join(APP_CONFIG['root_path'], 'gitolite-admin'); block.call(ga)
|
# ga = Gitolito::GitoliteAdmin.new File.join(APP_CONFIG['root_path'], 'gitolite-admin'); block.call(ga)
|
||||||
|
|
|
@ -6,8 +6,10 @@ namespace :import do
|
||||||
print "Import #{name}..."
|
print "Import #{name}..."
|
||||||
owner = User.find(2) # vsharshov@gmail.com
|
owner = User.find(2) # vsharshov@gmail.com
|
||||||
# owner = Group.find(1) # Core Team
|
# owner = Group.find(1) # Core Team
|
||||||
puts Project.create(:name => name, :unixname => name) {|p| p.owner = owner} ? "Ok!" : "Fail!"
|
# puts Project.create(:name => name, :unixname => name) {|p| p.owner = owner} ? "Ok!" : "Fail"
|
||||||
sleep 1
|
p = Project.find_or_create_by_name_and_unixname(name, name) {|p| p.owner = owner}
|
||||||
|
puts p.persisted? ? "Ok!" : "Fail!"
|
||||||
|
# sleep 1
|
||||||
end
|
end
|
||||||
puts 'DONE'
|
puts 'DONE'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue