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
Tatuya Kamada
gitlab-ce
Commits
74faf4ca
Commit
74faf4ca
authored
Feb 27, 2017
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add development fixtures for nested groups
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
c425f366
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
0 deletions
+69
-0
db/fixtures/development/19_nested_groups.rb
db/fixtures/development/19_nested_groups.rb
+69
-0
No files found.
db/fixtures/development/19_nested_groups.rb
0 → 100644
View file @
74faf4ca
require
'./spec/support/sidekiq'
def
create_group_with_parents
(
user
,
full_path
)
parent_path
=
nil
group
=
nil
until
full_path
.
blank?
path
,
_
,
full_path
=
full_path
.
partition
(
'/'
)
if
parent_path
parent
=
Group
.
find_by_full_path
(
parent_path
)
parent_path
+=
'/'
parent_path
+=
path
group
=
Groups
::
CreateService
.
new
(
user
,
path:
path
,
parent_id:
parent
.
id
).
execute
else
parent_path
=
path
group
=
Group
.
find_by_full_path
(
parent_path
)
||
Groups
::
CreateService
.
new
(
user
,
path:
path
).
execute
end
end
group
end
Sidekiq
::
Testing
.
inline!
do
Gitlab
::
Seeder
.
quiet
do
project_urls
=
[
'https://android.googlesource.com/platform/hardware/broadcom/libbt.git'
,
'https://android.googlesource.com/platform/hardware/broadcom/wlan.git'
,
'https://android.googlesource.com/platform/hardware/bsp/bootloader/intel/edison-u-boot.git'
,
'https://android.googlesource.com/platform/hardware/bsp/broadcom.git'
,
'https://android.googlesource.com/platform/hardware/bsp/freescale.git'
,
'https://android.googlesource.com/platform/hardware/bsp/imagination.git'
,
'https://android.googlesource.com/platform/hardware/bsp/intel.git'
,
'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.1.git'
,
'https://android.googlesource.com/platform/hardware/bsp/kernel/common/v4.4.git'
]
user
=
User
.
admins
.
first
project_urls
.
each_with_index
do
|
url
,
i
|
full_path
=
url
.
sub
(
'https://android.googlesource.com/'
,
''
)
full_path
=
full_path
.
sub
(
/\.git\z/
,
''
)
full_path
,
_
,
project_path
=
full_path
.
rpartition
(
'/'
)
group
=
Group
.
find_by_full_path
(
full_path
)
||
create_group_with_parents
(
user
,
full_path
)
params
=
{
import_url:
url
,
namespace_id:
group
.
id
,
path:
project_path
,
name:
project_path
,
description:
FFaker
::
Lorem
.
sentence
,
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
}
project
=
Projects
::
CreateService
.
new
(
user
,
params
).
execute
project
.
send
(
:_run_after_commit_queue
)
if
project
.
valid?
print
'.'
else
print
'F'
end
end
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