#843: remove 'latest_' prefix

This commit is contained in:
Vokhmin Alexey V 2013-01-21 21:08:19 +04:00
parent 86034c5da4
commit d2a876c9cb
11 changed files with 13 additions and 14 deletions

View File

@ -36,7 +36,7 @@ $(document).ready(function() {
function setBranchSelected(selected_option) {
var pl_name = selected_option.text().match(/([\w-.]+)\/[\w-.]+/)[1];
var bl_version_sel = $('#build_list_project_version');
var branch_pl_opt = bl_version_sel.find('option[value="latest_' + pl_name + '"]');
var branch_pl_opt = bl_version_sel.find('option[value="' + pl_name + '"]');
// If there is branch we need - set it selected:
if (branch_pl_opt.size() > 0) {
bl_version_sel.find('option[selected]').removeAttr('selected');

View File

@ -65,7 +65,7 @@ module GitHelper
end
def versions_for_group_select(project)
[ ['Branches', project.repo.branches.map{|b| "latest_#{b.name}"}],
[ ['Branches', project.repo.branches.map(&:name)],
['Tags', project.repo.tags.map(&:name)] ]
end

View File

@ -138,7 +138,7 @@ class Project < ActiveRecord::Base
build_reps_ids = [main_rep_id, repository_id].compact.uniq
project_version = repo.commits("#{platform.name}").try(:first).try(:id) ?
"latest_#{platform.name}" : "latest_master"
platform.name : 'master'
build_list = build_lists.build do |bl|
bl.save_to_platform = platform
bl.build_for_platform = platform

View File

@ -9,7 +9,7 @@
.both
.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), :class => :label
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || "latest_" + pbl.project.default_branch
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || pbl.project.default_branch
.both
.leftlist= f.label :arch, t("activerecord.attributes.product_build_list.arch"), :class => :label

View File

@ -14,7 +14,7 @@
%h3= t("activerecord.attributes.build_list.save_to_repository")
.lineForm= f.select :save_to_repository_id, @project.repositories.collect{|r| ["#{r.platform.name}/#{r.name}", r.id, {:publish_without_qa => r.publish_without_qa? ? 1 : 0, :platform_id => r.platform.id}]}
%h3= t("activerecord.attributes.build_list.project_version")
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || "latest_" + @project.default_branch
.lineForm= f.select :project_version, versions_for_group_select(@project), :selected => params[:build_list].try(:fetch, :project_version) || @project.default_branch
%h3= t("activerecord.attributes.build_list.arch")
- Arch.recent.each do |arch|
.both

View File

@ -20,8 +20,7 @@ module Modules
def set_commit_and_version
if project && project_version.present? && commit_hash.blank?
self.commit_hash = project.repo.commits(project_version.match(/^latest_(.+)/).to_a.last ||
project_version).try(:first).try(:id)
self.commit_hash = project.repo.commits(project_version).try(:first).try(:id)
elsif project_version.blank? && commit_hash.present?
self.project_version = commit_hash
end

View File

@ -34,7 +34,7 @@ module Modules
end
def versions
repo.tags.map(&:name) + repo.branches.map{|b| "latest_#{b.name}"}
repo.tags.map(&:name) + repo.branches.map(&:name)
end
def update_file(path, data, options = {})

View File

@ -96,7 +96,7 @@ describe Platforms::ProductBuildListsController do
end
def valid_attributes
{:product_id => @product.id, :platform_id => @product.platform_id, :product_build_list => {:main_script => 'build.sh', :time_living => 60, :project_version => 'latest_master', :arch_id => @arch.id}}
{:product_id => @product.id, :platform_id => @product.platform_id, :product_build_list => {:main_script => 'build.sh', :time_living => 60, :project_version => 'master', :arch_id => @arch.id}}
end
def valid_attributes_for_destroy

View File

@ -43,7 +43,7 @@ describe Projects::BuildListsController do
end
it 'should save correct commit_hash for branch based build' do
post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "latest_master"})
post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "master"})
@project.build_lists.last.commit_hash.should == @project.repo.commits('master').first.id
end
@ -54,7 +54,7 @@ describe Projects::BuildListsController do
end
it 'should not be able to create with wrong project version' do
lambda{ post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "latest_wrong", :commit_hash => nil})}.should change{@project.build_lists.count}.by(0)
lambda{ post :create, {:owner_name => @project.owner.uname, :project_name => @project.name}.merge(@create_params).deep_merge(:build_list => {:project_version => "wrong", :commit_hash => nil})}.should change{@project.build_lists.count}.by(0)
end
it 'should not be able to create with wrong git hash' do
@ -85,7 +85,7 @@ describe Projects::BuildListsController do
@platform = FactoryGirl.create(:platform_with_repos)
@create_params = {
:build_list => {
:project_version => 'latest_master',
:project_version => 'master',
:save_to_repository_id => @platform.repositories.first.id,
:update_type => 'security',
:include_repos => [@platform.repositories.first.id]

View File

@ -15,7 +15,7 @@ FactoryGirl.define do
save_to_repository {|bl| bl.save_to_platform.repositories.first}
update_type 'security'
include_repos {|bl| bl.save_to_platform.repositories.map(&:id)}
project_version 'latest_master'
project_version 'master'
commit_hash {|bl| Grit::Repo.new(bl.project.path).commits.first.id}
end

View File

@ -8,6 +8,6 @@ FactoryGirl.define do
main_script 'build.sh'
params 'ENV=i586'
time_living 150
project_version 'latest_master'
project_version 'master'
end
end