diff options
author | Valery Sizov <valery@gitlab.com> | 2015-04-17 14:15:24 +0000 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2015-04-17 14:15:24 +0000 |
commit | f73c162835c11a357baf59430fddceb02e22259b (patch) | |
tree | 0604a37a22667a57f286f2bb773b4f4e9435e32e /app | |
parent | cca6ded9fd1874863a265ca4d96c243e637ec3de (diff) | |
parent | ba97b86868c14c7e4e18bada4247f57bd544c837 (diff) | |
download | gitlab-ci-f73c162835c11a357baf59430fddceb02e22259b.tar.gz |
Merge branch 'cleanup' into 'master'
Cleanup the build model
https://dev.gitlab.org/gitlab/gitlab-ci/issues/202
See merge request !67
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/builds_controller.rb | 2 | ||||
-rw-r--r-- | app/models/build.rb | 20 | ||||
-rw-r--r-- | app/models/commit.rb | 1 | ||||
-rw-r--r-- | app/models/job.rb | 1 |
4 files changed, 4 insertions, 20 deletions
diff --git a/app/controllers/builds_controller.rb b/app/controllers/builds_controller.rb index a1cb017..fc9ec18 100644 --- a/app/controllers/builds_controller.rb +++ b/app/controllers/builds_controller.rb @@ -49,7 +49,7 @@ class BuildsController < ApplicationController end def status - render json: @build.to_json(only: [:status, :id, :sha, :coverage]) + render json: @build.to_json(only: [:status, :id, :sha, :coverage], methods: :sha) end def cancel diff --git a/app/models/build.rb b/app/models/build.rb index 3d776ba..c9f1230 100644 --- a/app/models/build.rb +++ b/app/models/build.rb @@ -4,20 +4,15 @@ # # id :integer not null, primary key # project_id :integer -# ref :string(255) # status :string(255) # finished_at :datetime # trace :text # created_at :datetime # updated_at :datetime -# sha :string(255) # started_at :datetime -# tmp_file :string(255) -# before_sha :string(255) -# push_data :text # runner_id :integer -# coverage :float # commit_id :integer +# coverage :float # commands :text # job_id :integer # @@ -79,7 +74,6 @@ class Build < ActiveRecord::Base new_build.job_id = build.job_id new_build.commit_id = build.commit_id - new_build.ref = build.ref new_build.project_id = build.project_id new_build.save new_build @@ -133,7 +127,7 @@ class Build < ActiveRecord::Base state :canceled, value: 'canceled' end - delegate :sha, :short_sha, :before_sha, + delegate :sha, :short_sha, :before_sha, :ref, to: :commit, prefix: false def trace_html @@ -219,16 +213,6 @@ class Build < ActiveRecord::Base end end - def ref - build_ref = read_attribute(:ref) - - if build_ref.present? - build_ref - else - commit.ref - end - end - def for_tag? if job && job.build_tags true diff --git a/app/models/commit.rb b/app/models/commit.rb index 5f1aa92..6817a9e 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -117,7 +117,6 @@ class Commit < ActiveRecord::Base build.tag_list = job.tag_list build.project_id = project_id build.job = job - build.ref = ref build.save build end diff --git a/app/models/job.rb b/app/models/job.rb index 14cc344..110c96d 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -13,6 +13,7 @@ # build_tags :boolean default(FALSE), not null # job_type :string(255) default("parallel") # refs :string(255) +# deleted_at :datetime # class Job < ActiveRecord::Base |