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
27442862
Commit
27442862
authored
Sep 07, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code based on feedback
parent
a2aa5058
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
22 additions
and
18 deletions
+22
-18
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+2
-2
app/models/project.rb
app/models/project.rb
+8
-4
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
+1
-1
lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb
...ort_export/after_export_strategies/web_upload_strategy.rb
+2
-2
lib/gitlab/import_export/saver.rb
lib/gitlab/import_export/saver.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
spec/support/import_export/export_file_helper.rb
spec/support/import_export/export_file_helper.rb
+1
-1
No files found.
app/controllers/projects_controller.rb
View file @
27442862
...
...
@@ -191,8 +191,8 @@ class ProjectsController < Projects::ApplicationController
end
def
download_export
if
@project
.
export_project_
object_
exists?
send_upload
(
@project
.
import_export_upload
.
export_file
)
if
@project
.
export_project_exists?
send_upload
(
@project
.
export_file
)
else
redirect_to
(
edit_project_path
(
@project
,
anchor:
'js-export-project'
),
...
...
app/models/project.rb
View file @
27442862
...
...
@@ -1738,7 +1738,7 @@ class Project < ActiveRecord::Base
:started
elsif
after_export_in_progress?
:after_export_action
elsif
export_project_
object_
exists?
elsif
export_project_exists?
:finished
else
:none
...
...
@@ -1754,14 +1754,18 @@ class Project < ActiveRecord::Base
end
def
remove_exports
return
unless
export_project_
object_
exists?
return
unless
export_project_exists?
import_export_upload
.
remove_export_file!
import_export_upload
.
save
end
def
export_project_object_exists?
import_export_upload
&
.
export_file
&
.
file
def
export_project_exists?
export_file
&
.
file
end
def
export_file
import_export_upload
&
.
export_file
end
def
full_path_slug
...
...
lib/api/project_export.rb
View file @
27442862
...
...
@@ -21,8 +21,8 @@ module API
detail
'This feature was introduced in GitLab 10.6.'
end
get
':id/export/download'
do
if
user_project
.
export_project_
object_
exists?
present_carrierwave_file!
(
user_
project
.
import_export_upload
.
export_file
)
if
user_project
.
export_project_exists?
present_carrierwave_file!
(
user_
project
.
export_file
)
else
render_api_error!
(
'404 Not found or has expired'
,
404
)
end
...
...
lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb
View file @
27442862
...
...
@@ -84,7 +84,7 @@ module Gitlab
end
def
object_storage?
project
.
export_project_
object_
exists?
project
.
export_project_exists?
end
end
end
...
...
lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb
View file @
27442862
...
...
@@ -44,7 +44,7 @@ module Gitlab
end
def
export_file
project
.
import_export_upload
.
export_file
.
open
project
.
export_file
.
open
end
def
send_file_options
...
...
@@ -59,7 +59,7 @@ module Gitlab
end
def
export_size
project
.
import_export_upload
.
export_file
.
file
.
size
project
.
export_file
.
file
.
size
end
end
end
...
...
lib/gitlab/import_export/saver.rb
View file @
27442862
...
...
@@ -18,7 +18,7 @@ module Gitlab
Rails
.
logger
.
info
(
"Saved project export
#{
archive_file
}
"
)
save_
on_object_storage
save_
upload
else
@shared
.
error
(
Gitlab
::
ImportExport
::
Error
.
new
(
error_message
))
false
...
...
@@ -49,7 +49,7 @@ module Gitlab
@archive_file
||=
File
.
join
(
@shared
.
archive_path
,
Gitlab
::
ImportExport
.
export_filename
(
project:
@project
))
end
def
save_
on_object_storage
def
save_
upload
upload
=
ImportExportUpload
.
find_or_initialize_by
(
project:
@project
)
File
.
open
(
archive_file
)
{
|
file
|
upload
.
export_file
=
file
}
...
...
lib/tasks/gitlab/update_templates.rake
View file @
27442862
...
...
@@ -54,7 +54,7 @@ namespace :gitlab do
end
Projects
::
ImportExport
::
ExportService
.
new
(
project
,
admin
).
execute
download_or_copy_upload
(
project
.
import_export_upload
.
export_file
,
template
.
archive_path
)
download_or_copy_upload
(
project
.
export_file
,
template
.
archive_path
)
Projects
::
DestroyService
.
new
(
admin
,
project
).
execute
puts
"Exported
#{
template
.
name
}
"
.
green
end
...
...
spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb
View file @
27442862
...
...
@@ -12,7 +12,7 @@ describe Gitlab::ImportExport::AfterExportStrategies::BaseAfterExportStrategy do
end
it
'returns if project exported file is not found'
do
allow
(
project
).
to
receive
(
:export_project_
object_
exists?
).
and_return
(
false
)
allow
(
project
).
to
receive
(
:export_project_exists?
).
and_return
(
false
)
expect
(
service
).
not_to
receive
(
:strategy_execute
)
...
...
spec/models/project_spec.rb
View file @
27442862
...
...
@@ -2859,7 +2859,7 @@ describe Project do
it
'removes the export'
do
project
.
remove_exports
expect
(
project
.
export_project_
object_
exists?
).
to
be_falsey
expect
(
project
.
export_project_exists?
).
to
be_falsey
end
end
...
...
spec/requests/api/project_export_spec.rb
View file @
27442862
...
...
@@ -189,7 +189,7 @@ describe API::ProjectExport do
end
it
'has removed the export'
do
expect
(
project_after_export
.
export_project_
object_
exists?
).
to
be_falsey
expect
(
project_after_export
.
export_project_exists?
).
to
be_falsey
end
it_behaves_like
'404 response'
do
...
...
spec/support/import_export/export_file_helper.rb
View file @
27442862
...
...
@@ -52,7 +52,7 @@ module ExportFileHelper
# Expands the compressed file for an exported project into +tmpdir+
def
in_directory_with_expanded_export
(
project
)
Dir
.
mktmpdir
do
|
tmpdir
|
export_file
=
project
.
import_export_upload
.
export_file
.
path
export_file
=
project
.
export_file
.
path
_output
,
exit_status
=
Gitlab
::
Popen
.
popen
(
%W{tar -zxf
#{
export_file
}
-C
#{
tmpdir
}
}
)
yield
(
exit_status
,
tmpdir
)
...
...
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