Merge branch 'master' into 880-add-publish-again-option-for-build-list
This commit is contained in:
commit
c8ae6053af
2
Gemfile
2
Gemfile
|
@ -13,7 +13,7 @@ gem 'omniauth-openid', '~> 1.0.1'
|
|||
gem 'cancan', '1.6.7' # 1.6.8 fail specs with strange error
|
||||
|
||||
gem 'ancestry', '~> 1.3.0'
|
||||
gem 'paperclip', '~> 3.1.4'
|
||||
gem 'paperclip', '~> 3.3.1'
|
||||
gem 'resque', '~> 1.21.0'
|
||||
gem 'resque-status', '~> 0.3.3'
|
||||
gem 'resque_mailer', '~> 2.1.0'
|
||||
|
|
11
Gemfile.lock
11
Gemfile.lock
|
@ -82,10 +82,7 @@ GEM
|
|||
charlock_holmes (0.6.9)
|
||||
chronic (0.6.7)
|
||||
chunky_png (1.2.7)
|
||||
climate_control (0.0.3)
|
||||
activesupport (>= 3.0)
|
||||
cocaine (0.5.1)
|
||||
climate_control (>= 0.0.3, < 1.0)
|
||||
cocaine (0.4.2)
|
||||
coffee-rails (3.2.2)
|
||||
coffee-script (>= 2.2.0)
|
||||
railties (~> 3.2.0)
|
||||
|
@ -206,11 +203,11 @@ GEM
|
|||
omniauth (~> 1.0)
|
||||
rack-openid (~> 1.3.1)
|
||||
orm_adapter (0.4.0)
|
||||
paperclip (3.1.4)
|
||||
paperclip (3.3.1)
|
||||
activemodel (>= 3.0.0)
|
||||
activerecord (>= 3.0.0)
|
||||
activesupport (>= 3.0.0)
|
||||
cocaine (>= 0.0.2)
|
||||
cocaine (~> 0.4.0)
|
||||
mime-types
|
||||
perform_later (1.3.0)
|
||||
rails (~> 3.0)
|
||||
|
@ -415,7 +412,7 @@ DEPENDENCIES
|
|||
newrelic_rpm (~> 3.4.1)
|
||||
omniauth (~> 1.1.0)
|
||||
omniauth-openid (~> 1.0.1)
|
||||
paperclip (~> 3.1.4)
|
||||
paperclip (~> 3.3.1)
|
||||
perform_later (~> 1.3.0)
|
||||
pg (~> 0.14.0)
|
||||
rack-throttle
|
||||
|
|
|
@ -9,10 +9,13 @@ $(document).ready(function() {
|
|||
var build_platform = $('#build_for_pl_' + platform_id);
|
||||
var all_repositories = $('.all_platforms input');
|
||||
all_repositories.removeAttr('checked');
|
||||
var use_save_to_repository = $('#build_list_use_save_to_repository');
|
||||
|
||||
if (build_platform.size() == 0) {
|
||||
all_repositories.removeAttr('disabled');
|
||||
use_save_to_repository.removeAttr('disabled');
|
||||
} else {
|
||||
use_save_to_repository.attr('disabled', 'disabled').attr('checked', 'checked');
|
||||
all_repositories.attr('disabled', 'disabled');
|
||||
var parent = build_platform.parent();
|
||||
parent.find('input').removeAttr('disabled');
|
||||
|
|
|
@ -10,8 +10,7 @@ class Projects::Git::BaseController < Projects::BaseController
|
|||
protected
|
||||
|
||||
def set_treeish_and_path
|
||||
@treeish = params[:treeish].presence || @project.default_branch
|
||||
@path = params[:path]
|
||||
@treeish, @path = @project.default_head(params[:treeish]), params[:path]
|
||||
end
|
||||
|
||||
def set_branch_and_tree
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- encoding : utf-8 -*-
|
||||
class Projects::Git::TreesController < Projects::Git::BaseController
|
||||
before_filter lambda{redirect_to @project if params[:treeish] == @project.default_branch and params[:path].blank?}, :only => :show
|
||||
skip_before_filter :set_branch_and_tree, :only => :archive
|
||||
skip_before_filter :set_branch_and_tree, :set_treeish_and_path, :only => :archive
|
||||
|
||||
def show
|
||||
@tree = @tree / @path if @path.present?
|
||||
|
@ -10,7 +10,7 @@ class Projects::Git::TreesController < Projects::Git::BaseController
|
|||
end
|
||||
|
||||
def archive
|
||||
format = params[:format]
|
||||
format, @treeish = params[:format], params[:treeish]
|
||||
if (@treeish =~ /^#{@project.owner.uname}-#{@project.name}-/) && !(@treeish =~ /[\s]+/) && (format =~ /^(zip|tar\.gz)$/)
|
||||
@treeish = @treeish.gsub(/^#{@project.owner.uname}-#{@project.name}-/, '')
|
||||
@commit = @project.repo.commits(@treeish, 1).first
|
||||
|
|
|
@ -152,8 +152,8 @@ class Projects::PullRequestsController < Projects::BaseController
|
|||
@pull.issue.body = pull_params[:issue_attributes][:body].presence
|
||||
end
|
||||
@pull.from_project = @project
|
||||
@pull.to_ref = (pull_params[:to_ref].presence if pull_params) || @pull.to_project.default_branch
|
||||
@pull.from_ref = params[:treeish].presence || (pull_params[:from_ref].presence if pull_params) || @pull.from_project.default_branch
|
||||
@pull.to_ref = (pull_params[:to_ref].presence if pull_params) || @pull.to_project.default_head(params[:treeish])
|
||||
@pull.from_ref = params[:treeish].presence || (pull_params[:from_ref].presence if pull_params) || @pull.from_project.default_head(params[:treeish])
|
||||
@pull.from_project_owner_uname = @pull.from_project.owner.uname
|
||||
@pull.from_project_name = @pull.from_project.name
|
||||
end
|
||||
|
|
|
@ -26,10 +26,10 @@ class BuildList < ActiveRecord::Base
|
|||
validates :update_type, :inclusion => {:in => RELEASE_UPDATE_TYPES, :message => I18n.t('flash.build_list.frozen_platform')},
|
||||
:if => Proc.new { |b| b.advisory.present? }
|
||||
validate lambda {
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.main? && save_to_platform_id != build_for_platform_id
|
||||
}
|
||||
validate lambda {
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_build_for_platform')) unless build_for_platform.platform_type == 'main'
|
||||
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_build_for_platform')) unless build_for_platform.main?
|
||||
}
|
||||
validate lambda {
|
||||
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_repository')) unless save_to_repository_id.in? save_to_platform.repositories.map(&:id)
|
||||
|
@ -43,9 +43,11 @@ class BuildList < ActiveRecord::Base
|
|||
errors.add(:save_to_repository, I18n.t('flash.build_list.wrong_project')) unless save_to_repository.projects.exists?(project_id)
|
||||
}
|
||||
|
||||
before_create :use_save_to_repository_for_main_platforms
|
||||
|
||||
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
|
||||
:arch_id, :project_id, :save_to_repository_id, :update_type,
|
||||
:save_to_platform_id, :project_version
|
||||
:save_to_platform_id, :project_version, :use_save_to_repository
|
||||
LIVE_TIME = 4.week # for unpublished
|
||||
MAX_LIVE_TIME = 3.month # for published
|
||||
|
||||
|
@ -395,7 +397,7 @@ class BuildList < ActiveRecord::Base
|
|||
h["#{repo.name}_updates"] = path + 'updates'
|
||||
end
|
||||
end
|
||||
if save_to_platform.personal?
|
||||
if save_to_platform.personal? && use_save_to_repository
|
||||
include_repos_hash["#{save_to_platform.name}_release"] = save_to_platform.
|
||||
urpmi_list(nil, nil, false, save_to_repository.name)["#{build_for_platform.name}"]["#{arch.name}"]
|
||||
end
|
||||
|
@ -446,4 +448,8 @@ class BuildList < ActiveRecord::Base
|
|||
yield p
|
||||
end
|
||||
end
|
||||
|
||||
def use_save_to_repository_for_main_platforms
|
||||
self.use_save_to_repository = true if save_to_platform.main?
|
||||
end
|
||||
end
|
||||
|
|
|
@ -178,6 +178,14 @@ class Project < ActiveRecord::Base
|
|||
AbfWorker::BuildListsPublishTaskManager.destroy_project_from_repository self, repository
|
||||
end
|
||||
|
||||
def default_head treeish = nil # maybe need change 'head'?
|
||||
if repo.branches_and_tags.map(&:name).include?(treeish || default_branch)
|
||||
treeish || default_branch
|
||||
else
|
||||
repo.branches_and_tags[0].try(:name) || default_branch
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
def truncate_name
|
||||
|
|
|
@ -125,7 +125,7 @@ class PullRequest < ActiveRecord::Base
|
|||
def self.check_ref(record, attr, value)
|
||||
project = attr == :from_ref ? record.from_project : record.to_project
|
||||
return if project.blank?
|
||||
if record.to_project.repo.commits.count > 0
|
||||
if record.to_project.repo.branches.count > 0
|
||||
record.errors.add attr, I18n.t('projects.pull_requests.wrong_ref') unless project.repo.branches_and_tags.map(&:name).include?(value)
|
||||
else
|
||||
record.errors.add attr, I18n.t('projects.pull_requests.empty_repo')
|
||||
|
@ -179,8 +179,8 @@ class PullRequest < ActiveRecord::Base
|
|||
system 'git', 'tag', '-d', from_ref, to_ref
|
||||
system 'git fetch --tags'
|
||||
tags, head = repo.tags.map(&:name), to_project == from_project ? 'origin' : 'head'
|
||||
unless tags.include? to_ref
|
||||
system 'git', 'checkout', to_ref
|
||||
unless tags.include? to_ref
|
||||
system 'git', 'reset', '--hard', "origin/#{to_ref}"
|
||||
end
|
||||
unless tags.include? from_ref
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
json.build_list do |json|
|
||||
json.(@build_list, :id, :name, :container_status, :status, :duration)
|
||||
json.(@build_list, :is_circle, :update_type, :priority, :new_core)
|
||||
json.(@build_list, :advisory, :mass_build)
|
||||
json.(@build_list, :advisory, :mass_build, :use_save_to_repository)
|
||||
json.(@build_list, :auto_publish, :package_version, :commit_hash, :last_published_commit_hash)
|
||||
json.build_log_url log_build_list_path(@build_list)
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
- content_for :submenu do
|
||||
- act = action_name.to_sym; contr = controller_name.to_sym; treeish = params[:treeish].presence || @project.default_branch
|
||||
- act = action_name.to_sym; contr = controller_name.to_sym; treeish = @project.default_head(params[:treeish])
|
||||
.left
|
||||
.table-sort-left=image_tag visibility_icon(@project.visibility)
|
||||
.table-sort-right=@project.name
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
.both
|
||||
= f.check_box :auto_publish
|
||||
= f.label :auto_publish
|
||||
.both
|
||||
= f.check_box :use_save_to_repository
|
||||
= f.label :use_save_to_repository
|
||||
%br
|
||||
= f.submit t("layout.projects.build_button")
|
||||
|
||||
|
|
|
@ -37,6 +37,9 @@
|
|||
.rightlist
|
||||
= link_to "#{@build_list.save_to_platform.name}/#{@build_list.save_to_repository.name}", [@build_list.save_to_platform, @build_list.save_to_repository]
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.use_save_to_repository")
|
||||
.rightlist= t("layout.#{@build_list.use_save_to_repository?}_")
|
||||
.both
|
||||
.leftlist= t("activerecord.attributes.build_list.include_repos")
|
||||
.rightlist= (@build_list.include_repos||[]).map{|r| Repository.find(r).name}.join(', ')
|
||||
.both
|
||||
|
|
|
@ -20,6 +20,7 @@ en:
|
|||
include_repos: Included repositories
|
||||
created_at: Created on
|
||||
save_to_repository: Save to repository
|
||||
use_save_to_repository: Use 'save to repository' for assembly
|
||||
build_for_platform: Build for platform
|
||||
update_type: Update type
|
||||
auto_publish: Automated publising
|
||||
|
|
|
@ -20,6 +20,7 @@ ru:
|
|||
include_repos: Подключаемые репозитории
|
||||
created_at: Создан
|
||||
save_to_repository: Сохранить в репозиторий
|
||||
use_save_to_repository: Использовать 'cохранить в репозиторий' для сборки
|
||||
build_for_platform: Собрано для платформы
|
||||
update_type: Критичность обновления
|
||||
auto_publish: Автоматическая публикация
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
class AddUsePersonalRepositoryToBuildList < ActiveRecord::Migration
|
||||
def change
|
||||
add_column :build_lists, :use_save_to_repository, :boolean, :default => true
|
||||
end
|
||||
end
|
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20130129145833) do
|
||||
ActiveRecord::Schema.define(:version => 20130201094007) do
|
||||
|
||||
create_table "activity_feeds", :force => true do |t|
|
||||
t.integer "user_id", :null => false
|
||||
|
@ -133,6 +133,7 @@ ActiveRecord::Schema.define(:version => 20130129145833) do
|
|||
t.boolean "new_core", :default => true
|
||||
t.string "last_published_commit_hash"
|
||||
t.integer "container_status"
|
||||
t.boolean "use_save_to_repository", :default => true
|
||||
end
|
||||
|
||||
add_index "build_lists", ["advisory_id"], :name => "index_build_lists_on_advisory_id"
|
||||
|
|
Loading…
Reference in New Issue