BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
5d642fb7
Commit
5d642fb7
authored
Apr 08, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix rubocop warnings
parent
de6c44e9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
18 deletions
+16
-18
import_export_reader.rb
app/services/projects/import_export/import_export_reader.rb
+7
-8
import_export_reader_spec.rb
...vices/projects/import_export/import_export_reader_spec.rb
+9
-10
No files found.
app/services/projects/import_export/import_export_reader.rb
View file @
5d642fb7
...
@@ -38,7 +38,8 @@ module Projects
...
@@ -38,7 +38,8 @@ module Projects
def
process_include
(
hash
,
included_classes_hash
=
{})
def
process_include
(
hash
,
included_classes_hash
=
{})
hash
.
values
.
flatten
.
each
do
|
value
|
hash
.
values
.
flatten
.
each
do
|
value
|
current_key
,
value
=
process_current_class
(
hash
,
included_classes_hash
,
value
)
current_key
=
hash
.
keys
.
first
value
=
process_current_class
(
hash
,
included_classes_hash
,
value
)
if
included_classes_hash
[
current_key
]
if
included_classes_hash
[
current_key
]
add_class
(
current_key
,
included_classes_hash
,
value
)
add_class
(
current_key
,
included_classes_hash
,
value
)
else
else
...
@@ -50,14 +51,13 @@ module Projects
...
@@ -50,14 +51,13 @@ module Projects
def
process_current_class
(
hash
,
included_classes_hash
,
value
)
def
process_current_class
(
hash
,
included_classes_hash
,
value
)
value
=
value
.
is_a?
(
Hash
)
?
process_include
(
hash
,
included_classes_hash
)
:
value
value
=
value
.
is_a?
(
Hash
)
?
process_include
(
hash
,
included_classes_hash
)
:
value
current_key
=
hash
.
keys
.
first
only_except_hash
=
check_only_and_except
(
hash
.
keys
.
first
)
only_except_hash
=
check_only_and_except
(
current_key
)
included_classes_hash
[
hash
.
keys
.
first
]
||=
only_except_hash
unless
only_except_hash
.
empty?
included_classes_hash
[
current_key
]
||=
only_except_hash
unless
only_except_hash
.
empty?
value
return
current_key
,
value
end
end
def
add_new_class
(
current_key
,
included_classes_hash
,
value
)
def
add_new_class
(
current_key
,
included_classes_hash
,
value
)
new_hash
=
{
:include
=>
value
}
new_hash
=
{
include:
value
}
new_hash
.
merge!
(
check_only_and_except
(
value
))
new_hash
.
merge!
(
check_only_and_except
(
value
))
included_classes_hash
[
current_key
]
=
new_hash
included_classes_hash
[
current_key
]
=
new_hash
end
end
...
@@ -88,4 +88,4 @@ module Projects
...
@@ -88,4 +88,4 @@ module Projects
end
end
end
end
end
end
end
end
\ No newline at end of file
spec/services/projects/import_export/import_export_reader_spec.rb
View file @
5d642fb7
...
@@ -5,14 +5,14 @@ describe Projects::ImportExport::ImportExportReader do
...
@@ -5,14 +5,14 @@ describe Projects::ImportExport::ImportExportReader do
let
(
:test_config
)
{
'spec/support/import_export/import_export.yml'
}
let
(
:test_config
)
{
'spec/support/import_export/import_export.yml'
}
let
(
:project_tree_hash
)
do
let
(
:project_tree_hash
)
do
{
{
:only
=>
[
:name
,
:path
],
only:
[
:name
,
:path
],
:include
=>
[
:issues
,
:labels
,
include:
[
:issues
,
:labels
,
{
:merge_requests
=>
{
{
merge_requests:
{
:only
=>
[
:id
],
only:
[
:id
],
:except
=>
[
:iid
],
except:
[
:iid
],
:include
=>
[
:merge_request_diff
,
:merge_request_test
]
include:
[
:merge_request_diff
,
:merge_request_test
]
}
},
}
},
{
:commit_statuses
=>
{
:include
=>
:commit
}
}]
{
commit_statuses:
{
include:
:commit
}
}]
}
}
end
end
...
@@ -21,4 +21,4 @@ describe Projects::ImportExport::ImportExportReader do
...
@@ -21,4 +21,4 @@ describe Projects::ImportExport::ImportExportReader do
expect
(
described_class
.
project_tree
).
to
eq
(
project_tree_hash
)
expect
(
described_class
.
project_tree
).
to
eq
(
project_tree_hash
)
end
end
end
end
\ No newline at end of file
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