diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-24 15:17:13 +0100 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-03-24 15:17:13 +0100 |
commit | 3b1543cd15fcc52c2f5f3b7f4ccf391334fb6028 (patch) | |
tree | 486970c4cff0fc7aa698e7585071924e11ddba10 | |
parent | d21b3a0211061a2fed5949e92320f100ab3df05b (diff) | |
download | gitlab-ce-3b1543cd15fcc52c2f5f3b7f4ccf391334fb6028.tar.gz |
Detect build setup state based on gitlab_ci.yml presense
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
-rw-r--r-- | app/models/repository.rb | 4 | ||||
-rw-r--r-- | app/views/projects/_builds_settings.html.haml | 2 | ||||
-rw-r--r-- | app/views/projects/builds/index.html.haml | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index 13154eb4205..f874017a8f2 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -467,6 +467,10 @@ class Repository end end + def gitlab_ci_yml + @gitlab_ci_yml ||= blob_at(head_commit.sha, '.gitlab-ci.yml') unless empty? + end + def head_commit @head_commit ||= commit(self.root_ref) end diff --git a/app/views/projects/_builds_settings.html.haml b/app/views/projects/_builds_settings.html.haml index f1edc800bbf..095e7e45df7 100644 --- a/app/views/projects/_builds_settings.html.haml +++ b/app/views/projects/_builds_settings.html.haml @@ -2,7 +2,7 @@ %legend Builds: - - unless @project.builds.any? + - unless @repository.gitlab_ci_yml .form-group .col-sm-offset-2.col-sm-10 %p Before you can use Builds (Continuous Integration) feature you need to setup it. diff --git a/app/views/projects/builds/index.html.haml b/app/views/projects/builds/index.html.haml index d21716e4887..aa85f495e39 100644 --- a/app/views/projects/builds/index.html.haml +++ b/app/views/projects/builds/index.html.haml @@ -27,7 +27,7 @@ = link_to 'Cancel running', cancel_all_namespace_project_builds_path(@project.namespace, @project), data: { confirm: 'Are you sure?' }, class: 'btn btn-danger', method: :post - - unless @project.builds.any? + - unless @repository.gitlab_ci_yml = link_to 'Get started with Builds', help_page_path('ci/quick_start', 'README'), class: 'btn btn-info' = link_to ci_lint_path, class: 'btn btn-default' do |