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
737b7e3e
Commit
737b7e3e
authored
Feb 24, 2018
by
Travis Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
review: normalize shared initizlier arguments
parent
b1e32376
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
20 additions
and
19 deletions
+20
-19
lib/gitlab/import_export/shared.rb
lib/gitlab/import_export/shared.rb
+6
-5
spec/lib/gitlab/import_export/avatar_restorer_spec.rb
spec/lib/gitlab/import_export/avatar_restorer_spec.rb
+1
-1
spec/lib/gitlab/import_export/avatar_saver_spec.rb
spec/lib/gitlab/import_export/avatar_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/file_importer_spec.rb
spec/lib/gitlab/import_export/file_importer_spec.rb
+1
-1
spec/lib/gitlab/import_export/fork_spec.rb
spec/lib/gitlab/import_export/fork_spec.rb
+1
-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/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/reader_spec.rb
spec/lib/gitlab/import_export/reader_spec.rb
+1
-1
spec/lib/gitlab/import_export/repo_restorer_spec.rb
spec/lib/gitlab/import_export/repo_restorer_spec.rb
+1
-1
spec/lib/gitlab/import_export/repo_saver_spec.rb
spec/lib/gitlab/import_export/repo_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/uploads_restorer_spec.rb
spec/lib/gitlab/import_export/uploads_restorer_spec.rb
+1
-1
spec/lib/gitlab/import_export/uploads_saver_spec.rb
spec/lib/gitlab/import_export/uploads_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/version_checker_spec.rb
spec/lib/gitlab/import_export/version_checker_spec.rb
+1
-1
spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb
spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb
+1
-1
spec/lib/gitlab/import_export/wiki_restorer_spec.rb
spec/lib/gitlab/import_export/wiki_restorer_spec.rb
+1
-1
No files found.
lib/gitlab/import_export/shared.rb
View file @
737b7e3e
module
Gitlab
module
ImportExport
class
Shared
attr_reader
:errors
,
:project
attr_reader
:errors
,
:project
,
:opts
def
initialize
(
project
)
def
initialize
(
project
,
opts
=
{}
)
@project
=
project
@opts
=
opts
@errors
=
[]
end
...
...
@@ -39,10 +40,10 @@ module Gitlab
end
def
relative_archive_path
if
@
project
.
is_a?
(
Project
)
@
project
.
disk_path
if
@
opts
[
:relative_path
]
@
opts
[
:relative_path
]
else
@project
[
:relative_path
]
@project
.
disk_path
end
end
...
...
spec/lib/gitlab/import_export/avatar_restorer_spec.rb
View file @
737b7e3e
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
AvatarRestorer
do
include
UploadHelpers
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
'test'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:project
)
{
create
(
:project
)
}
before
do
...
...
spec/lib/gitlab/import_export/avatar_saver_spec.rb
View file @
737b7e3e
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
AvatarSaver
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
'test'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:project_with_avatar
)
{
create
(
:project
,
avatar:
fixture_file_upload
(
Rails
.
root
+
"spec/fixtures/dk.png"
,
"image/png"
))
}
let
(
:project
)
{
create
(
:project
)
}
...
...
spec/lib/gitlab/import_export/file_importer_spec.rb
View file @
737b7e3e
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
FileImporter
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
'test'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
,
relative_path:
'test'
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/file_importer_spec"
}
let
(
:valid_file
)
{
"
#{
shared
.
export_path
}
/valid.json"
}
let
(
:symlink_file
)
{
"
#{
shared
.
export_path
}
/invalid.json"
}
...
...
spec/lib/gitlab/import_export/fork_spec.rb
View file @
737b7e3e
...
...
@@ -7,7 +7,7 @@ describe 'forked project import' do
let!
(
:project_with_repo
)
{
create
(
:project
,
:repository
,
name:
'test-repo-restorer'
,
path:
'test-repo-restorer'
)
}
let!
(
:project
)
{
create
(
:project
,
name:
'test-repo-restorer-no-repo'
,
path:
'test-repo-restorer-no-repo'
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:forked_from_project
)
{
create
(
:project
,
:repository
)
}
let
(
:forked_project
)
{
fork_project
(
project_with_repo
,
nil
,
repository:
true
)
}
let
(
:repo_saver
)
{
Gitlab
::
ImportExport
::
RepoSaver
.
new
(
project:
project_with_repo
,
shared:
shared
)
}
...
...
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
View file @
737b7e3e
...
...
@@ -7,7 +7,7 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
@user
=
create
(
:user
)
RSpec
::
Mocks
.
with_temporary_scope
do
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
""
,
project_path:
'path'
)
@shared
=
Gitlab
::
ImportExport
::
Shared
.
new
(
@project
)
allow
(
@shared
).
to
receive
(
:export_path
).
and_return
(
'spec/lib/gitlab/import_export/'
)
@project
=
create
(
:project
,
:builds_disabled
,
:issues_disabled
,
name:
'project'
,
path:
'project'
)
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
737b7e3e
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
ProjectTreeSaver
do
describe
'saves the project tree into a json object'
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:project_tree_saver
)
{
described_class
.
new
(
project:
project
,
current_user:
user
,
shared:
shared
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:user
)
{
create
(
:user
)
}
...
...
spec/lib/gitlab/import_export/reader_spec.rb
View file @
737b7e3e
require
'spec_helper'
describe
Gitlab
::
ImportExport
::
Reader
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
''
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
)
}
let
(
:test_config
)
{
'spec/support/import_export/import_export.yml'
}
let
(
:project_tree_hash
)
do
{
...
...
spec/lib/gitlab/import_export/repo_restorer_spec.rb
View file @
737b7e3e
...
...
@@ -6,7 +6,7 @@ describe Gitlab::ImportExport::RepoRestorer do
let!
(
:project_with_repo
)
{
create
(
:project
,
:repository
,
name:
'test-repo-restorer'
,
path:
'test-repo-restorer'
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:bundler
)
{
Gitlab
::
ImportExport
::
RepoSaver
.
new
(
project:
project_with_repo
,
shared:
shared
)
}
let
(
:bundle_path
)
{
File
.
join
(
shared
.
export_path
,
Gitlab
::
ImportExport
.
project_bundle_filename
)
}
let
(
:restorer
)
do
...
...
spec/lib/gitlab/import_export/repo_saver_spec.rb
View file @
737b7e3e
...
...
@@ -5,7 +5,7 @@ describe Gitlab::ImportExport::RepoSaver do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:bundler
)
{
described_class
.
new
(
project:
project
,
shared:
shared
)
}
before
do
...
...
spec/lib/gitlab/import_export/uploads_restorer_spec.rb
View file @
737b7e3e
...
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
Gitlab
::
ImportExport
::
UploadsRestorer
do
describe
'bundle a project Git repo'
do
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/uploads_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
...
...
spec/lib/gitlab/import_export/uploads_saver_spec.rb
View file @
737b7e3e
...
...
@@ -4,7 +4,7 @@ describe Gitlab::ImportExport::UploadsSaver do
describe
'bundle a project Git repo'
do
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/uploads_saver_spec"
}
let
(
:file
)
{
fixture_file_upload
(
Rails
.
root
+
'spec/fixtures/banana_sample.gif'
,
'image/gif'
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
before
do
allow_any_instance_of
(
Gitlab
::
ImportExport
).
to
receive
(
:storage_path
).
and_return
(
export_path
)
...
...
spec/lib/gitlab/import_export/version_checker_spec.rb
View file @
737b7e3e
...
...
@@ -2,7 +2,7 @@ require 'spec_helper'
include
ImportExport
::
CommonUtil
describe
Gitlab
::
ImportExport
::
VersionChecker
do
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
''
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
nil
,
relative_path:
''
)
}
describe
'bundle a project Git repo'
do
let
(
:version
)
{
Gitlab
::
ImportExport
.
version
}
...
...
spec/lib/gitlab/import_export/wiki_repo_saver_spec.rb
View file @
737b7e3e
...
...
@@ -5,7 +5,7 @@ describe Gitlab::ImportExport::WikiRepoSaver do
let
(
:user
)
{
create
(
:user
)
}
let!
(
:project
)
{
create
(
:project
,
:public
,
name:
'searchable_project'
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:wiki_bundler
)
{
described_class
.
new
(
project:
project
,
shared:
shared
)
}
let!
(
:project_wiki
)
{
ProjectWiki
.
new
(
project
,
user
)
}
...
...
spec/lib/gitlab/import_export/wiki_restorer_spec.rb
View file @
737b7e3e
...
...
@@ -6,7 +6,7 @@ describe Gitlab::ImportExport::WikiRestorer do
let!
(
:project_without_wiki
)
{
create
(
:project
)
}
let!
(
:project
)
{
create
(
:project
)
}
let
(
:export_path
)
{
"
#{
Dir
.
tmpdir
}
/project_tree_saver_spec"
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
relative_path:
project
.
full_path
)
}
let
(
:shared
)
{
Gitlab
::
ImportExport
::
Shared
.
new
(
project
)
}
let
(
:bundler
)
{
Gitlab
::
ImportExport
::
WikiRepoSaver
.
new
(
project:
project_with_wiki
,
shared:
shared
)
}
let
(
:bundle_path
)
{
File
.
join
(
shared
.
export_path
,
Gitlab
::
ImportExport
.
project_bundle_filename
)
}
let
(
:restorer
)
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