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
26cc4719
Commit
26cc4719
authored
Sep 07, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor code based on feedback
parent
295a6129
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
16 additions
and
16 deletions
+16
-16
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
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 @
26cc4719
...
...
@@ -193,7 +193,7 @@ class ProjectsController < Projects::ApplicationController
end
def
download_export
if
@project
.
export_
project
_exists?
if
@project
.
export_
file
_exists?
send_upload
(
@project
.
export_file
)
else
redirect_to
(
...
...
app/models/project.rb
View file @
26cc4719
...
...
@@ -1756,7 +1756,7 @@ class Project < ActiveRecord::Base
:started
elsif
after_export_in_progress?
:after_export_action
elsif
export_
project
_exists?
elsif
export_
file
_exists?
:finished
else
:none
...
...
@@ -1772,13 +1772,13 @@ class Project < ActiveRecord::Base
end
def
remove_exports
return
unless
export_
project
_exists?
return
unless
export_
file
_exists?
import_export_upload
.
remove_export_file!
import_export_upload
.
save
end
def
export_
project
_exists?
def
export_
file
_exists?
export_file
&
.
file
end
...
...
lib/api/project_export.rb
View file @
26cc4719
...
...
@@ -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
_exists?
present_carrierwave_file!
(
user_
project
.
export_file
)
if
user_project
.
export_
file
_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 @
26cc4719
...
...
@@ -53,7 +53,7 @@ module Gitlab
end
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
...
...
@@ -83,8 +83,8 @@ module Gitlab
errors
.
full_messages
.
each
{
|
msg
|
project
.
import_export_shared
.
add_error_message
(
msg
)
}
end
def
object_storage
?
project
.
export_
project
_exists?
def
export_file_exists
?
project
.
export_
file
_exists?
end
end
end
...
...
lib/gitlab/import_export/after_export_strategies/web_upload_strategy.rb
View file @
26cc4719
...
...
@@ -44,7 +44,7 @@ module Gitlab
end
def
export_file
project
.
export_file
.
open
project
.
export_file
.
open
end
def
send_file_options
...
...
@@ -59,7 +59,7 @@ module Gitlab
end
def
export_size
project
.
export_file
.
file
.
size
project
.
export_file
.
file
.
size
end
end
end
...
...
lib/tasks/gitlab/update_templates.rake
View file @
26cc4719
...
...
@@ -54,7 +54,7 @@ namespace :gitlab do
end
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
puts
"Exported
#{
template
.
name
}
"
.
green
end
...
...
spec/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy_spec.rb
View file @
26cc4719
...
...
@@ -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
_exists?
).
and_return
(
false
)
allow
(
project
).
to
receive
(
:export_
file
_exists?
).
and_return
(
false
)
expect
(
service
).
not_to
receive
(
:strategy_execute
)
...
...
spec/models/project_spec.rb
View file @
26cc4719
...
...
@@ -3151,7 +3151,7 @@ describe Project do
it
'removes the export'
do
project
.
remove_exports
expect
(
project
.
export_
project
_exists?
).
to
be_falsey
expect
(
project
.
export_
file
_exists?
).
to
be_falsey
end
end
...
...
spec/requests/api/project_export_spec.rb
View file @
26cc4719
...
...
@@ -189,7 +189,7 @@ describe API::ProjectExport do
end
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
it_behaves_like
'404 response'
do
...
...
spec/support/import_export/export_file_helper.rb
View file @
26cc4719
...
...
@@ -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
.
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