Class: Gitlab::BareRepositoryImport::Repository
- Inherits:
-
Object
- Object
- Gitlab::BareRepositoryImport::Repository
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/bare_repository_import/repository.rb
Instance Attribute Summary collapse
-
#group_path ⇒ Object
readonly
Returns the value of attribute group_path.
-
#project_name ⇒ Object
readonly
Returns the value of attribute project_name.
-
#repo_path ⇒ Object
readonly
Returns the value of attribute repo_path.
Instance Method Summary collapse
-
#initialize(root_path, repo_path) ⇒ Repository
constructor
A new instance of Repository.
- #processable? ⇒ Boolean
- #project_full_path ⇒ Object
- #wiki_exists? ⇒ Boolean
- #wiki_path ⇒ Object
Methods included from Utils::StrongMemoize
#clear_memoization, #strong_memoize, #strong_memoized?
Constructor Details
#initialize(root_path, repo_path) ⇒ Repository
Returns a new instance of Repository.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 10 def initialize(root_path, repo_path) unless root_path.ends_with?('/') root_path = "#{root_path}/" end @root_path = root_path @repo_path = repo_path full_path = if hashed? && !wiki? repository.config.get('gitlab.fullpath') else repo_relative_path end # Split path into 'all/the/namespaces' and 'project_name' @group_path, _, @project_name = full_path.to_s.rpartition('/') end |
Instance Attribute Details
#group_path ⇒ Object (readonly)
Returns the value of attribute group_path
8 9 10 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 8 def group_path @group_path end |
#project_name ⇒ Object (readonly)
Returns the value of attribute project_name
8 9 10 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 8 def project_name @project_name end |
#repo_path ⇒ Object (readonly)
Returns the value of attribute repo_path
8 9 10 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 8 def repo_path @repo_path end |
Instance Method Details
#processable? ⇒ Boolean
41 42 43 44 45 46 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 41 def processable? return false if wiki? return false if hashed? && (group_path.blank? || project_name.blank?) true end |
#project_full_path ⇒ Object
37 38 39 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 37 def project_full_path @project_full_path ||= "#{group_path}/#{project_name}" end |
#wiki_exists? ⇒ Boolean
29 30 31 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 29 def wiki_exists? File.exist?(wiki_path) end |
#wiki_path ⇒ Object
33 34 35 |
# File 'lib/gitlab/bare_repository_import/repository.rb', line 33 def wiki_path @wiki_path ||= repo_path.sub(/\.git$/, '.wiki.git') end |