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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
0d8aadeb
Commit
0d8aadeb
authored
Feb 27, 2018
by
Travis Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eliminate need or opts argument in shared object
parent
737b7e3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
11 deletions
+8
-11
lib/gitlab/import_export/shared.rb
lib/gitlab/import_export/shared.rb
+3
-8
spec/lib/gitlab/import_export/file_importer_spec.rb
spec/lib/gitlab/import_export/file_importer_spec.rb
+2
-1
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+1
-1
spec/lib/gitlab/import_export/version_checker_spec.rb
spec/lib/gitlab/import_export/version_checker_spec.rb
+2
-1
No files found.
lib/gitlab/import_export/shared.rb
View file @
0d8aadeb
module
Gitlab
module
Gitlab
module
ImportExport
module
ImportExport
class
Shared
class
Shared
attr_reader
:errors
,
:project
,
:opts
attr_reader
:errors
,
:project
def
initialize
(
project
,
opts
=
{}
)
def
initialize
(
project
)
@project
=
project
@project
=
project
@opts
=
opts
@errors
=
[]
@errors
=
[]
end
end
...
@@ -40,11 +39,7 @@ module Gitlab
...
@@ -40,11 +39,7 @@ module Gitlab
end
end
def
relative_archive_path
def
relative_archive_path
if
@opts
[
:relative_path
]
@project
.
disk_path
@opts
[
:relative_path
]
else
@project
.
disk_path
end
end
end
def
error_out
(
message
,
caller
)
def
error_out
(
message
,
caller
)
...
...
spec/lib/gitlab/import_export/file_importer_spec.rb
View file @
0d8aadeb
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
FileImporter
do
describe
Gitlab
::
ImportExport
::
FileImporter
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
,
relative_path:
'test'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/file_importer_spec"
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/file_importer_spec"
}
let
(
:valid_file
)
{
"
#{
shared
.
export_path
}
/valid.json"
}
let
(
:valid_file
)
{
"
#{
shared
.
export_path
}
/valid.json"
}
let
(
:symlink_file
)
{
"
#{
shared
.
export_path
}
/invalid.json"
}
let
(
:symlink_file
)
{
"
#{
shared
.
export_path
}
/invalid.json"
}
...
@@ -12,6 +12,7 @@ describe Gitlab::ImportExport::FileImporter do
...
@@ -12,6 +12,7 @@ describe Gitlab::ImportExport::FileImporter do
stub_const
(
'Gitlab::ImportExport::FileImporter::MAX_RETRIES'
,
0
)
stub_const
(
'Gitlab::ImportExport::FileImporter::MAX_RETRIES'
,
0
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
allow_any_instance_of
(
Gitlab
::
ImportExport
::
CommandLineUtil
).
to
receive
(
:untar_zxf
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
ImportExport
::
CommandLineUtil
).
to
receive
(
:untar_zxf
).
and_return
(
true
)
allow_any_instance_of
(
Gitlab
::
ImportExport
::
Shared
).
to
receive
(
:relative_archive_path
).
and_return
(
'test'
)
allow
(
SecureRandom
).
to
receive
(
:hex
).
and_return
(
'abcd'
)
allow
(
SecureRandom
).
to
receive
(
:hex
).
and_return
(
'abcd'
)
setup_files
setup_files
end
end
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
0d8aadeb
...
@@ -259,7 +259,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
...
@@ -259,7 +259,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
context
'Light JSON'
do
context
'Light JSON'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
""
,
project_path:
'path'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let!
(
:project
)
{
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
}
let!
(
:project
)
{
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
}
let
(
:project_tree_restorer
)
{
described_class
.
new
(
user:
user
,
shared:
shared
,
project:
project
)
}
let
(
:project_tree_restorer
)
{
described_class
.
new
(
user:
user
,
shared:
shared
,
project:
project
)
}
let
(
:restored_project_json
)
{
project_tree_restorer
.
restore
}
let
(
:restored_project_json
)
{
project_tree_restorer
.
restore
}
...
...
spec/lib/gitlab/import_export/version_checker_spec.rb
View file @
0d8aadeb
...
@@ -2,12 +2,13 @@ require 'spec_helper'
...
@@ -2,12 +2,13 @@ require 'spec_helper'
include
ImportExport
::
CommonUtil
include
ImportExport
::
CommonUtil
describe
Gitlab
::
ImportExport
::
VersionChecker
do
describe
Gitlab
::
ImportExport
::
VersionChecker
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
,
relative_path:
''
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
)
}
describe
'bundle a project Git repo'
do
describe
'bundle a project Git repo'
do
let
(
:version
)
{
Gitlab
::
ImportExport
.
version
}
let
(
:version
)
{
Gitlab
::
ImportExport
.
version
}
before
do
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
::
Shared
).
to
receive
(
:relative_archive_path
).
and_return
(
''
)
allow
(
File
).
to
receive
(
:open
).
and_return
(
version
)
allow
(
File
).
to
receive
(
:open
).
and_return
(
version
)
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