This repository was archived by the owner on Nov 8, 2022. It is now read-only.
- Notifications
You must be signed in to change notification settings - Fork20
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
8 commits Select commitHold shift + click to select a range
343afbc
chore: wip
mydearxymd5af851
chore: wip
mydearxymb616be8
chore: extract tags
mydearxym726919c
chore: wip
mydearxyme6fc4b5
chore: wip
mydearxym80060b6
chore: wip
mydearxym5c5e1d2
chore: add blackhole
mydearxym85bc9a4
chore: re-org codebase
mydearxymFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletionslib/groupher_server/cms/cms.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletionslib/groupher_server/cms/delegates/Seeds/categories.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
defmodule GroupherServer.CMS.Delegate.Seeds.Categories do | ||
@doc """ | ||
default categories seeds for general community | ||
""" | ||
def get() do | ||
[ | ||
%{ | ||
title: "编程语言", | ||
raw: "pl", | ||
index: 0 | ||
}, | ||
%{ | ||
title: "框架 & 库", | ||
raw: "framework", | ||
index: 1 | ||
}, | ||
%{ | ||
title: "数据库", | ||
raw: "database", | ||
index: 2 | ||
}, | ||
%{ | ||
title: "devops", | ||
raw: "devops", | ||
index: 3 | ||
}, | ||
%{ | ||
title: "开发工具", | ||
raw: "tools", | ||
index: 4 | ||
}, | ||
%{ | ||
title: "城市", | ||
raw: "city", | ||
index: 5 | ||
}, | ||
%{ | ||
title: "人工智能", | ||
raw: "ai", | ||
index: 6 | ||
}, | ||
%{ | ||
title: "作品", | ||
raw: "works", | ||
index: 7 | ||
}, | ||
%{ | ||
# blackhole, Feedback, dev | ||
title: "站务", | ||
raw: "feedback", | ||
index: 8 | ||
}, | ||
%{ | ||
# Makers, Adwall, Outwork | ||
title: "其他", | ||
raw: "others", | ||
index: 9 | ||
} | ||
] | ||
end | ||
end |
130 changes: 130 additions & 0 deletionslib/groupher_server/cms/delegates/Seeds/communities.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
defmodule GroupherServer.CMS.Delegate.Seeds.Communities do | ||
@moduledoc """ | ||
communities seeds | ||
""" | ||
def get(:pl) do | ||
[ | ||
"c", | ||
"clojure", | ||
"cpp", | ||
"csharp", | ||
"dart", | ||
"delphi", | ||
"elm", | ||
"erlang", | ||
"fsharp", | ||
"go", | ||
"gradle", | ||
"groovy", | ||
"java", | ||
"javascript", | ||
"julia", | ||
"kotlin", | ||
"lisp", | ||
"lua", | ||
"ocaml", | ||
"perl", | ||
"php", | ||
"python", | ||
"ruby", | ||
"r", | ||
"racket", | ||
"red", | ||
"reason", | ||
"rust", | ||
"scala", | ||
"haskell", | ||
"swift", | ||
"typescript", | ||
"elixir", | ||
# new | ||
"deno", | ||
"crystal", | ||
"hack", | ||
"nim", | ||
"fasm", | ||
"zig", | ||
"prolog" | ||
] | ||
end | ||
def get(:framework) do | ||
[ | ||
"backbone", | ||
"d3", | ||
"django", | ||
"drupal", | ||
"eggjs", | ||
"electron", | ||
"laravel", | ||
"meteor", | ||
"nestjs", | ||
"nuxtjs", | ||
"nodejs", | ||
"phoenix", | ||
"rails", | ||
"react", | ||
"sails", | ||
"zend", | ||
"vue", | ||
"angular", | ||
"tensorflow", | ||
# mobile | ||
"android", | ||
"ios", | ||
"react-native", | ||
"weex", | ||
"xamarin", | ||
"nativescript", | ||
"ionic", | ||
# new | ||
"rxjs", | ||
"flutter", | ||
"taro", | ||
"webrtc", | ||
"wasm" | ||
] | ||
end | ||
def get(:editor) do | ||
["vim", "atom", "emacs", "vscode", "visualstudio", "jetbrains"] | ||
end | ||
def get(:database) do | ||
[ | ||
"oracle", | ||
"hive", | ||
"spark", | ||
"hadoop", | ||
"cassandra", | ||
"elasticsearch", | ||
"sql-server", | ||
"neo4j", | ||
"mongodb", | ||
"mysql", | ||
"postgresql", | ||
"redis" | ||
] | ||
end | ||
def get(:city) do | ||
[ | ||
"beijing", | ||
"shanghai", | ||
"shenzhen", | ||
"hangzhou", | ||
"guangzhou", | ||
"chengdu", | ||
"wuhan", | ||
"xiamen", | ||
"nanjing" | ||
] | ||
end | ||
def get(:devops) do | ||
# gcp -> google-cloud-platform | ||
# search google: devops tools | ||
["git", "docker", "kubernetes", "jenkins", "puppet", "aws", "azure", "aliyun", "gcp"] | ||
end | ||
end |
101 changes: 101 additions & 0 deletionslib/groupher_server/cms/delegates/Seeds/domain.ex
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
defmodule GroupherServer.CMS.Delegate.Seeds.Domain do | ||
@moduledoc """ | ||
seeds data for init, should be called ONLY in new database, like migration | ||
""" | ||
import Ecto.Query, warn: false | ||
import GroupherServer.CMS.Delegate.Seeds.Helper, | ||
only: [ | ||
threadify_communities: 2, | ||
tagfy_threads: 4, | ||
categorify_communities: 3, | ||
seed_bot: 0, | ||
seed_threads: 1, | ||
seed_categories_ifneed: 1 | ||
] | ||
alias Helper.ORM | ||
alias GroupherServer.CMS | ||
alias CMS.Model.Community | ||
@oss_endpoint "https://cps-oss.oss-cn-shanghai.aliyuncs.com" | ||
# seed community | ||
@doc """ | ||
seed community for home | ||
""" | ||
def seed_community(:home) do | ||
with {:error, _} <- ORM.find_by(Community, %{raw: "home"}), | ||
{:ok, bot} <- seed_bot(), | ||
{:ok, threads} <- seed_threads(:home), | ||
{:ok, categories} <- seed_categories_ifneed(bot) do | ||
args = %{ | ||
title: "coderplanets", | ||
desc: "the most sexy community for developers, ever.", | ||
logo: "#{@oss_endpoint}/icons/cmd/keyboard_logo.png", | ||
raw: "home", | ||
user_id: bot.id | ||
} | ||
{:ok, community} = Community |> ORM.create(args) | ||
threadify_communities([community], threads.entries) | ||
tagfy_threads([community], threads.entries, bot, :home) | ||
{:ok, community} | ||
# home 不设置分类,比较特殊 | ||
end | ||
end | ||
@doc """ | ||
seed community for blackhole | ||
""" | ||
def seed_community(:blackhole) do | ||
with {:error, _} <- ORM.find_by(Community, %{raw: "blackhole"}), | ||
{:ok, bot} <- seed_bot(), | ||
{:ok, threads} <- seed_threads(:blackhole), | ||
{:ok, categories} <- seed_categories_ifneed(bot) do | ||
args = %{ | ||
title: "黑洞", | ||
desc: "这里收录不适合出现在本站的内容。", | ||
logo: "#{@oss_endpoint}/icons/cmd/keyboard_logo.png", | ||
raw: "blackhole", | ||
user_id: bot.id | ||
} | ||
{:ok, community} = Community |> ORM.create(args) | ||
threadify_communities([community], threads.entries) | ||
tagfy_threads([community], threads.entries, bot, :blackhole) | ||
categorify_communities([community], categories, :feedback) | ||
{:ok, community} | ||
end | ||
end | ||
@doc """ | ||
seed community for feedback | ||
""" | ||
def seed_community(:feedback) do | ||
with {:error, _} <- ORM.find_by(Community, %{raw: "feedback"}), | ||
{:ok, bot} <- seed_bot(), | ||
{:ok, threads} <- seed_threads(:feedback), | ||
{:ok, categories} <- seed_categories_ifneed(bot) do | ||
args = %{ | ||
title: "反馈与建议", | ||
desc: "关于本站的建议和反馈请发布在这里,谢谢。", | ||
logo: "#{@oss_endpoint}/icons/cmd/keyboard_logo.png", | ||
raw: "feedback", | ||
user_id: bot.id | ||
} | ||
{:ok, community} = Community |> ORM.create(args) | ||
threadify_communities([community], threads.entries) | ||
tagfy_threads([community], threads.entries, bot, :feedback) | ||
categorify_communities([community], categories, :feedback) | ||
{:ok, community} | ||
# home 不设置分类,比较特殊 | ||
end | ||
end | ||
end |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.