Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f1277fbf
Commit
f1277fbf
authored
Sep 07, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code based on feedback
parent
27442862
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
15 deletions
+15
-15
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/models/project.rb
app/models/project.rb
+3
-3
lib/api/project_export.rb
lib/api/project_export.rb
+2
-2
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
...ort/after_export_strategies/base_after_export_strategy.rb
+3
-3
lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb
...ort_export/after_export_strategies/web_upload_strategy.rb
+2
-2
lib/tasks/gitlab/update_templates.rake
lib/tasks/gitlab/update_templates.rake
+1
-1
spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb
...fter_export_strategies/base_after_export_strategy_spec.rb
+1
-1
spec/models/project_spec.rb
spec/models/project_spec.rb
+1
-1
spec/requests/api/project_export_spec.rb
spec/requests/api/project_export_spec.rb
+1
-1
No files found.
app/controllers/projects_controller.rb
View file @
f1277fbf
...
@@ -191,7 +191,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -191,7 +191,7 @@ class ProjectsController < Projects::ApplicationController
end
end
def
download_export
def
download_export
if
@project
.
export_
project
_exists?
if
@project
.
export_
file
_exists?
send_upload
(
@project
.
export_file
)
send_upload
(
@project
.
export_file
)
else
else
redirect_to
(
redirect_to
(
...
...
app/models/project.rb
View file @
f1277fbf
...
@@ -1738,7 +1738,7 @@ class Project < ActiveRecord::Base
...
@@ -1738,7 +1738,7 @@ class Project < ActiveRecord::Base
:started
:started
elsif
after_export_in_progress?
elsif
after_export_in_progress?
:after_export_action
:after_export_action
elsif
export_
project
_exists?
elsif
export_
file
_exists?
:finished
:finished
else
else
:none
:none
...
@@ -1754,13 +1754,13 @@ class Project < ActiveRecord::Base
...
@@ -1754,13 +1754,13 @@ class Project < ActiveRecord::Base
end
end
def
remove_exports
def
remove_exports
return
unless
export_
project
_exists?
return
unless
export_
file
_exists?
import_export_upload
.
remove_export_file!
import_export_upload
.
remove_export_file!
import_export_upload
.
save
import_export_upload
.
save
end
end
def
export_
project
_exists?
def
export_
file
_exists?
export_file
&
.
file
export_file
&
.
file
end
end
...
...
lib/api/project_export.rb
View file @
f1277fbf
...
@@ -21,8 +21,8 @@ module API
...
@@ -21,8 +21,8 @@ module API
detail
'This feature was introduced in GitLab 10.6.'
detail
'This feature was introduced in GitLab 10.6.'
end
end
get
':id/export/download'
do
get
':id/export/download'
do
if
user_project
.
export_
project
_exists?
if
user_project
.
export_
file
_exists?
present_carrierwave_file!
(
user_
project
.
export_file
)
present_carrierwave_file!
(
user_project
.
export_file
)
else
else
render_api_error!
(
'404 Not found or has expired'
,
404
)
render_api_error!
(
'404 Not found or has expired'
,
404
)
end
end
...
...
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
View file @
f1277fbf
...
@@ -53,7 +53,7 @@ module Gitlab
...
@@ -53,7 +53,7 @@ module Gitlab
end
end
def
self
.
lock_file_path
(
project
)
def
self
.
lock_file_path
(
project
)
return
unless
project
.
export_path
||
object_storage
?
return
unless
project
.
export_path
||
export_file_exists
?
lock_path
=
project
.
import_export_shared
.
archive_path
lock_path
=
project
.
import_export_shared
.
archive_path
...
@@ -83,8 +83,8 @@ module Gitlab
...
@@ -83,8 +83,8 @@ module Gitlab
errors
.
full_messages
.
each
{
|
msg
|
project
.
import_export_shared
.
add_error_message
(
msg
)
}
errors
.
full_messages
.
each
{
|
msg
|
project
.
import_export_shared
.
add_error_message
(
msg
)
}
end
end
def
object_storage
?
def
export_file_exists
?
project
.
export_
project
_exists?
project
.
export_
file
_exists?
end
end
end
end
end
end
...
...
lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb
View file @
f1277fbf
lib/tasks/gitlab/update_templates.rake
View file @
f1277fbf
...
@@ -54,7 +54,7 @@ namespace :gitlab do
...
@@ -54,7 +54,7 @@ namespace :gitlab do
end
end
Projects
::
ImportExport
::
ExportService
.
new
(
project
,
admin
).
execute
Projects
::
ImportExport
::
ExportService
.
new
(
project
,
admin
).
execute
download_or_copy_upload
(
project
.
export_file
,
template
.
archive_path
)
download_or_copy_upload
(
project
.
export_file
,
template
.
archive_path
)
Projects
::
DestroyService
.
new
(
admin
,
project
).
execute
Projects
::
DestroyService
.
new
(
admin
,
project
).
execute
puts
"Exported
#{
template
.
name
}
"
.
green
puts
"Exported
#{
template
.
name
}
"
.
green
end
end
...
...
spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb
View file @
f1277fbf
...
@@ -12,7 +12,7 @@ describe Gitlab::ImportExport::AfterExportStrategies::BaseAfterExportStrategy do
...
@@ -12,7 +12,7 @@ describe Gitlab::ImportExport::AfterExportStrategies::BaseAfterExportStrategy do
end
end
it
'returns if project exported file is not found'
do
it
'returns if project exported file is not found'
do
allow
(
project
).
to
receive
(
:export_
project
_exists?
).
and_return
(
false
)
allow
(
project
).
to
receive
(
:export_
file
_exists?
).
and_return
(
false
)
expect
(
service
).
not_to
receive
(
:strategy_execute
)
expect
(
service
).
not_to
receive
(
:strategy_execute
)
...
...
spec/models/project_spec.rb
View file @
f1277fbf
...
@@ -2859,7 +2859,7 @@ describe Project do
...
@@ -2859,7 +2859,7 @@ describe Project do
it
'removes the export'
do
it
'removes the export'
do
project
.
remove_exports
project
.
remove_exports
expect
(
project
.
export_
project
_exists?
).
to
be_falsey
expect
(
project
.
export_
file
_exists?
).
to
be_falsey
end
end
end
end
...
...
spec/requests/api/project_export_spec.rb
View file @
f1277fbf
...
@@ -189,7 +189,7 @@ describe API::ProjectExport do
...
@@ -189,7 +189,7 @@ describe API::ProjectExport do
end
end
it
'has removed the export'
do
it
'has removed the export'
do
expect
(
project_after_export
.
export_
project
_exists?
).
to
be_falsey
expect
(
project_after_export
.
export_
file
_exists?
).
to
be_falsey
end
end
it_behaves_like
'404 response'
do
it_behaves_like
'404 response'
do
...
...
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