Class: Gitlab::ManifestImport::ProjectCreator
- Inherits:
-
Object
- Object
- Gitlab::ManifestImport::ProjectCreator
- Defined in:
- lib/gitlab/manifest_import/project_creator.rb
Instance Attribute Summary collapse
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(repository, destination, current_user) ⇒ ProjectCreator
constructor
A new instance of ProjectCreator.
Constructor Details
#initialize(repository, destination, current_user) ⇒ ProjectCreator
Returns a new instance of ProjectCreator.
8 9 10 11 12 |
# File 'lib/gitlab/manifest_import/project_creator.rb', line 8 def initialize(repository, destination, current_user) @repository = repository @destination = destination @current_user = current_user end |
Instance Attribute Details
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
6 7 8 |
# File 'lib/gitlab/manifest_import/project_creator.rb', line 6 def current_user @current_user end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
6 7 8 |
# File 'lib/gitlab/manifest_import/project_creator.rb', line 6 def destination @destination end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
6 7 8 |
# File 'lib/gitlab/manifest_import/project_creator.rb', line 6 def repository @repository end |
Instance Method Details
#execute ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/gitlab/manifest_import/project_creator.rb', line 14 def execute group_full_path, _, project_path = repository[:path].rpartition('/') group_full_path = File.join(destination.full_path, group_full_path) if destination group = create_group_with_parents(group_full_path) params = { import_url: repository[:url], import_source: repository[:url], import_type: 'manifest', namespace_id: group.id, path: project_path, name: project_path, visibility_level: destination.visibility_level } Projects::CreateService.new(current_user, params).execute end |