diff --git a/app/controllers/build_lists_controller.rb b/app/controllers/build_lists_controller.rb index 63494911f..e0ce08136 100644 --- a/app/controllers/build_lists_controller.rb +++ b/app/controllers/build_lists_controller.rb @@ -84,8 +84,7 @@ class BuildListsController < ApplicationController if params[:status].to_i == 0 # ok @build_list.status = BuildList::BUILD_PUBLISHED @build_list.package_version = "#{params[:version]}-#{params[:release]}" - system("cd #{@build_list.project.git_repository.path} && - git tag -a -m '#{@build_list.package_version}' #{@build_list.package_version} #{@build_list.commit_hash}") # TODO REDO through grit + system("cd #{@build_list.project.git_repository.path} && git tag #{@build_list.package_version} #{@build_list.commit_hash}") # TODO REDO through grit else @build_list.status = BuildList::FAILED_PUBLISH end diff --git a/db/migrate/20111012223306_create_roles.rb b/db/migrate/20111012223306_create_roles.rb new file mode 100644 index 000000000..b5693219d --- /dev/null +++ b/db/migrate/20111012223306_create_roles.rb @@ -0,0 +1,14 @@ +class CreateRoles < ActiveRecord::Migration + def self.up + create_table :roles do |t| + t.integer :id + t.string :name + + t.timestamps + end + end + + def self.down + drop_table :roles + end +end diff --git a/db/migrate/20111019173246_create_role_lines.rb b/db/migrate/20111019173246_create_role_lines.rb new file mode 100644 index 000000000..84aa4e3de --- /dev/null +++ b/db/migrate/20111019173246_create_role_lines.rb @@ -0,0 +1,13 @@ +class CreateRoleLines < ActiveRecord::Migration + def self.up + create_table :role_lines do |t| + t.integer :role_id + t.integer :relation_id + t.timestamps + end + end + + def self.down + drop_table :role_lines + end +end diff --git a/spec/controllers/build_lists_controller_spec.rb b/spec/controllers/build_lists_controller_spec.rb index 3dbba5397..79035ac97 100644 --- a/spec/controllers/build_lists_controller_spec.rb +++ b/spec/controllers/build_lists_controller_spec.rb @@ -45,7 +45,7 @@ describe BuildListsController do end it 'should save correct commit_hash for tag based build' do - system("cd #{@project.git_repository.path} && git tag -a -m '4.7.5.3' 4.7.5.3") # TODO REDO through grit + system("cd #{@project.git_repository.path} && git tag 4.7.5.3") # TODO REDO through grit post :create, {:project_id => @project.id}.merge(@create_params).deep_merge(:build_list => {:project_version => "4.7.5.3"}) @project.build_lists.last.commit_hash.should == @project.git_repository.commits('4.7.5.3').last.id end @@ -312,14 +312,19 @@ describe BuildListsController do let(:build_list) { Factory(:build_list_core) } describe 'publish_build' do - before {test_git_commit(build_list.project); build_list.update_attribute :commit_hash, build_list.project.git_repository.commits.last.id} + before { test_git_commit(build_list.project); build_list.update_attribute :commit_hash, build_list.project.git_repository.commits('master').last.id } def do_get(status) get :publish_build, :id => build_list.bs_id, :status => status, :version => '4.7.5.3', :release => '1' build_list.reload end - it { do_get(BuildServer::SUCCESS); build_list.project.git_repository.tags.last.name.should == build_list.package_version; response.should be_ok } + it { do_get(BuildServer::SUCCESS); response.should be_ok } + it 'should create correct git tag for correct commit' do + do_get(BuildServer::SUCCESS) + build_list.project.git_repository.tags.last.name.should == build_list.package_version + build_list.project.git_repository.commits(build_list.package_version).last.id.should == build_list.commit_hash + end it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :status).to(BuildList::BUILD_PUBLISHED) } it { lambda{ do_get(BuildServer::SUCCESS) }.should change(build_list, :package_version).to('4.7.5.3-1') } it { lambda{ do_get(BuildServer::ERROR) }.should change(build_list, :status).to(BuildList::FAILED_PUBLISH) } diff --git a/spec/factories/build_list_factory.rb b/spec/factories/build_list_factory.rb index 608c48a50..751a6ea09 100644 --- a/spec/factories/build_list_factory.rb +++ b/spec/factories/build_list_factory.rb @@ -8,7 +8,7 @@ Factory.define(:build_list) do |p| p.build_requires true p.update_type 'security' p.include_repos {|bl| bl.pl.repositories.map(&:id)} - p.commit_hash 'e681644ed702fae285483d2ca73d85ee2930b8de' + p.commit_hash '1234567890abcdef1234567890abcdef12345678' end Factory.define(:build_list_core, :parent => :build_list) do |p|