diff --git a/app/models/project.rb b/app/models/project.rb index b13b2918652c0ad15af22921d97c0768d7967bb7..23eb7f901944f7269fb696bb1c7965590fd3fd31 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -23,7 +23,7 @@ require "grit" class Project < ActiveRecord::Base - include Gitolited + include Gitlab::ShellAdapter extend Enumerize class TransferError < StandardError; end diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 57229d507594cd1fa95d95479df6cfca2d57e662..16379720e59bb04e89237b3431e24812d05bc56f 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -10,7 +10,7 @@ # class ProtectedBranch < ActiveRecord::Base - include Gitolited + include Gitlab::ShellAdapter attr_accessible :name diff --git a/app/models/users_project.rb b/app/models/users_project.rb index 486aaa6966a4ded3168c4d6c8953064f4d10416c..8051c0604d9cf572b0c521b1a5941125af17c976 100644 --- a/app/models/users_project.rb +++ b/app/models/users_project.rb @@ -11,7 +11,7 @@ # class UsersProject < ActiveRecord::Base - include Gitolited + include Gitlab::ShellAdapter GUEST = 10 REPORTER = 20 diff --git a/app/observers/key_observer.rb b/app/observers/key_observer.rb index 9d02cbc16f7ffa0ccfa8c83ed8ac8e826150f82d..0bc71a663e8bbc7850dbcb2011b778e892f2cc47 100644 --- a/app/observers/key_observer.rb +++ b/app/observers/key_observer.rb @@ -1,5 +1,5 @@ class KeyObserver < ActiveRecord::Observer - include Gitolited + include Gitlab::ShellAdapter def after_save(key) GitlabShellWorker.perform_async( diff --git a/app/services/project_transfer_service.rb b/app/services/project_transfer_service.rb index 2ff1aa919dfd5878b518fb30a70a6e294357d395..719e0d3db23d4fd059e5c67bfa3f9082d88da6ca 100644 --- a/app/services/project_transfer_service.rb +++ b/app/services/project_transfer_service.rb @@ -3,7 +3,7 @@ # Used for transfer project to another namespace # class ProjectTransferService - include Gitolited + include Gitlab::ShellAdapter attr_accessor :project diff --git a/app/workers/gitlab_shell_worker.rb b/app/workers/gitlab_shell_worker.rb index 0a921b1bd449adf198990095c86a59859f11b925..cfeda88bbc5c6ceaef5d19215cf32b1dc77aa131 100644 --- a/app/workers/gitlab_shell_worker.rb +++ b/app/workers/gitlab_shell_worker.rb @@ -1,6 +1,6 @@ class GitlabShellWorker include Sidekiq::Worker - include Gitolited + include Gitlab::ShellAdapter sidekiq_options queue: :gitlab_shell diff --git a/config/initializers/5_backend.rb b/config/initializers/5_backend.rb index 73436608c933aa0b82558f4d2c69d01513571740..7c2e7f3900053c1b1b9b893faa0f1dc9c2c244ba 100644 --- a/config/initializers/5_backend.rb +++ b/config/initializers/5_backend.rb @@ -3,3 +3,6 @@ require Rails.root.join("lib", "gitlab", "backend", "grack_auth") # GIT over SSH require Rails.root.join("lib", "gitlab", "backend", "shell") + +# GitLab shell adapter +require Rails.root.join("lib", "gitlab", "backend", "shell_adapter") diff --git a/lib/gitlab/backend/shell_adapter.rb b/lib/gitlab/backend/shell_adapter.rb new file mode 100644 index 0000000000000000000000000000000000000000..f247f4593d7ffc8f1e2211245033b75a24d5fa16 --- /dev/null +++ b/lib/gitlab/backend/shell_adapter.rb @@ -0,0 +1,12 @@ +# == GitLab Shell mixin +# +# Provide a shortcut to Gitlab::Shell instance by gitlab_shell +# +module Gitlab + module ShellAdapter + def gitlab_shell + Gitlab::Shell.new + end + end +end + diff --git a/lib/gitolited.rb b/lib/gitolited.rb deleted file mode 100644 index a7fc414810632c1f8e8055a4f0738c5e5c55fca8..0000000000000000000000000000000000000000 --- a/lib/gitolited.rb +++ /dev/null @@ -1,11 +0,0 @@ -# == Gitolited mixin -# -# Provide a shortcut to Gitlab::Shell instance by gitlab_shell -# -# Used by Project, UsersProject, etc -# -module Gitolited - def gitlab_shell - Gitlab::Shell.new - end -end