Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
2c77dae2
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c77dae2
编写于
8月 11, 2014
作者:
D
Dmitriy Zaporozhets
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'improve-dev-seeds' into 'master'
Improve dev seeds See merge request !1012
上级
f8eedb4c
2804902c
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
123 addition
and
169 deletion
+123
-169
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+0
-1
db/fixtures/development/01_admin.rb
db/fixtures/development/01_admin.rb
+11
-14
db/fixtures/development/04_project.rb
db/fixtures/development/04_project.rb
+49
-53
db/fixtures/development/05_users.rb
db/fixtures/development/05_users.rb
+1
-1
db/fixtures/development/07_milestones.rb
db/fixtures/development/07_milestones.rb
+13
-15
db/fixtures/development/08_wall.rb
db/fixtures/development/08_wall.rb
+0
-21
db/fixtures/development/09_issues.rb
db/fixtures/development/09_issues.rb
+10
-26
db/fixtures/development/10_merge_requests.rb
db/fixtures/development/10_merge_requests.rb
+5
-15
db/fixtures/development/11_keys.rb
db/fixtures/development/11_keys.rb
+9
-10
db/fixtures/development/13_comments.rb
db/fixtures/development/13_comments.rb
+25
-13
未找到文件。
app/services/projects/create_service.rb
浏览文件 @
2c77dae2
...
@@ -57,7 +57,6 @@ module Projects
...
@@ -57,7 +57,6 @@ module Projects
:add_repository
,
:add_repository
,
@project
.
path_with_namespace
@project
.
path_with_namespace
)
)
end
end
if
@project
.
wiki_enabled?
if
@project
.
wiki_enabled?
...
...
db/fixtures/development/01_admin.rb
浏览文件 @
2c77dae2
User
.
seed
(
:id
,
[
User
.
seed
do
|
s
|
{
s
.
id
=
1
id:
1
,
s
.
name
=
"Administrator"
name:
"Administrator"
,
s
.
email
=
"admin@example.com"
email:
"admin@example.com"
,
s
.
username
=
'root'
username:
'root'
,
s
.
password
=
"5iveL!fe"
password:
"5iveL!fe"
,
s
.
password_confirmation
=
"5iveL!fe"
password_confirmation:
"5iveL!fe"
,
s
.
admin
=
true
admin:
true
,
s
.
projects_limit
=
100
projects_limit:
100
,
s
.
confirmed_at
=
DateTime
.
now
theme_id:
Gitlab
::
Theme
::
MARS
,
end
confirmed_at:
DateTime
.
now
}
])
db/fixtures/development/04_project.rb
浏览文件 @
2c77dae2
Gitlab
::
Seeder
.
quiet
do
require
'sidekiq/testing'
project_urls
=
[
'https://github.com/documentcloud/underscore.git'
,
Sidekiq
::
Testing
.
inline!
do
'https://github.com/diaspora/diaspora.git'
,
Gitlab
::
Seeder
.
quiet
do
'https://github.com/diaspora/diaspora-project-site.git'
,
project_urls
=
[
'https://github.com/diaspora/diaspora-client.git'
,
'https://github.com/documentcloud/underscore.git'
,
'https://github.com/brightbox/brightbox-cli.git'
,
'https://github.com/gitlabhq/gitlabhq.git'
,
'https://github.com/brightbox/puppet.git'
,
'https://github.com/gitlabhq/gitlab-ci.git'
,
'https://github.com/gitlabhq/gitlabhq.git'
,
'https://github.com/gitlabhq/gitlab-shell.git'
,
'https://github.com/gitlabhq/gitlab-ci.git'
,
'https://github.com/gitlabhq/testme.git'
,
'https://github.com/gitlabhq/gitlab-recipes.git'
,
'https://github.com/twitter/flight.git'
,
'https://github.com/gitlabhq/gitlab-shell.git'
,
'https://github.com/twitter/typeahead.js.git'
,
'https://github.com/gitlabhq/grack.git'
,
'https://github.com/h5bp/html5-boilerplate.git'
,
'https://github.com/gitlabhq/testme.git'
,
]
'https://github.com/twitter/flight.git'
,
'https://github.com/twitter/typeahead.js.git'
,
project_urls
.
each_with_index
do
|
url
,
i
|
'https://github.com/h5bp/html5-boilerplate.git'
,
group_path
,
project_path
=
url
.
split
(
'/'
)[
-
2
..-
1
]
'https://github.com/h5bp/mobile-boilerplate.git'
,
]
group
=
Group
.
find_by
(
path:
group_path
)
project_urls
.
each_with_index
do
|
url
,
i
|
unless
group
group_path
,
project_path
=
url
.
split
(
'/'
)[
-
2
..-
1
]
group
=
Group
.
new
(
name:
group_path
.
titleize
,
group
=
Group
.
find_by
(
path:
group_path
)
path:
group_path
)
unless
group
group
.
description
=
Faker
::
Lorem
.
sentence
group
=
Group
.
new
(
group
.
save
name:
group_path
.
titleize
,
path:
group_path
group
.
add_owner
(
User
.
first
)
)
end
group
.
description
=
Faker
::
Lorem
.
sentence
group
.
save
project_path
.
gsub!
(
".git"
,
""
)
group
.
add_owner
(
User
.
first
)
params
=
{
end
import_url:
url
,
namespace_id:
group
.
id
,
project_path
.
gsub!
(
".git"
,
""
)
name:
project_path
.
titleize
,
description:
Faker
::
Lorem
.
sentence
,
params
=
{
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
import_url:
url
,
}
namespace_id:
group
.
id
,
name:
project_path
.
titleize
,
project
=
Projects
::
CreateService
.
new
(
User
.
first
,
params
).
execute
description:
Faker
::
Lorem
.
sentence
,
visibility_level:
Gitlab
::
VisibilityLevel
.
values
.
sample
if
project
.
valid?
}
print
'.'
else
project
=
Projects
::
CreateService
.
new
(
User
.
first
,
params
).
execute
puts
project
.
errors
.
full_messages
print
'F'
if
project
.
valid?
end
print
'.'
else
puts
project
.
errors
.
full_messages
print
'F'
end
end
end
end
end
end
db/fixtures/development/05_users.rb
浏览文件 @
2c77dae2
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
(
2
..
1
0
).
each
do
|
i
|
(
2
..
2
0
).
each
do
|
i
|
begin
begin
User
.
seed
(
:id
,
[{
User
.
seed
(
:id
,
[{
id:
i
,
id:
i
,
...
...
db/fixtures/development/07_milestones.rb
浏览文件 @
2c77dae2
Milestone
.
seed
(
:id
,
[
Gitlab
::
Seeder
.
quiet
do
{
id:
1
,
project_id:
1
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
Project
.
all
.
each
do
|
project
|
{
id:
2
,
project_id:
1
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
(
1
..
5
).
each
do
|
i
|
{
id:
3
,
project_id:
1
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
milestone_params
=
{
{
id:
4
,
project_id:
2
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
title:
"v
#{
i
}
.0"
,
{
id:
5
,
project_id:
2
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
description:
Faker
::
Lorem
.
sentence
,
state:
[
'opened'
,
'closed'
].
sample
,
}
{
id:
6
,
project_id:
2
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
milestone
=
Milestones
::
CreateService
.
new
(
{
id:
7
,
project_id:
2
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
project
,
project
.
team
.
users
.
sample
,
milestone_params
).
execute
{
id:
8
,
project_id:
3
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
{
id:
9
,
project_id:
3
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
{
id:
11
,
project_id:
3
,
title:
'v'
+
Faker
::
Address
.
zip_code
},
])
Milestone
.
all
.
map
do
|
ml
|
print
'.'
ml
.
set_ii
d
en
d
ml
.
save
end
end
end
db/fixtures/development/08_wall.rb
已删除
100644 → 0
浏览文件 @
f8eedb4c
Gitlab
::
Seeder
.
quiet
do
(
1
..
300
).
each
do
|
i
|
# Random Project
project
=
Project
.
all
.
sample
# Random user
user
=
project
.
users
.
sample
next
unless
user
user_id
=
user
.
id
Note
.
seed
(
:id
,
[{
id:
i
,
project_id:
project
.
id
,
author_id:
user_id
,
note:
Faker
::
Lorem
.
sentence
(
6
)
}])
print
(
'.'
)
end
end
db/fixtures/development/09_issues.rb
浏览文件 @
2c77dae2
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
(
1
..
300
).
each
do
|
i
|
Project
.
all
.
each
do
|
project
|
# Random Project
(
1
..
10
).
each
do
|
i
|
project
=
Project
.
all
.
sample
issue_params
=
{
title:
Faker
::
Lorem
.
sentence
(
6
),
# Random user
description:
Faker
::
Lorem
.
sentence
,
user
=
project
.
team
.
users
.
sample
next
unless
user
user_id
=
user
.
id
Gitlab
::
Seeder
.
by_user
(
user
)
do
Issue
.
seed
(
:id
,
[{
id:
i
,
project_id:
project
.
id
,
author_id:
user_id
,
assignee_id:
user_id
,
state:
[
'opened'
,
'closed'
].
sample
,
state:
[
'opened'
,
'closed'
].
sample
,
milestone:
project
.
milestones
.
sample
,
milestone:
project
.
milestones
.
sample
,
title:
Faker
::
Lorem
.
sentence
(
6
),
assignee:
project
.
team
.
users
.
sample
description:
Faker
::
Lorem
.
sentence
}
}])
end
print
(
'.'
)
end
Issue
.
all
.
map
do
|
issue
|
Issues
::
CreateService
.
new
(
project
,
project
.
team
.
users
.
sample
,
issue_params
).
execute
issue
.
set_iid
print
'.'
issue
.
save
end
end
end
end
end
db/fixtures/development/10_merge_requests.rb
浏览文件 @
2c77dae2
...
@@ -7,27 +7,17 @@ Gitlab::Seeder.quiet do
...
@@ -7,27 +7,17 @@ Gitlab::Seeder.quiet do
source_branch
=
branches
.
pop
source_branch
=
branches
.
pop
target_branch
=
branches
.
pop
target_branch
=
branches
.
pop
# Random user
user
=
project
.
team
.
users
.
sample
next
unless
user
params
=
{
params
=
{
source_branch:
source_branch
,
source_branch:
source_branch
,
target_branch:
target_branch
,
target_branch:
target_branch
,
title:
Faker
::
Lorem
.
sentence
(
6
),
title:
Faker
::
Lorem
.
sentence
(
6
),
description:
Faker
::
Lorem
.
sentences
(
3
).
join
(
" "
)
description:
Faker
::
Lorem
.
sentences
(
3
).
join
(
" "
),
milestone:
project
.
milestones
.
sample
,
assignee:
project
.
team
.
users
.
sample
}
}
merge_request
=
MergeRequests
::
CreateService
.
new
(
project
,
user
,
params
).
execute
MergeRequests
::
CreateService
.
new
(
project
,
project
.
team
.
users
.
sample
,
params
).
execute
print
'.'
if
merge_request
.
valid?
merge_request
.
assignee
=
user
merge_request
.
milestone
=
project
.
milestones
.
sample
merge_request
.
save
print
'.'
else
print
'F'
end
end
end
end
end
end
end
db/fixtures/development/11_keys.rb
浏览文件 @
2c77dae2
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
User
.
first
(
30
).
each_with_index
do
|
user
,
i
|
User
.
first
(
10
).
each
do
|
user
|
Key
.
seed
(
:id
,
[
key
=
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt
#{
user
.
id
+
100
}
6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
{
id:
i
+
1
,
user
.
keys
.
create
(
title:
"Sample key
#{
i
}
"
,
title:
"Sample key
#{
user
.
id
}
"
,
key:
"ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt
#{
i
+
100
}
6k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0="
,
key:
key
user_id:
user
.
id
,
)
}
])
print
'.'
puts
"SSH KEY #
#{
i
}
added."
.
green
end
end
end
end
db/fixtures/development/13_comments.rb
浏览文件 @
2c77dae2
Gitlab
::
Seeder
.
quiet
do
Gitlab
::
Seeder
.
quiet
do
Issue
.
all
.
limit
(
10
).
each_with_index
do
|
issue
,
i
|
Issue
.
all
.
each
do
|
issue
|
5
.
times
do
project
=
issue
.
project
user
=
issue
.
project
.
team
.
users
.
sample
Gitlab
::
Seeder
.
by_user
(
user
)
do
project
.
team
.
users
.
each
do
|
user
|
Note
.
seed
(
:id
,
[{
note_params
=
{
project_id:
issue
.
project
.
id
,
noteable_type:
'Issue'
,
author_id:
user
.
id
,
noteable_id:
issue
.
id
,
note:
Faker
::
Lorem
.
sentence
,
note:
Faker
::
Lorem
.
sentence
,
noteable_id:
issue
.
id
,
}
noteable_type:
'Issue'
}])
print
'.'
Notes
::
CreateService
.
new
(
project
,
user
,
note_params
).
execute
end
print
'.'
end
end
MergeRequest
.
all
.
each
do
|
mr
|
project
=
mr
.
project
project
.
team
.
users
.
each
do
|
user
|
note_params
=
{
noteable_type:
'MergeRequest'
,
noteable_id:
mr
.
id
,
note:
Faker
::
Lorem
.
sentence
,
}
Notes
::
CreateService
.
new
(
project
,
user
,
note_params
).
execute
print
'.'
end
end
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录