diff options
author | Valery Sizov <vsv2711@gmail.com> | 2015-05-26 15:08:51 +0300 |
---|---|---|
committer | Valery Sizov <vsv2711@gmail.com> | 2015-05-26 15:08:51 +0300 |
commit | 3e22a7a269b7e25711cfc18500ddd95c43f1c67c (patch) | |
tree | ed3c7255c6f23f76e3cfef35646526c8c70ad34d | |
parent | e37aa53719175d2c46a460aaead35ffe1c55c4f8 (diff) | |
download | gitlab-ci-3e22a7a269b7e25711cfc18500ddd95c43f1c67c.tar.gz |
Refactoring STEP 4
-rw-r--r-- | app/assets/javascripts/build.coffee | 2 | ||||
-rw-r--r-- | app/models/build.rb | 19 | ||||
-rw-r--r-- | app/models/job.rb | 2 | ||||
-rw-r--r-- | app/models/jobs/travis_job.rb | 2 | ||||
-rw-r--r-- | app/views/projects/_form.html.haml | 4 | ||||
-rw-r--r-- | lib/ansi2html.rb | 2 |
6 files changed, 9 insertions, 22 deletions
diff --git a/app/assets/javascripts/build.coffee b/app/assets/javascripts/build.coffee index 450d202..8145b67 100644 --- a/app/assets/javascripts/build.coffee +++ b/app/assets/javascripts/build.coffee @@ -40,7 +40,7 @@ class Build @Build = Build -@Fold_Section = (foldName) -> +@FoldSection = (foldName) -> section = document.getElementById(foldName) if section if section.classList.contains("open") diff --git a/app/models/build.rb b/app/models/build.rb index e59078a..d951a66 100644 --- a/app/models/build.rb +++ b/app/models/build.rb @@ -40,6 +40,8 @@ class Build < ActiveRecord::Base # To prevent db load megabytes of data from trace default_scope -> { select(Build.columns_without_lazy) } + delegate :ref, to: :commit + class << self def columns_without_lazy (column_names - LAZY_ATTRIBUTES).map do |column_name| @@ -230,22 +232,7 @@ 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 origin_ref=(value) - value = "refs/heads/#{value}" unless value.start_with?("refs/") - write_attribute(:origin_ref, value) - end - def for_tag? - origin_ref.present? && origin_ref.start_with?("refs/tags/") + commit.tag? end end diff --git a/app/models/job.rb b/app/models/job.rb index 391e562..5c05ba9 100644 --- a/app/models/job.rb +++ b/app/models/job.rb @@ -60,7 +60,7 @@ class Job < ActiveRecord::Base # implement inside child end - def execute(commit, ref) + def execute(commit) # implement inside child end diff --git a/app/models/jobs/travis_job.rb b/app/models/jobs/travis_job.rb index 4dd1860..0667c30 100644 --- a/app/models/jobs/travis_job.rb +++ b/app/models/jobs/travis_job.rb @@ -173,7 +173,7 @@ eos mail = MailService.new mail.project = build.project - mail.email_add_committer = recipients.empty? + mail.email_add_pusher = recipients.empty? mail.email_only_broken_builds = false mail.email_recipients = recipients.join(" ") mail.execute(build) diff --git a/app/views/projects/_form.html.haml b/app/views/projects/_form.html.haml index ca982f4..aac0ba1 100644 --- a/app/views/projects/_form.html.haml +++ b/app/views/projects/_form.html.haml @@ -17,12 +17,12 @@ .radio = label_tag do = f.radio_button :build_method, 'shell' - %strong Shell Jobs + %strong Shell Jobs (old style) .light Scripts you want CI to run on each push to repository .radio = label_tag do = f.radio_button :build_method, 'travis' - %strong Travis-CI + %strong Travis format .light Use .gitlab-ci.yml from project repository - if @project.can_git_fetch? diff --git a/lib/ansi2html.rb b/lib/ansi2html.rb index 7dac6b0..c20fc23 100644 --- a/lib/ansi2html.rb +++ b/lib/ansi2html.rb @@ -162,7 +162,7 @@ module Ansi2html close_open_tags() @n_lines += 1 if @line_fold - @out << %{<p onclick="javascript:Fold_Section('#{@line_fold}')">} + @out << %{<p onclick="javascript:FoldSection('#{@line_fold}')">} @line_fold = nil else @out << %{<p>} |