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
efde96e9
Commit
efde96e9
authored
Apr 06, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
started refactored the dynamic rules to be defined in a yml file
parent
e05bc611
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
import_export.yml
app/services/projects/import_export/import_export.yml
+32
-0
import_export_reader.rb
app/services/projects/import_export/import_export_reader.rb
+48
-0
No files found.
app/services/projects/import_export/import_export.yml
0 → 100644
View file @
efde96e9
# Class relationships to be included in the import/export
:project_tree
:
-
:issues
-
:labels
-
:milestones
-
:snippets
-
:releases
-
:events
-
:project_members
:
-
:user
-
:merge_requests
:
-
:merge_request_diff
-
:commit_statuses
:
-
:commit
:attributes_only
:
:project
:
-
:name
-
:path
-
:description
-
:issues_enabled
-
:wall_enabled
-
:merge_requests_enabled
-
:wiki_enabled
-
:snippets_enabled
-
:visibility_level
-
:archived
:user
:
-
:id
-
:email
-
:username
\ No newline at end of file
app/services/projects/import_export/import_export_reader.rb
0 → 100644
View file @
efde96e9
module
Projects
module
ImportExport
module
ImportExportReader
extend
self
def
project_tree
{
only:
atts_only
[
:project
],
include:
build_hash
(
tree
)
}
end
def
config
@config
||=
YAML
.
load_file
(
'app/services/projects/import_export/import_export.yml'
)
end
def
atts_only
config
[
:attributes_only
]
end
def
atts_except
config
[
:attributes_except
]
end
def
tree
config
[
:project_tree
]
end
def
build_hash
(
array
)
array
.
map
{
|
el
|
el
.
is_a?
(
Hash
)
?
process_include
(
el
)
:
el
}
end
def
process_include
(
hash
)
included_classes_hash
=
{}
hash
.
values
.
flatten
.
each
do
|
value
|
value
=
value
.
is_a?
(
Hash
)
?
process_include
(
hash
)
:
value
new_hash
=
{
:include
=>
value
}
new_hash
.
merge!
(
check_only
(
value
))
included_classes_hash
[
hash
.
keys
.
first
]
=
new_hash
end
included_classes_hash
end
def
check_only
(
value
)
key
=
value
.
is_a?
(
Hash
)
?
value
.
keys
.
first
:
value
atts_only
[
key
].
nil?
?
{}
:
{
only:
atts_only
[
key
]
}
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