Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
cac7a9531110
Commit
d91dd2f5
authored
Jan 23, 2017
by
Oswaldo Ferreira
Browse files
Extract set_project_name_from_path method
parent
09e3c938553a
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/services/projects/create_service.rb
View file @
cac7a953
...
...
@@ -22,17 +22,7 @@ def execute
return
@project
end
# Set project name from path
if
@project
.
name
.
present?
&&
@project
.
path
.
present?
# if both name and path set - everything is ok
elsif
@project
.
path
.
present?
# Set project name from path
@project
.
name
=
@project
.
path
.
dup
elsif
@project
.
name
.
present?
# For compatibility - set path from name
# TODO: remove this in 8.0
@project
.
path
=
@project
.
name
.
dup
.
parameterize
end
set_project_name_from_path
# get namespace id
namespace_id
=
params
[
:namespace_id
]
...
...
@@ -144,5 +134,19 @@ def create_services_from_active_templates(project)
service
.
save!
end
end
def
set_project_name_from_path
# Set project name from path
if
@project
.
name
.
present?
&&
@project
.
path
.
present?
# if both name and path set - everything is ok
elsif
@project
.
path
.
present?
# Set project name from path
@project
.
name
=
@project
.
path
.
dup
elsif
@project
.
name
.
present?
# For compatibility - set path from name
# TODO: remove this in 8.0
@project
.
path
=
@project
.
name
.
dup
.
parameterize
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment