Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
27442862
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
27442862
编写于
9月 07, 2018
作者:
J
James Lopez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor code based on feedback
上级
a2aa5058
变更
11
显示空白变更内容
内联
并排
Showing
11 changed file
with
22 addition
and
18 deletion
+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
未找到文件。
app/controllers/projects_controller.rb
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
浏览文件 @
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
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录