diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-06 13:47:05 +0200 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-06 13:47:05 +0200 |
commit | 5cf56e56470e695b10db02dff70d0f0b50060518 (patch) | |
tree | d46ecd17857f8e49abda15c03576c099e2bf39df /app | |
parent | e3558ed67e7e829fe5148c3fb2fe80ed045fe1b4 (diff) | |
download | gitlab-ce-5cf56e56470e695b10db02dff70d0f0b50060518.tar.gz |
Rename almost all the things
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/admin/projects_controller.rb | 18 | ||||
-rw-r--r-- | app/mailers/repository_check_mailer.rb (renamed from app/mailers/repo_check_mailer.rb) | 2 | ||||
-rw-r--r-- | app/views/admin/logs/show.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/projects/index.html.haml | 12 | ||||
-rw-r--r-- | app/views/admin/projects/show.html.haml | 18 | ||||
-rw-r--r-- | app/views/repo_check_mailer/notify.text.haml | 3 | ||||
-rw-r--r-- | app/views/repository_check_mailer/notify.html.haml (renamed from app/views/repo_check_mailer/notify.html.haml) | 2 | ||||
-rw-r--r-- | app/views/repository_check_mailer/notify.text.haml | 3 | ||||
-rw-r--r-- | app/workers/admin_email_worker.rb | 6 | ||||
-rw-r--r-- | app/workers/repository_check_worker.rb (renamed from app/workers/repo_check_worker.rb) | 14 | ||||
-rw-r--r-- | app/workers/single_repository_check_worker.rb (renamed from app/workers/single_repo_check_worker.rb) | 8 |
11 files changed, 44 insertions, 44 deletions
diff --git a/app/controllers/admin/projects_controller.rb b/app/controllers/admin/projects_controller.rb index b8c276fb1bb..01257a68616 100644 --- a/app/controllers/admin/projects_controller.rb +++ b/app/controllers/admin/projects_controller.rb @@ -1,5 +1,5 @@ class Admin::ProjectsController < Admin::ApplicationController - before_action :project, only: [:show, :transfer, :repo_check] + before_action :project, only: [:show, :transfer, :repository_check] before_action :group, only: [:show, :transfer] def index @@ -8,7 +8,7 @@ class Admin::ProjectsController < Admin::ApplicationController @projects = @projects.where("visibility_level IN (?)", params[:visibility_levels]) if params[:visibility_levels].present? @projects = @projects.with_push if params[:with_push].present? @projects = @projects.abandoned if params[:abandoned].present? - @projects = @projects.where(last_repo_check_failed: true) if params[:last_repo_check_failed].present? + @projects = @projects.where(last_repository_check_failed: true) if params[:last_repository_check_failed].present? @projects = @projects.non_archived unless params[:with_archived].present? @projects = @projects.search(params[:name]) if params[:name].present? @projects = @projects.sort(@sort = params[:sort]) @@ -31,24 +31,24 @@ class Admin::ProjectsController < Admin::ApplicationController redirect_to admin_namespace_project_path(@project.namespace, @project) end - def repo_check - SingleRepoCheckWorker.perform_async(@project.id) + def repository_check + SingleRepositoryCheckWorker.perform_async(@project.id) redirect_to( admin_namespace_project_path(@project.namespace, @project), - notice: 'Repo check was triggered' + notice: 'Repository check was triggered' ) end - def clear_repo_check_states + def clear_repository_check_states Project.update_all( - last_repo_check_failed: false, - last_repo_check_at: nil + last_repository_check_failed: false, + last_repository_check_at: nil ) redirect_to( admin_namespaces_projects_path, - notice: 'All project repo check states were cleared' + notice: 'All project states were cleared' ) end diff --git a/app/mailers/repo_check_mailer.rb b/app/mailers/repository_check_mailer.rb index d98533f120d..994054c8769 100644 --- a/app/mailers/repo_check_mailer.rb +++ b/app/mailers/repository_check_mailer.rb @@ -1,4 +1,4 @@ -class RepoCheckMailer < BaseMailer +class RepositoryCheckMailer < BaseMailer include ActionView::Helpers::TextHelper def notify(failed_count) diff --git a/app/views/admin/logs/show.html.haml b/app/views/admin/logs/show.html.haml index abcc93f4046..4b475a4d8fa 100644 --- a/app/views/admin/logs/show.html.haml +++ b/app/views/admin/logs/show.html.haml @@ -1,7 +1,7 @@ - page_title "Logs" - loggers = [Gitlab::GitLogger, Gitlab::AppLogger, Gitlab::ProductionLogger, Gitlab::SidekiqLogger, - Gitlab::RepoCheckLogger] + Gitlab::RepositoryCheckLogger] %ul.nav-links.log-tabs - loggers.each do |klass| %li{ class: (klass == Gitlab::GitLogger ? 'active' : '') } diff --git a/app/views/admin/projects/index.html.haml b/app/views/admin/projects/index.html.haml index ed360f2f012..c2bf0659841 100644 --- a/app/views/admin/projects/index.html.haml +++ b/app/views/admin/projects/index.html.haml @@ -41,19 +41,19 @@ %fieldset %strong Problems .checkbox - = label_tag :last_repo_check_failed do - = check_box_tag :last_repo_check_failed, 1, params[:last_repo_check_failed] - %span Last repo check failed + = label_tag :last_repository_check_failed do + = check_box_tag :last_repository_check_failed, 1, params[:last_repository_check_failed] + %span Last repository check failed = hidden_field_tag :sort, params[:sort] = button_tag "Search", class: "btn submit btn-primary" = link_to "Reset", admin_namespaces_projects_path, class: "btn btn-cancel" - .panel.panel-default.repo-check-states + .panel.panel-default.repository-check-states .panel-heading - Repo check states + Repository check states .panel-body - = link_to 'Clear all', clear_repo_check_states_admin_namespace_projects_path(0), data: { confirm: 'This will clear repo check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove" + = link_to 'Clear all', clear_repository_check_states_admin_namespace_projects_path(0), data: { confirm: 'This will clear repository check states for ALL projects in the database. This cannot be undone. Are you sure?' }, method: :put, class: "btn btn-sm btn-remove" %section.col-md-9 .panel.panel-default .panel-heading diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml index a7a3f6349ef..5bef8e3ad57 100644 --- a/app/views/admin/projects/show.html.haml +++ b/app/views/admin/projects/show.html.haml @@ -5,12 +5,12 @@ %i.fa.fa-pencil-square-o Edit %hr -- if @project.last_repo_check_failed? +- if @project.last_repository_check_failed? .row .col-md-12 .panel .panel-heading.alert.alert-danger - Last repo check failed. See + Last repository check failed. See = link_to 'repocheck.log', admin_logs_path for error messages. .row @@ -103,19 +103,19 @@ .col-sm-offset-2.col-sm-10 = f.submit 'Transfer', class: 'btn btn-primary' - .panel.panel-default.repo-check + .panel.panel-default.repository-check .panel-heading - Repo check + Repository check .panel-body - = form_for @project, url: repo_check_admin_namespace_project_path(@project.namespace, @project), method: :post do |f| + = form_for @project, url: repository_check_admin_namespace_project_path(@project.namespace, @project), method: :post do |f| .form-group - - if @project.last_repo_check_at.nil? + - if @project.last_repository_check_at.nil? This repository has never been checked. - else This repository was last checked - = @project.last_repo_check_at.to_s(:medium) + '.' + = @project.last_repository_check_at.to_s(:medium) + '.' The check - - if @project.last_repo_check_failed? + - if @project.last_repository_check_failed? = succeed '.' do %strong.cred failed See @@ -125,7 +125,7 @@ passed. .form-group - = f.submit 'Trigger repo check', class: 'btn btn-primary' + = f.submit 'Trigger repository check', class: 'btn btn-primary' .col-md-6 - if @group diff --git a/app/views/repo_check_mailer/notify.text.haml b/app/views/repo_check_mailer/notify.text.haml deleted file mode 100644 index bdf8c2ad675..00000000000 --- a/app/views/repo_check_mailer/notify.text.haml +++ /dev/null @@ -1,3 +0,0 @@ -#{@message}. -\ -View details: #{admin_namespaces_projects_url(last_repo_check_failed: 1)} diff --git a/app/views/repo_check_mailer/notify.html.haml b/app/views/repository_check_mailer/notify.html.haml index ef0016f9d3e..df16f503570 100644 --- a/app/views/repo_check_mailer/notify.html.haml +++ b/app/views/repository_check_mailer/notify.html.haml @@ -2,4 +2,4 @@ #{@message}. %p - = link_to "See the affected projects in the GitLab admin panel", admin_namespaces_projects_url(last_repo_check_failed: 1) + = link_to "See the affected projects in the GitLab admin panel", admin_namespaces_projects_url(last_repository_check_failed: 1) diff --git a/app/views/repository_check_mailer/notify.text.haml b/app/views/repository_check_mailer/notify.text.haml new file mode 100644 index 00000000000..02f3f80288a --- /dev/null +++ b/app/views/repository_check_mailer/notify.text.haml @@ -0,0 +1,3 @@ +#{@message}. +\ +View details: #{admin_namespaces_projects_url(last_repository_check_failed: 1)} diff --git a/app/workers/admin_email_worker.rb b/app/workers/admin_email_worker.rb index fcccb9ea669..667fff031dd 100644 --- a/app/workers/admin_email_worker.rb +++ b/app/workers/admin_email_worker.rb @@ -4,9 +4,9 @@ class AdminEmailWorker sidekiq_options retry: false # this job auto-repeats via sidekiq-cron def perform - repo_check_failed_count = Project.where(last_repo_check_failed: true).count - return if repo_check_failed_count.zero? + repository_check_failed_count = Project.where(last_repository_check_failed: true).count + return if repository_check_failed_count.zero? - RepoCheckMailer.notify(repo_check_failed_count).deliver_now + RepositoryCheckMailer.notify(repository_check_failed_count).deliver_now end end diff --git a/app/workers/repo_check_worker.rb b/app/workers/repository_check_worker.rb index 9be795309e0..2d75c8bafde 100644 --- a/app/workers/repo_check_worker.rb +++ b/app/workers/repository_check_worker.rb @@ -1,4 +1,4 @@ -class RepoCheckWorker +class RepositoryCheckWorker include Sidekiq::Worker RUN_TIME = 3600 @@ -11,14 +11,14 @@ class RepoCheckWorker # This loop will break after a little more than one hour ('a little # more' because `git fsck` may take a few minutes), or if it runs out of # projects to check. By default sidekiq-cron will start a new - # RepoCheckWorker each hour so that as long as there are repositories to + # RepositoryCheckWorker each hour so that as long as there are repositories to # check, only one (or two) will be checked at a time. project_ids.each do |project_id| break if Time.now - start >= RUN_TIME next if !try_obtain_lease(project_id) - SingleRepoCheckWorker.new.perform(project_id) + SingleRepositoryCheckWorker.new.perform(project_id) end end @@ -29,16 +29,16 @@ class RepoCheckWorker # an array of IDs instead. def project_ids limit = 10_000 - never_checked_projects = Project.where('last_repo_check_at IS NULL').limit(limit). + never_checked_projects = Project.where('last_repository_check_at IS NULL').limit(limit). pluck(:id) - old_check_projects = Project.where('last_repo_check_at < ?', 1.week.ago). - reorder('last_repo_check_at ASC').limit(limit).pluck(:id) + old_check_projects = Project.where('last_repository_check_at < ?', 1.week.ago). + reorder('last_repository_check_at ASC').limit(limit).pluck(:id) never_checked_projects + old_check_projects end def try_obtain_lease(id) lease = Gitlab::ExclusiveLease.new( - "project_repo_check:#{id}", + "project_repository_check:#{id}", timeout: RUN_TIME ) lease.try_obtain diff --git a/app/workers/single_repo_check_worker.rb b/app/workers/single_repository_check_worker.rb index f8b245247c5..d9eed9bd708 100644 --- a/app/workers/single_repo_check_worker.rb +++ b/app/workers/single_repository_check_worker.rb @@ -1,4 +1,4 @@ -class SingleRepoCheckWorker +class SingleRepositoryCheckWorker include Sidekiq::Worker sidekiq_options retry: false @@ -21,14 +21,14 @@ class SingleRepoCheckWorker output, status = Gitlab::Popen.popen(cmd) return true if status.zero? - Gitlab::RepoCheckLogger.error("command failed: #{cmd.join(' ')}\n#{output}") + Gitlab::RepositoryCheckLogger.error("command failed: #{cmd.join(' ')}\n#{output}") false end def update(project, success:) project.update_columns( - last_repo_check_failed: !success, - last_repo_check_at: Time.now, + last_repository_check_failed: !success, + last_repository_check_at: Time.now, ) end end |