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
bce886b7
Commit
bce886b7
authored
Jan 05, 2018
by
Sean McGivern
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'remove_labeled_issues_seed' into 'master'
Remove labeled issues seed See merge request gitlab-org/gitlab-ce!16258
parents
a2aad053
ff8971a7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
112 deletions
+0
-112
22_labeled_issues_seed.rb
db/fixtures/development/22_labeled_issues_seed.rb
+0
-112
No files found.
db/fixtures/development/22_labeled_issues_seed.rb
deleted
100644 → 0
View file @
a2aad053
# Creates a project with labeled issues for a user.
# Run this single seed file using: rake db:seed_fu FILTER=labeled USER_ID=74.
# If an USER_ID is not provided it will use the last created user.
require
'./spec/support/sidekiq'
class
Gitlab
::
Seeder
::
LabeledIssues
include
::
Gitlab
::
Utils
def
initialize
(
user
)
@user
=
user
end
def
seed!
Sidekiq
::
Testing
.
inline!
do
group
=
create_group
puts
'.'
create_projects
(
group
)
puts
'.'
create_labels
(
group
)
puts
'.'
create_issues
(
group
)
puts
'.'
end
print
'.'
end
private
def
create_group
group_name
=
"group_of_
#{
@user
.
name
}#{
SecureRandom
.
hex
(
4
)
}
"
group
=
Group
.
new
(
name:
group_name
,
path:
group_name
,
description:
FFaker
::
Lorem
.
sentence
)
group
.
save
group
.
add_owner
(
@user
)
group
end
def
create_projects
(
group
)
5
.
times
do
project_name
=
"project_
#{
SecureRandom
.
hex
(
6
)
}
"
params
=
{
namespace_id:
group
.
id
,
name:
project_name
,
description:
FFaker
::
Lorem
.
sentence
,
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
}
Projects
::
CreateService
.
new
(
@user
,
params
).
execute
end
end
def
create_labels
(
group
)
group
.
projects
.
each
do
|
project
|
5
.
times
do
label_title
=
FFaker
::
Vehicle
.
model
Labels
::
CreateService
.
new
(
title:
label_title
).
execute
(
project:
project
)
end
end
10
.
times
do
label_title
=
FFaker
::
Product
.
brand
Labels
::
CreateService
.
new
(
title:
label_title
).
execute
(
group:
group
)
end
end
def
create_issues
(
group
)
# Get only group labels
group_labels
=
LabelsFinder
.
new
(
@user
,
group_id:
group
.
id
).
execute
.
where
.
not
(
group_id:
nil
)
group
.
projects
.
each
do
|
project
|
label_ids
=
project
.
labels
.
pluck
(
:id
).
sample
(
5
)
label_ids
.
push
(
*
group
.
labels
.
sample
(
4
))
50
.
times
do
issue_params
=
{
title:
FFaker
::
Lorem
.
sentence
(
6
),
description:
FFaker
::
Lorem
.
sentence
,
state:
'opened'
,
label_ids:
label_ids
}
Issues
::
CreateService
.
new
(
project
,
@user
,
issue_params
).
execute
if
project
.
project_feature
.
present?
end
end
end
end
Gitlab
::
Seeder
.
quiet
do
user_id
=
ENV
[
'USER_ID'
]
user
=
if
user_id
.
present?
User
.
find
(
user_id
)
else
User
.
last
end
Gitlab
::
Seeder
::
LabeledIssues
.
new
(
user
).
seed!
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