Merge branch 'master' into 114-comment_notifications
Conflicts: app/models/project.rb app/views/user_mailer/new_comment_notification.en.haml app/views/user_mailer/new_comment_notification.ru.haml app/views/user_mailer/new_comment_reply_notification.ru.haml config/locales/devise.en.yml config/locales/en.yml config/locales/ru.yml db/schema.rb
This commit is contained in:
commit
5efaca77cf
5
Gemfile
5
Gemfile
|
@ -4,6 +4,7 @@ gem 'rails', '3.0.11' #, :git => 'git://github.com/rails/rails.git'
|
|||
|
||||
gem 'pg', '~> 0.11.0'
|
||||
gem 'silent-postgres', '~> 0.1.1'
|
||||
gem 'schema_plus', '~> 0.2.1'
|
||||
|
||||
gem 'devise', '~> 1.5.2'
|
||||
gem 'omniauth', '~> 1.0.1'
|
||||
|
@ -18,7 +19,7 @@ gem "yui-compressor", "0.9.5" # Higher versions depends on Platform gem which co
|
|||
gem 'rails3-jquery-autocomplete'
|
||||
|
||||
gem 'ancestry', '~> 1.2.4'
|
||||
gem 'paperclip', "~> 2.3"
|
||||
gem 'paperclip', "~> 2.5"
|
||||
gem "will_paginate", "~> 3.0.2"
|
||||
gem 'meta-tags', '~> 1.2.4', :require => 'meta_tags'
|
||||
gem "russian"
|
||||
|
@ -39,7 +40,7 @@ gem 'unicorn', '~> 4.1.1'
|
|||
|
||||
group :production do
|
||||
gem "airbrake", '~> 3.0.5'
|
||||
# gem 'newrelic_rpm', '~> 3.1.1'
|
||||
gem 'newrelic_rpm'
|
||||
gem 'bluepill', :require => false
|
||||
end
|
||||
|
||||
|
|
13
Gemfile.lock
13
Gemfile.lock
|
@ -59,7 +59,7 @@ GEM
|
|||
capistrano (>= 1.0.0)
|
||||
capistrano_colors (0.5.5)
|
||||
chronic (0.6.6)
|
||||
cocaine (0.2.0)
|
||||
cocaine (0.2.1)
|
||||
columnize (0.3.5)
|
||||
daemons (1.1.4)
|
||||
delayed_job (2.1.4)
|
||||
|
@ -113,6 +113,7 @@ GEM
|
|||
net-ssh (2.2.1)
|
||||
net-ssh-gateway (1.1.0)
|
||||
net-ssh (>= 1.99.1)
|
||||
newrelic_rpm (3.3.1)
|
||||
omniauth (1.0.1)
|
||||
hashie (~> 1.2)
|
||||
rack
|
||||
|
@ -120,7 +121,7 @@ GEM
|
|||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.0.5)
|
||||
paperclip (2.4.5)
|
||||
paperclip (2.5.0)
|
||||
activerecord (>= 2.3.0)
|
||||
activesupport (>= 2.3.2)
|
||||
cocaine (>= 0.0.2)
|
||||
|
@ -183,6 +184,9 @@ GEM
|
|||
sexp_processor (~> 3.0)
|
||||
russian (0.6.0)
|
||||
i18n (>= 0.5.0)
|
||||
schema_plus (0.2.1)
|
||||
rails
|
||||
valuable
|
||||
sexp_processor (3.0.8)
|
||||
silent-postgres (0.1.1)
|
||||
state_machine (0.9.4)
|
||||
|
@ -195,6 +199,7 @@ GEM
|
|||
kgio (~> 2.4)
|
||||
rack
|
||||
raindrops (~> 0.6)
|
||||
valuable (0.9.2)
|
||||
warden (1.1.0)
|
||||
rack (>= 1.0)
|
||||
web-app-theme (0.7.0)
|
||||
|
@ -228,9 +233,10 @@ DEPENDENCIES
|
|||
jammit
|
||||
meta-tags (~> 1.2.4)
|
||||
mysql2 (<= 0.2.9)
|
||||
newrelic_rpm
|
||||
omniauth (~> 1.0.1)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
paperclip (~> 2.3)
|
||||
paperclip (~> 2.5)
|
||||
pg (~> 0.11.0)
|
||||
rails (= 3.0.11)
|
||||
rails-xmlrpc (~> 0.3.6)
|
||||
|
@ -241,6 +247,7 @@ DEPENDENCIES
|
|||
ruby-debug
|
||||
ruby_parser
|
||||
russian
|
||||
schema_plus (~> 0.2.1)
|
||||
silent-postgres (~> 0.1.1)
|
||||
unicorn (~> 4.1.1)
|
||||
web-app-theme
|
||||
|
|
|
@ -120,9 +120,9 @@ class BuildListsController < ApplicationController
|
|||
@build_list.notified_at = Time.current
|
||||
@build_list.save
|
||||
|
||||
@build_list.delay.publish if @build_list.auto_publish # && @build_list.can_publish?
|
||||
|
||||
render :nothing => true, :status => 200
|
||||
|
||||
@build_list.delay.publish if @build_list.auto_publish # && @build_list.can_publish?
|
||||
end
|
||||
|
||||
def circle_build
|
||||
|
|
|
@ -5,6 +5,16 @@ class Git::BlobsController < Git::BaseController
|
|||
|
||||
def show
|
||||
@blob = @tree / @path
|
||||
|
||||
if params[:raw]
|
||||
image_url = Rails.root.to_s + "/" + @path
|
||||
|
||||
response.headers['Cache-Control'] = "public, max-age=#{12.hours.to_i}"
|
||||
response.headers['Content-Type'] = @blob.mime_type
|
||||
response.headers['Content-Disposition'] = 'inline'
|
||||
|
||||
render(:text => open(image_url).read) and return
|
||||
end
|
||||
end
|
||||
|
||||
def blame
|
||||
|
|
|
@ -7,7 +7,7 @@ class PersonalRepositoriesController < ApplicationController
|
|||
|
||||
def show
|
||||
if params[:query]
|
||||
@projects = @repository.projects.recent.by_name(params[:query]).paginate :page => params[:project_page], :per_page => 30
|
||||
@projects = @repository.projects.recent.by_name("%#{params[:query]}%").paginate :page => params[:project_page], :per_page => 30
|
||||
else
|
||||
@projects = @repository.projects.recent.paginate :page => params[:project_page], :per_page => 30
|
||||
end
|
||||
|
|
|
@ -113,7 +113,7 @@ class PlatformsController < ApplicationController
|
|||
@cloned = @platform.make_clone(:name => params[:platform]['name'], :description => params[:platform]['description'],
|
||||
:owner_id => current_user.id, :owner_type => current_user.class.to_s)
|
||||
if @cloned.persisted?
|
||||
flash[:notice] = 'Клонирование успешно'
|
||||
flash[:notice] = I18n.t("flash.platform.clone_success")
|
||||
redirect_to @cloned
|
||||
else
|
||||
flash[:error] = @cloned.errors.full_messages.join('. ')
|
||||
|
|
|
@ -17,13 +17,13 @@ class ProjectsController < ApplicationController
|
|||
end.accessible_by(current_ability)
|
||||
|
||||
@projects = if params[:query]
|
||||
@projects.by_name(params[:query]).order("CHAR_LENGTH(name) ASC")
|
||||
@projects.by_name("%#{params[:query]}%").order("CHAR_LENGTH(name) ASC")
|
||||
else
|
||||
@projects
|
||||
end.paginate(:page => params[:project_page])
|
||||
|
||||
@own_projects = current_user.own_projects
|
||||
@part_projects = current_user.projects + current_user.groups.map(&:projects).flatten.uniq - @own_projects
|
||||
#@part_projects = current_user.projects + current_user.groups.map(&:projects).flatten.uniq - @own_projects
|
||||
end
|
||||
|
||||
def show
|
||||
|
|
|
@ -19,7 +19,7 @@ class RepositoriesController < ApplicationController
|
|||
|
||||
def show
|
||||
if params[:query]
|
||||
@projects = @repository.projects.recent.by_name(params[:query]).paginate :page => params[:project_page], :per_page => 30
|
||||
@projects = @repository.projects.recent.by_name("%#{params[:query]}%").paginate :page => params[:project_page], :per_page => 30
|
||||
else
|
||||
@projects = @repository.projects.recent.paginate :page => params[:project_page], :per_page => 30
|
||||
end
|
||||
|
|
|
@ -40,4 +40,9 @@ module GitHelper
|
|||
blob.data.split("\n").collect{|line| "<div>#{line.present? ? h(line) : "<br>"}</div>"}.join
|
||||
end
|
||||
|
||||
def choose_render_way(blob)
|
||||
return :image if blob.mime_type.match(/image/)
|
||||
return :text if blob.mime_type.match(/text|xml|json/)
|
||||
:binary
|
||||
end
|
||||
end
|
|
@ -1,11 +1,15 @@
|
|||
class BuildList::Item < ActiveRecord::Base
|
||||
|
||||
belongs_to :build_list
|
||||
|
||||
attr_protected :build_list_id
|
||||
|
||||
STATUSES = [BuildServer::SUCCESS, BuildServer::DEPENDENCIES_ERROR, BuildServer::BUILD_ERROR, BuildServer::BUILD_STARTED]
|
||||
GIT_ERROR = 5
|
||||
|
||||
STATUSES = [BuildServer::SUCCESS, BuildServer::DEPENDENCIES_ERROR, BuildServer::BUILD_ERROR, BuildServer::BUILD_STARTED, GIT_ERROR]
|
||||
HUMAN_STATUSES = {
|
||||
nil => :unknown,
|
||||
GIT_ERROR => :git_error,
|
||||
BuildServer::DEPENDENCIES_ERROR => :dependencies_error,
|
||||
BuildServer::SUCCESS => :success,
|
||||
BuildServer::BUILD_STARTED => :build_started,
|
||||
|
|
|
@ -21,6 +21,7 @@ class Group < ActiveRecord::Base
|
|||
delegate :ssh_key, :to => :owner
|
||||
|
||||
after_create :add_owner_to_members
|
||||
after_initialize lambda {|r| r.name ||= r.uname } # default
|
||||
|
||||
include Modules::Models::PersonalRepository
|
||||
# include Modules::Models::Owner
|
||||
|
|
|
@ -14,7 +14,7 @@ class Platform < ActiveRecord::Base
|
|||
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :description, :presence => true, :uniqueness => true
|
||||
validates :name, :uniqueness => true, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-]+$/ }
|
||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-]+$/ }
|
||||
validates :distrib_type, :presence => true, :inclusion => {:in => APP_CONFIG['distr_types']}
|
||||
|
||||
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]}
|
||||
|
|
|
@ -9,7 +9,7 @@ class Product < ActiveRecord::Base
|
|||
|
||||
has_attached_file :tar
|
||||
|
||||
validates_attachment_content_type :tar, :content_type => ["application/gnutar", "application/x-compressed", "application/x-gzip", "application/x-bzip2", "application/x-tar"], :message => I18n.t('layout.products.invalid_content_type')
|
||||
validates_attachment_content_type :tar, :content_type => ["application/gnutar", "application/x-compressed", "application/x-gzip", "application/x-bzip2", "application/x-tar"], :message => I18n.t('layout.invalid_content_type')
|
||||
validates :name, :presence => true, :uniqueness => {:scope => :platform_id}
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
|
|
|
@ -8,6 +8,7 @@ class Project < ActiveRecord::Base
|
|||
has_many :build_lists, :dependent => :destroy
|
||||
has_many :auto_build_lists, :dependent => :destroy
|
||||
|
||||
has_many :project_imports, :dependent => :destroy
|
||||
has_many :project_to_repositories, :dependent => :destroy
|
||||
has_many :repositories, :through => :project_to_repositories
|
||||
|
||||
|
@ -15,15 +16,17 @@ class Project < ActiveRecord::Base
|
|||
has_many :collaborators, :through => :relations, :source => :object, :source_type => 'User'
|
||||
has_many :groups, :through => :relations, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type]}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }
|
||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => { :with => /^[a-zA-Z0-9_\-\+\.]+$/ }
|
||||
validates :owner, :presence => true
|
||||
# validate {errors.add(:base, I18n.t('flash.project.save_warning_ssh_key')) if owner.ssh_key.blank?}
|
||||
validates_attachment_size :srpm, :less_than => 500.megabytes
|
||||
validates_attachment_content_type :srpm, :content_type => ['application/octet-stream', "application/x-rpm", "application/x-redhat-package-manager"], :message => I18n.t('layout.invalid_content_type')
|
||||
|
||||
#attr_accessible :category_id, :name, :description, :visibility
|
||||
attr_readonly :name
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
scope :by_name, lambda { |name| where('name like ?', "%#{ name }%") }
|
||||
scope :by_name, lambda {|name| where('projects.name ILIKE ?', 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 }))") }
|
||||
scope :automateable, where("projects.id NOT IN (SELECT auto_build_lists.project_id FROM auto_build_lists)")
|
||||
|
@ -31,10 +34,13 @@ class Project < ActiveRecord::Base
|
|||
after_create :attach_to_personal_repository
|
||||
after_create :create_git_repo
|
||||
after_destroy :destroy_git_repo
|
||||
after_save {|p| p.delay.import_attached_srpm if p.srpm?} # should be after create_git_repo
|
||||
# after_rollback lambda { destroy_git_repo rescue true if new_record? }
|
||||
|
||||
has_ancestry
|
||||
|
||||
has_attached_file :srpm
|
||||
|
||||
include Modules::Models::Owner
|
||||
|
||||
def auto_build
|
||||
|
@ -54,10 +60,13 @@ class Project < ActiveRecord::Base
|
|||
bl.pl = platform
|
||||
bl.bpl = platform
|
||||
bl.update_type = 'recommended'
|
||||
bl.arch = Arch.find_by_name('i586')
|
||||
bl.project_version = "latest_#{platform.name}"
|
||||
bl.arch = Arch.find_by_name('x86_64') # Return i586 after mass rebuild
|
||||
# FIXME: Need to set "latest_#{platform.name}"
|
||||
bl.project_version = "latest_mandriva2011"
|
||||
bl.build_requires = false # already set as db default
|
||||
bl.user = user
|
||||
bl.auto_publish = true # already set as db default
|
||||
bl.include_repos = [platform.repositories.find_by_name('main').id]
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -134,6 +143,10 @@ class Project < ActiveRecord::Base
|
|||
@platforms ||= repositories.map(&:platform).uniq
|
||||
end
|
||||
|
||||
def import_srpm(srpm_path = srpm.path, branch_name = 'import')
|
||||
system("#{Rails.root.join('bin', 'import_srpm.sh')} #{srpm_path} #{path} #{branch_name} >> /dev/null 2>&1")
|
||||
end
|
||||
|
||||
class << self
|
||||
def commit_comments(commit, project)
|
||||
comments = Comment.where(:commentable_id => commit.id, :commentable_type => 'Grit::Commit').order(:created_at)
|
||||
|
@ -163,4 +176,11 @@ class Project < ActiveRecord::Base
|
|||
FileUtils.rm_rf path
|
||||
end
|
||||
|
||||
def import_attached_srpm
|
||||
if srpm?
|
||||
import_srpm # srpm.path
|
||||
self.srpm = nil; save # clear srpm
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
class ProjectImport < ActiveRecord::Base
|
||||
belongs_to :project
|
||||
|
||||
validates :name, :uniqueness => {:case_sensitive => false}, :presence => true
|
||||
|
||||
scope :by_name, lambda {|name| where('project_imports.name ILIKE ?', name)}
|
||||
|
||||
after_initialize lambda {|r| r.file_mtime ||= Time.current - 10.years } # default
|
||||
end
|
|
@ -13,8 +13,7 @@ class ProjectToRepository < ActiveRecord::Base
|
|||
protected
|
||||
|
||||
def one_project_in_platform_repositories
|
||||
c = Platform.scoped.select('projects.*').joins(:repositories => :projects).where(
|
||||
:projects => {:name => project.name}, :id => repository.platform_id).count
|
||||
errors.add(:project, 'should be one in platform') if c > 0
|
||||
errors.add(:project, 'should be one in platform') if Project.joins(:repositories => :platform).
|
||||
where('platforms.id = ?', repository.platform_id).by_name(project.name).count > 0
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class Repository < ActiveRecord::Base
|
|||
has_many :groups, :through => :objects, :source => :object, :source_type => 'Group'
|
||||
|
||||
validates :description, :uniqueness => {:scope => :platform_id}, :presence => true
|
||||
validates :name, :uniqueness => {:scope => :platform_id}, :presence => true, :format => { :with => /^[a-z0-9_\-]+$/ }
|
||||
validates :name, :uniqueness => {:scope => :platform_id, :case_sensitive => false}, :presence => true, :format => { :with => /^[a-z0-9_\-]+$/ }
|
||||
# validates :platform_id, :presence => true # if you uncomment this platform clone will not work
|
||||
|
||||
scope :recent, order("name ASC")
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
- if controller_name != 'sessions'
|
||||
= link_to "Войти", new_session_path(resource_name), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.sign_in"), new_session_path(resource_name), :class => "text_button_padding link_button"
|
||||
- if devise_mapping.registerable? && controller_name != 'registrations'
|
||||
= link_to "Зарегистрироваться", new_registration_path(resource_name), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.sign_up"), new_registration_path(resource_name), :class => "text_button_padding link_button"
|
||||
- if devise_mapping.recoverable? && controller_name != 'passwords'
|
||||
= link_to "Забыли пароль?", new_password_path(resource_name), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.forgot_password"), new_password_path(resource_name), :class => "text_button_padding link_button"
|
||||
- if devise_mapping.confirmable? && controller_name != 'confirmations'
|
||||
= link_to "Не получили инструкции по подтверждению?", new_confirmation_path(resource_name), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.confirm_again"), new_confirmation_path(resource_name), :class => "text_button_padding link_button"
|
||||
- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks'
|
||||
= link_to "Не получили инструкции по разблокировке?", new_unlock_path(resource_name), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.unlock"), new_unlock_path(resource_name), :class => "text_button_padding link_button"
|
||||
- if devise_mapping.omniauthable?
|
||||
- resource_class.omniauth_providers.each do |provider|
|
||||
= link_to "Войти через #{provider.to_s.classify}", omniauth_authorize_path(resource_name, provider), :class => "text_button_padding link_button"
|
||||
= link_to t("layout.devise.shared_links.sign_in_through", :provider => provider.to_s.classify), omniauth_authorize_path(resource_name, provider), :class => "text_button_padding link_button"
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
.content
|
||||
.inner
|
||||
%h3= render_path
|
||||
%h3= @blob.mime_type
|
||||
|
||||
.blob_header
|
||||
.size #{(@blob.size / 1024.0).round(3)} Kb
|
||||
|
@ -22,6 +23,17 @@
|
|||
- else
|
||||
#{link_to "Raw", raw_path(@project, @treeish, @path)} #{link_to "Blame", blame_path(@project, @treeish, @path)} #{link_to "History", commits_path(@project, @treeish, @path)}
|
||||
.clear
|
||||
- case choose_render_way(@blob)
|
||||
- when :image
|
||||
%table.table.blob
|
||||
%tr
|
||||
%td.lines
|
||||
%td.blob
|
||||
:plain
|
||||
<br/>
|
||||
<center> <img src='?raw=true'/></center>
|
||||
<br/>
|
||||
- when :text
|
||||
%table.table.blob
|
||||
%tr
|
||||
%td.lines
|
||||
|
@ -30,5 +42,14 @@
|
|||
%td.blob
|
||||
:plain
|
||||
<pre>#{render_blob(@blob)}</pre>
|
||||
- when :binary
|
||||
%table.table.blob
|
||||
%tr
|
||||
%td.lines
|
||||
%td.blob
|
||||
:plain
|
||||
<br/>
|
||||
<pre>#{ link_to @blob.basename, raw_path(@project, @treeish, @path) }</pre>
|
||||
<br/>
|
||||
|
||||
- content_for :sidebar, render(:partial => 'git/shared/sidebar')
|
||||
|
|
|
@ -13,6 +13,9 @@
|
|||
.group
|
||||
= f.label :has_issues, t("activerecord.attributes.project.has_issues"), :class => :label
|
||||
= f.check_box :has_issues
|
||||
.group
|
||||
= f.label :srpm, t("activerecord.attributes.project.srpm"), :class => :label
|
||||
= f.file_field :srpm, :class => 'file_field'
|
||||
|
||||
.group.navform.wat-cf
|
||||
%button.button{:type => "submit"}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
- @own_projects.each do |project|
|
||||
%li
|
||||
= link_to project.name, project_path(project)
|
||||
.block.notice
|
||||
%h3= t("layout.users.part_projects")
|
||||
.content
|
||||
%p
|
||||
%ul
|
||||
- @part_projects.each do |project|
|
||||
%li
|
||||
= link_to project.owner.uname + '/' + project.name, project_path(project)
|
||||
-#.block.notice
|
||||
-# %h3= t("layout.users.part_projects")
|
||||
-# .content
|
||||
-# %p
|
||||
-# %ul
|
||||
-# - @part_projects.each do |project|
|
||||
-# %li
|
||||
-# = link_to project.owner.uname + '/' + project.name, project_path(project)
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
.content
|
||||
%h2.title= t("layout.projects.edit_header")
|
||||
.inner
|
||||
= form_for @project, :html => { :class => :form } do |f|
|
||||
= form_for @project, :html => { :class => :form, :multipart => true } do |f|
|
||||
= render :partial => "form", :locals => {:f => f}
|
||||
|
||||
- content_for :sidebar, render('sidebar')
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
.content
|
||||
%h2.title= t("layout.projects.new_header")
|
||||
.inner
|
||||
= form_for [get_owner, @project], :html => { :class => :form } do |f|
|
||||
= form_for [get_owner, @project], :html => { :class => :form, :multipart => true } do |f|
|
||||
= render :partial => "form", :locals => {:f => f}
|
||||
|
||||
-# content_for :sidebar, render('sidebar')
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
%p== Hello, #{@user.name}.
|
||||
|
||||
|
||||
%p You have been assigned to issue #{ link_to @issue.title, [@issue.project, @issue] }
|
||||
|
||||
|
||||
%p== Support team «ROSA Build System»
|
|
@ -6,9 +6,9 @@
|
|||
- elsif @comment.commentable.class == Grit::Commit
|
||||
- link = link_to @comment.commentable.message, commit_path(@comment.project, @comment.commentable_id)
|
||||
- object = 'commit'
|
||||
%p User #{ link_to @comment.user.uname, user_path(@comment.user)} added new comment to #{object} #{link}.
|
||||
%p #{ link_to @comment.user.uname, user_path(@comment.user)} added new comment to #{object} #{link}.
|
||||
|
||||
%p "#{ @comment.body }"
|
||||
|
||||
|
||||
%p== Support Team «ROSA Build System»
|
||||
%p== Support team «ROSA Build System»
|
|
@ -0,0 +1,9 @@
|
|||
%p== Hello, #{@user.name}.
|
||||
|
||||
|
||||
%p Your comment into issue #{ link_to @comment.commentable.title, [@comment.commentable.project, @comment.commentable] } has been answered.
|
||||
|
||||
%p "#{ @comment.body }"
|
||||
|
||||
|
||||
%p== Support team «ROSA Build System»
|
|
@ -0,0 +1,7 @@
|
|||
%p== Hello, #{@user.name}.
|
||||
|
||||
|
||||
%p To project #{ link_to @issue.project.name, project_path(@issue.project) } has been added an issue #{ link_to @issue.title, [@issue.project, @issue] }
|
||||
|
||||
|
||||
%p== Support team «ROSA Build System»
|
|
@ -0,0 +1,12 @@
|
|||
%p== Hello, #{@user.name}.
|
||||
|
||||
|
||||
%p You have been sign up to project «ROSA Build System» and now can sign in.
|
||||
|
||||
|
||||
%p
|
||||
==Your email : #{@user.email}
|
||||
%br/
|
||||
==Your password: #{@user.password}
|
||||
|
||||
%p== Support team «ROSA Build System»
|
|
@ -0,0 +1,39 @@
|
|||
#!/usr/bin/env bash
|
||||
# import_srpm.sh: Import SRPM packages to git repo
|
||||
|
||||
# Input data
|
||||
srpm_path=$1
|
||||
git_path=$2
|
||||
git_branch=$3
|
||||
name=$(rpm -q --qf '[%{Name}]' -p $srpm_path)
|
||||
version=$(rpm -q --qf '[%{Version}]' -p $srpm_path)
|
||||
tmp_dir=/tmp/$name-$version-$RANDOM
|
||||
|
||||
# Clone destination repo
|
||||
mkdir -p $tmp_dir
|
||||
git clone $git_path $tmp_dir
|
||||
|
||||
# Switch to import branch
|
||||
cd $tmp_dir
|
||||
git branch --track $git_branch origin/$git_branch # Try track remote
|
||||
git branch $git_branch # Try create local
|
||||
git checkout $git_branch
|
||||
|
||||
# Remove all files except .git
|
||||
rm -rf $tmp_dir/*
|
||||
mv $tmp_dir/.git $tmp_dir/git
|
||||
rm -rf $tmp_dir/.*
|
||||
mv $tmp_dir/git $tmp_dir/.git
|
||||
|
||||
# Unpack srpm
|
||||
rpm2cpio $srpm_path > srpm.cpio
|
||||
cpio -idv < srpm.cpio
|
||||
rm -f srpm.cpio
|
||||
|
||||
# Commit and push changes
|
||||
git add -A .
|
||||
git commit -m "Automatic import for version $version"
|
||||
git push origin HEAD
|
||||
|
||||
# Cleanup
|
||||
rm -rf $tmp_dir
|
|
@ -2,9 +2,20 @@
|
|||
|
||||
for f in `ls /srv/rosa_build/shared/downloads`
|
||||
do
|
||||
if [ -d /home/share ]
|
||||
then
|
||||
# Staging case
|
||||
if [ -d /home/share/platforms/$f ]
|
||||
then
|
||||
sudo umount /srv/rosa_build/shared/downloads/$f 2>&1 >> /dev/null
|
||||
sudo mount --bind /home/share/platforms/$f /srv/rosa_build/shared/downloads/$f
|
||||
fi
|
||||
else
|
||||
# Production case
|
||||
if [ -d /share/platforms/$f ]
|
||||
then
|
||||
sudo umount /srv/rosa_build/shared/downloads/$f 2>&1 >> /dev/null
|
||||
sudo mount --bind /share/platforms/$f /srv/rosa_build/shared/downloads/$f
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace :deploy do
|
|||
end
|
||||
|
||||
after "deploy:update_code", "deploy:symlink_all", "deploy:migrate"
|
||||
after "deploy:restart", "delayed_job:restart", "bluepill:restart", "deploy:cleanup"
|
||||
after "deploy:restart","bluepill:stop", "delayed_job:restart", "deploy:cleanup", "bluepill:start"
|
||||
after "deploy:setup", "deploy:symlink_pids"
|
||||
|
||||
require 'cape'
|
||||
|
|
|
@ -20,6 +20,8 @@ en:
|
|||
passwords:
|
||||
send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
|
||||
updated: 'Your password was changed successfully. You are now signed in.'
|
||||
button: 'Submit'
|
||||
edit_button: 'Change my password'
|
||||
confirmations:
|
||||
send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
|
||||
confirmed: 'Your account was successfully confirmed. You are now signed in.'
|
||||
|
@ -28,6 +30,10 @@ en:
|
|||
updated: 'You updated your account successfully.'
|
||||
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
||||
sign_up_header: 'Signup'
|
||||
edit_password_description: Leave blank if you don't want to change it
|
||||
current_password_description: 'We need your current password to confirm your changes'
|
||||
cancel: 'Cancel my account'
|
||||
cancel_confirmation: 'Are you sure?'
|
||||
unlocks:
|
||||
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
||||
unlocked: 'Your account was successfully unlocked. You are now signed in.'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
en:
|
||||
will_paginate:
|
||||
previous_label: ‹ Previous!!!
|
||||
previous_label: ‹ Previous
|
||||
next_label: Next ›
|
||||
page_gap: ...
|
||||
|
||||
|
@ -46,6 +46,16 @@ en:
|
|||
notifiers:
|
||||
edit_header: Notifier setting
|
||||
processing: working ...
|
||||
invalid_content_type: incorrect type
|
||||
|
||||
devise:
|
||||
shared_links:
|
||||
sign_in: Sign in
|
||||
sign_up: Sign up
|
||||
forgot_password: Forgot your password?
|
||||
confirm_again: Do not receive the confirmation link?
|
||||
unlock: Do not receive unlock instructions?
|
||||
sign_in_through: Sign in by %{provider}
|
||||
|
||||
downloads:
|
||||
title: Downloads statistic
|
||||
|
@ -205,7 +215,6 @@ en:
|
|||
new_header: New product
|
||||
edit_header: Product editing
|
||||
confirm_delete: Are you sure to delete this product?
|
||||
invalid_content_type: incorrect type
|
||||
|
||||
cron_tab_generator:
|
||||
show: Show cron tab the generator
|
||||
|
@ -343,6 +352,7 @@ en:
|
|||
dependencies_error: Dependences not found
|
||||
success: Build complete
|
||||
unknown: Build waiting
|
||||
git_error: Git error
|
||||
|
||||
statuses:
|
||||
build_error: Build error
|
||||
|
@ -612,6 +622,7 @@ en:
|
|||
created_at: Created
|
||||
updated_at: Updated
|
||||
has_issues: Tracker on
|
||||
srpm: Import code from src.rpm
|
||||
|
||||
rpm:
|
||||
name: Name
|
||||
|
|
|
@ -39,12 +39,23 @@ ru:
|
|||
upload: Загрузить
|
||||
not_access: Нет доступа!
|
||||
owner: Владелец
|
||||
confirm: Уверенны?
|
||||
confirm: Уверены?
|
||||
back: Назад
|
||||
settings:
|
||||
notifier: Настройки оповещений
|
||||
notifiers:
|
||||
edit_header: Настройки оповещений
|
||||
processing: Обрабатывается...
|
||||
invalid_content_type: имеет неверный тип
|
||||
|
||||
devise:
|
||||
shared_links:
|
||||
sign_in: Войти
|
||||
sign_up: Зарегистрироваться
|
||||
forgot_password: Забыли пароль?
|
||||
confirm_again: Не получили инструкции по подтверждению?
|
||||
unlock: Не получили инструкции по разблокировке?
|
||||
sign_in_through: Войти через %{provider}
|
||||
|
||||
downloads:
|
||||
title: Статистика закачек пакетов
|
||||
|
@ -200,7 +211,6 @@ ru:
|
|||
new_header: Новый продукт
|
||||
edit_header: Редактирование продукта
|
||||
confirm_delete: Вы уверены, что хотите удалить этот продукт?
|
||||
invalid_content_type: имеет неверный тип
|
||||
|
||||
cron_tab_generator:
|
||||
show: Показать cron tab генератор
|
||||
|
@ -338,6 +348,7 @@ ru:
|
|||
dependencies_error: зависимости не найдены
|
||||
success: собран
|
||||
unknown: ожидает сборки
|
||||
git_error: проблема с гит
|
||||
|
||||
statuses:
|
||||
build_error: ошибка сборки
|
||||
|
@ -455,6 +466,7 @@ ru:
|
|||
unfreeze_error: Не удалось разморозить платформу, попробуйте еще раз
|
||||
destroyed: Платформа успешно удалена
|
||||
build_all_success: Все проекты успешно отправлены на сборку
|
||||
clone_success: Клонирование успешно
|
||||
|
||||
build_list:
|
||||
saved: Билд лист для версии '%{project_version}', платформы '%{bpl}' и архитектуры '%{arch}' создан успешно
|
||||
|
@ -610,6 +622,7 @@ ru:
|
|||
created_at: Создан
|
||||
updated_at: Обновлен
|
||||
has_issues: Включить трэкер
|
||||
srpm: Импортировать код из src.rpm
|
||||
|
||||
rpm:
|
||||
name: Название
|
||||
|
|
|
@ -14,6 +14,16 @@ Bluepill.application(app_name) do |app|
|
|||
process.pid_file = File.join(app.working_dir, 'tmp', 'pids', 'delayed_job.pid')
|
||||
end
|
||||
|
||||
app.process("newrelic") do |process|
|
||||
process.start_grace_time = 10.seconds
|
||||
process.stop_grace_time = 10.seconds
|
||||
process.restart_grace_time = 10.seconds
|
||||
|
||||
path = File.join(app.working_dir, 'tmp', 'pids', 'newrelic.pid')
|
||||
process.start_command = "/usr/bin/env /usr/local/bin/nrsysmond -c /etc/newrelic/nrsysmond.cfg -p #{path}"
|
||||
process.pid_file = path
|
||||
end
|
||||
|
||||
app.process("unicorn") do |process|
|
||||
process.start_grace_time = 8.seconds
|
||||
process.stop_grace_time = 5.seconds
|
||||
|
|
|
@ -11,3 +11,7 @@ every 5.minutes do
|
|||
runner "Download.rotate_nginx_log"
|
||||
runner "Download.parse_and_remove_nginx_log"
|
||||
end
|
||||
|
||||
every 1.day, :at => '4:00 am' do
|
||||
rake "import:sync:all", :output => 'log/sync.log'
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
class CreateProjectImports < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :project_imports do |t|
|
||||
t.references :project
|
||||
t.string :name
|
||||
t.string :version
|
||||
t.datetime :file_mtime
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :project_imports
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddSrpmColumnsToProjects < ActiveRecord::Migration
|
||||
def self.up
|
||||
change_table :projects do |t|
|
||||
t.has_attached_file :srpm
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_attached_file :projects, :srpm
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class AddIndexForProjectsName < ActiveRecord::Migration
|
||||
def self.up
|
||||
add_index :projects, [:name, :owner_id, :owner_type], :unique => true, :case_sensitive => false
|
||||
add_index :project_imports, :name, :unique => true, :case_sensitive => false
|
||||
end
|
||||
|
||||
def self.down
|
||||
remove_index :projects, [:name, :owner_id, :owner_type]
|
||||
remove_index :project_imports, :name
|
||||
end
|
||||
end
|
96
db/schema.rb
96
db/schema.rb
|
@ -10,27 +10,25 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20120123161250) do
|
||||
ActiveRecord::Schema.define(:version => 20120129120025) do
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["name"], :name => "index_arches_on_name", :unique => true
|
||||
end
|
||||
|
||||
add_index "arches", ["name"], :name => "index_arches_on_name", :unique => true
|
||||
|
||||
create_table "authentications", :force => true do |t|
|
||||
t.integer "user_id"
|
||||
t.string "provider"
|
||||
t.string "uid"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
||||
t.index ["user_id"], :name => "index_authentications_on_user_id"
|
||||
end
|
||||
|
||||
add_index "authentications", ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true
|
||||
add_index "authentications", ["user_id"], :name => "index_authentications_on_user_id"
|
||||
|
||||
create_table "auto_build_lists", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "arch_id"
|
||||
|
@ -48,10 +46,9 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.string "version"
|
||||
t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
|
||||
end
|
||||
|
||||
add_index "build_list_items", ["build_list_id"], :name => "index_build_list_items_on_build_list_id"
|
||||
|
||||
create_table "build_lists", :force => true do |t|
|
||||
t.integer "bs_id"
|
||||
t.string "container_path"
|
||||
|
@ -74,12 +71,11 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.boolean "auto_publish", :default => true
|
||||
t.string "package_version"
|
||||
t.string "commit_hash"
|
||||
t.index ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
t.index ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
||||
t.index ["project_id"], :name => "index_build_lists_on_project_id"
|
||||
end
|
||||
|
||||
add_index "build_lists", ["arch_id"], :name => "index_build_lists_on_arch_id"
|
||||
add_index "build_lists", ["bs_id"], :name => "index_build_lists_on_bs_id", :unique => true
|
||||
add_index "build_lists", ["project_id"], :name => "index_build_lists_on_project_id"
|
||||
|
||||
create_table "categories", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "ancestry"
|
||||
|
@ -116,10 +112,9 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.string "locked_by"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
end
|
||||
|
||||
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
|
||||
|
||||
create_table "downloads", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "version"
|
||||
|
@ -163,15 +158,7 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.string "status", :default => "open"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "issues", ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
||||
|
||||
create_table "permissions", :force => true do |t|
|
||||
t.integer "right_id"
|
||||
t.integer "role_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true
|
||||
end
|
||||
|
||||
create_table "platforms", :force => true do |t|
|
||||
|
@ -203,10 +190,9 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.datetime "notified_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
end
|
||||
|
||||
add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id"
|
||||
|
||||
create_table "products", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.integer "platform_id", :null => false
|
||||
|
@ -228,6 +214,15 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.boolean "use_cron", :default => false
|
||||
end
|
||||
|
||||
create_table "project_imports", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.string "name"
|
||||
t.string "version"
|
||||
t.datetime "file_mtime"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "project_to_repositories", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "repository_id"
|
||||
|
@ -246,10 +241,14 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.string "srpm_content_type"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.integer "srpm_file_size"
|
||||
t.string "srpm_file_name"
|
||||
t.index ["category_id"], :name => "index_projects_on_category_id"
|
||||
t.index ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
|
||||
end
|
||||
|
||||
add_index "projects", ["category_id"], :name => "index_projects_on_category_id"
|
||||
|
||||
create_table "relations", :force => true do |t|
|
||||
t.integer "object_id"
|
||||
t.string "object_type"
|
||||
|
@ -270,38 +269,16 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.string "owner_type"
|
||||
end
|
||||
|
||||
create_table "rights", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.string "controller", :null => false
|
||||
t.string "action", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "role_lines", :force => true do |t|
|
||||
t.integer "role_id"
|
||||
t.integer "relation_id"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "roles", :force => true do |t|
|
||||
t.string "name"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "rpms", :force => true do |t|
|
||||
t.string "name", :null => false
|
||||
t.integer "arch_id", :null => false
|
||||
t.integer "project_id", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
t.index ["project_id"], :name => "index_rpms_on_project_id"
|
||||
t.index ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
||||
end
|
||||
|
||||
add_index "rpms", ["project_id", "arch_id"], :name => "index_rpms_on_project_id_and_arch_id"
|
||||
add_index "rpms", ["project_id"], :name => "index_rpms_on_project_id"
|
||||
|
||||
create_table "settings_notifiers", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.boolean "can_notify", :default => true
|
||||
|
@ -326,16 +303,6 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.integer "project_id"
|
||||
end
|
||||
|
||||
create_table "user_emails", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
t.string "email", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
add_index "user_emails", ["email"], :name => "index_user_emails_on_email"
|
||||
add_index "user_emails", ["user_id"], :name => "index_user_emails_on_user_id"
|
||||
|
||||
create_table "users", :force => true do |t|
|
||||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
|
@ -350,10 +317,9 @@ ActiveRecord::Schema.define(:version => 20120123161250) do
|
|||
t.string "uname"
|
||||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.index ["email"], :name => "index_users_on_email", :unique => true
|
||||
t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||
t.index ["uname"], :name => "index_users_on_uname", :unique => true
|
||||
end
|
||||
|
||||
add_index "users", ["email"], :name => "index_users_on_email", :unique => true
|
||||
add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
|
||||
add_index "users", ["uname"], :name => "index_users_on_uname", :unique => true
|
||||
|
||||
end
|
||||
|
|
|
@ -36,7 +36,8 @@ module Grack
|
|||
uname, name = @env['PATH_INFO'].split('/')[1,2]
|
||||
name.gsub! /\.git$/, ''
|
||||
owner = User.find_by_uname(uname) || Group.find_by_uname(uname)
|
||||
Project.where(:owner_id => owner.id, :owner_type => owner.class).find_by_name(name)
|
||||
scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class)
|
||||
scoped.find_by_name(name) || scoped.by_name(name).first
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -5,8 +5,9 @@ namespace :import do
|
|||
desc "Load projects"
|
||||
task :projects => :environment do
|
||||
source = ENV['SOURCE'] || 'http://dl.dropbox.com/u/984976/package_list.txt'
|
||||
owner = User.find_by_uname(ENV['OWNER_UNAME']) || Group.find_by_uname(ENV['OWNER_UNAME']) || User.first
|
||||
platform = Platform.find_by_name(ENV['PLATFORM_NAME']) # 'mandriva2011'
|
||||
#owner = User.find_by_uname(ENV['OWNER_UNAME']) || Group.find_by_uname(ENV['OWNER_UNAME']) || User.first
|
||||
owner = Group.find_by_uname("npp_team")
|
||||
platform = Platform.find_by_name("RosaNPP") # RosaNPP
|
||||
repo = platform.repositories.first rescue nil
|
||||
say "START import projects from '#{source}' for '#{owner.uname}'.#{repo ? " To repo '#{platform.name}/#{repo.name}'." : ''}"
|
||||
ask 'Press enter to continue'
|
||||
|
@ -24,4 +25,84 @@ namespace :import do
|
|||
end
|
||||
say 'DONE'
|
||||
end
|
||||
|
||||
namespace :sync do
|
||||
desc "Sync all repos"
|
||||
task :all do
|
||||
system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=main")
|
||||
system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=contrib")
|
||||
system("bundle exec rake import:sync:run RELEASE=official/2011 PLATFORM=mandriva2011 REPOSITORY=non-free")
|
||||
system("bundle exec rake import:sync:run RELEASE=devel/cooker PLATFORM=cooker REPOSITORY=main")
|
||||
system("bundle exec rake import:sync:run RELEASE=devel/cooker PLATFORM=cooker REPOSITORY=contrib")
|
||||
system("bundle exec rake import:sync:run RELEASE=devel/cooker PLATFORM=cooker REPOSITORY=non-free")
|
||||
end
|
||||
|
||||
task :run => [:rsync, :parse]
|
||||
|
||||
desc "Rsync with mirror.yandex.ru"
|
||||
task :rsync => :environment do
|
||||
release = ENV['RELEASE'] || 'official/2011'
|
||||
repository = ENV['REPOSITORY'] || 'main'
|
||||
source = "rsync://mirror.yandex.ru/mandriva/#{release}/SRPMS/#{repository}/"
|
||||
destination = ENV['DESTINATION'] || File.join(APP_CONFIG['root_path'], 'mirror.yandex.ru', 'mandriva', release, 'SRPMS', repository)
|
||||
say "START rsync projects (*.src.rpm) from '#{source}' to '#{destination}'"
|
||||
if system "rsync -rtv --delete #{source} #{destination}" # TODO --include='*.src.rpm' --exclude='*'
|
||||
say 'Rsync ok!'
|
||||
else
|
||||
say 'Rsync failed!'
|
||||
end
|
||||
say 'DONE'
|
||||
end
|
||||
|
||||
desc "Parse repository for changes"
|
||||
task :parse => :environment do
|
||||
release = ENV['RELEASE'] || 'official/2011'
|
||||
platform = Platform.find_by_name(ENV['PLATFORM'] || "mandriva2011")
|
||||
repository = platform.repositories.find_by_name(ENV['REPOSITORY'] || 'main')
|
||||
source = ENV['SOURCE'] || File.join(APP_CONFIG['root_path'], 'mirror.yandex.ru', 'mandriva', release, 'SRPMS', repository.name)
|
||||
owner = Group.find_or_create_by_uname(ENV['OWNER'] || 'import') {|g| g.owner = User.first}
|
||||
branch = "import_#{platform.name}"
|
||||
|
||||
say 'START'
|
||||
Dir[File.join source, '{release,updates}', '*.src.rpm'].each do |srpm_file|
|
||||
say "=== Processing '#{srpm_file}'..."
|
||||
if name = `rpm -q --qf '[%{Name}]' -p #{srpm_file}` and $?.success? and name.present? and
|
||||
version = `rpm -q --qf '[%{Version}]' -p #{srpm_file}` and $?.success? and version.present?
|
||||
project_import = ProjectImport.find_by_name(name) || ProjectImport.by_name(name).first || ProjectImport.new(:name => name)
|
||||
if version != project_import.version.to_s and File.mtime(srpm_file) > project_import.file_mtime
|
||||
unless project = project_import.project
|
||||
if project = repository.projects.find_by_name(name) || repository.projects.by_name(name).first # fallback to speedup
|
||||
say "Found project '#{project.owner.uname}/#{project.name}'"
|
||||
elsif scoped = Project.where(:owner_id => owner.id, :owner_type => owner.class) and
|
||||
project = scoped.find_by_name(name) || scoped.by_name(name).first
|
||||
repository.projects << project
|
||||
say "Add project '#{project.owner.uname}/#{project.name}' to '#{platform.name}/#{repository.name}'"
|
||||
else
|
||||
description = ::Iconv.conv('UTF-8//IGNORE', 'UTF-8', `rpm -q --qf '[%{Description}]' -p #{srpm_file}`)
|
||||
project = Project.create!(:name => name, :description => description) {|p| p.owner = owner}
|
||||
repository.projects << project
|
||||
say "Create project #{project.owner.uname}/#{project.name} in #{platform.name}/#{repository.name}"
|
||||
end
|
||||
end
|
||||
project.import_srpm(srpm_file, branch)
|
||||
say "New version (#{version}) for '#{project.owner.uname}/#{project.name}' successfully imported to branch '#{branch}'!"
|
||||
|
||||
project_import.project = project
|
||||
project_import.version = version
|
||||
project_import.file_mtime = File.mtime(srpm_file)
|
||||
project_import.save!
|
||||
|
||||
# TODO notify import.members
|
||||
|
||||
say '=== Success!'
|
||||
else
|
||||
say '=== Not changed!'
|
||||
end
|
||||
else
|
||||
say '=== Fail!'
|
||||
end
|
||||
end
|
||||
say 'DONE'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
# Read about factories at http://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :project_import do
|
||||
project nil
|
||||
name "MyString"
|
||||
version "MyString"
|
||||
end
|
||||
end
|
|
@ -91,7 +91,7 @@ describe CanCan do
|
|||
@ability.should be_able_to(:read, @admin)
|
||||
end
|
||||
|
||||
it "shoud be able to read index AutoBuildList" do
|
||||
pending "shoud be able to read index AutoBuildList" do
|
||||
@ability.should be_able_to(:index, AutoBuildList)
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe ProjectImport do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue