]> git.lizzy.rs Git - cheatdb.git/blob - app/default_data.py
Add Gitlab CI support
[cheatdb.git] / app / default_data.py
1 from .models import *
2 from .utils import make_flask_user_password
3
4
5 def populate(session):
6         admin_user = User("rubenwardy")
7         admin_user.active = True
8         admin_user.password = make_flask_user_password("tuckfrump")
9         admin_user.github_username = "rubenwardy"
10         admin_user.forums_username = "rubenwardy"
11         admin_user.rank = UserRank.ADMIN
12         session.add(admin_user)
13
14         tags = {}
15         for tag in ["Inventory", "Mapgen", "Building", \
16                         "Mobs and NPCs", "Tools", "Player effects", \
17                         "Environment", "Transport", "Maintenance", "Plants and farming", \
18                         "PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
19                 row = Tag(tag)
20                 tags[row.name] = row
21                 session.add(row)
22
23         licenses = {}
24         for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
25                                         "Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
26                                         "CC-BY", "MIT", "ZLib", "Other (Free)"]:
27                 row = License(license)
28                 licenses[row.name] = row
29                 session.add(row)
30
31         for license in ["CC-BY-NC-SA", "Other (Non-free)"]:
32                 row = License(license, False)
33                 licenses[row.name] = row
34                 session.add(row)
35
36
37 def populate_test_data(session, licenses, tags, admin_user):
38         ez = User("Shara")
39         ez.github_username = "Ezhh"
40         ez.forums_username = "Shara"
41         ez.rank = UserRank.EDITOR
42         session.add(ez)
43
44         not1 = Notification(admin_user, ez, "Awards approved", "/packages/rubenwardy/awards/")
45         session.add(not1)
46
47         jeija = User("Jeija")
48         jeija.github_username = "Jeija"
49         jeija.forums_username = "Jeija"
50         session.add(jeija)
51
52
53         mod = Package()
54         mod.approved = True
55         mod.name = "alpha"
56         mod.title = "Alpha Test"
57         mod.license = licenses["MIT"]
58         mod.media_license = licenses["MIT"]
59         mod.type = PackageType.MOD
60         mod.author = admin_user
61         mod.tags.append(tags["mapgen"])
62         mod.tags.append(tags["environment"])
63         mod.repo = "https://github.com/ezhh/other_worlds"
64         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
65         mod.forums = 16015
66         mod.short_desc = "The content library should not be used yet as it is still in alpha"
67         mod.desc = "This is the long desc"
68         session.add(mod)
69
70         rel = PackageRelease()
71         rel.package = mod
72         rel.title = "v1.0.0"
73         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
74         rel.approved = True
75         session.add(rel)
76
77         mod1 = Package()
78         mod1.approved = True
79         mod1.name = "awards"
80         mod1.title = "Awards"
81         mod1.license = licenses["LGPLv2.1"]
82         mod1.media_license = licenses["MIT"]
83         mod1.type = PackageType.MOD
84         mod1.author = admin_user
85         mod1.tags.append(tags["player_effects"])
86         mod1.repo = "https://github.com/rubenwardy/awards"
87         mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
88         mod1.forums = 4870
89         mod1.short_desc = "Adds achievements and an API to register new ones."
90         mod1.desc = """
91 Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
92
93 ```
94 awards.register_achievement("award_mesefind",{
95     title = "First Mese Find",
96     description = "Found some Mese!",
97     trigger = {
98         type   = "dig",          -- award is given when
99         node   = "default:mese", -- this type of node has been dug
100         target = 1,              -- this number of times
101     },
102 })
103 ```
104 """
105
106         rel = PackageRelease()
107         rel.package = mod1
108         rel.title = "v1.0.0"
109         rel.url = "https://github.com/rubenwardy/awards/archive/master.zip"
110         rel.approved = True
111         session.add(rel)
112
113         mod2 = Package()
114         mod2.approved = True
115         mod2.name = "mesecons"
116         mod2.title = "Mesecons"
117         mod2.tags.append(tags["tools"])
118         mod2.type = PackageType.MOD
119         mod2.license = licenses["LGPLv3"]
120         mod2.media_license = licenses["MIT"]
121         mod2.author = jeija
122         mod2.repo = "https://github.com/minetest-mods/mesecons/"
123         mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
124         mod2.forums = 628
125         mod2.short_desc = "Mesecons adds everything digital, from all kinds of sensors, switches, solar panels, detectors, pistons, lamps, sound blocks to advanced digital circuitry like logic gates and programmable blocks."
126         mod2.desc = """
127 MESECONS by Jeija and contributors
128
129 Mezzee-what?
130 ------------
131 [Mesecons](http://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay.
132
133 Mesecons is a mod for [Minetest](http://minetest.net/) that implements a ton of items related to digital circuitry, such as wires, buttons, lights, and even programmable controllers. Among other things, there are also pistons, solar panels, pressure plates, and note blocks.
134
135 Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, with different rules and mechanics.
136
137 OK, I want in.
138 --------------
139 Go get it!
140
141 [DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip)
142
143 Now go ahead and install it like any other Minetest mod. Don't know how? Check out [the wonderful page about it](http://wiki.minetest.com/wiki/Mods) over at the Minetest Wiki. For your convenience, here's a quick summary:
144
145 1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer.
146 2. Make sure that when you open the folder, you can directly find `README.md` in the listing. If you just see another folder, move that folder up one level and delete the old one.
147 3. Open up the Minetest mods folder - usually `/mods/`. If you see the `minetest` or folder inside of that, that is your mod folder instead.
148 4. Copy the Mesecons folder into the mods folder.
149
150 Don't like some parts of Mesecons? Open up the Mesecons folder and delete the subfolder containing the mod you don't want. If you didn't want movestones, for example, all you have to do is delete the `mesecons_movestones` folder and they will no longer be available.
151
152 There are no dependencies - it will work right after installing!
153
154 How do I use this thing?
155 ------------------------
156 How about a [quick overview video](https://www.youtube.com/watch?v=6kmeQj6iW5k)?
157
158 Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your style?
159
160 An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look?
161
162 Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders?
163
164 Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
165
166 Who wrote it anyways?
167 ---------------------
168 These awesome people made Mesecons possible!
169
170 | Contributor     | Contribution                     |
171 | --------------- | -------------------------------- |
172 | Hawk777         | Code for VoxelManip caching      |
173 | Jat15           | Various tweaks.                  |
174 | Jeija           | **Main developer! Everything.**  |
175 | Jordach         | Noteblock sounds.                |
176 | khonkhortistan  | Code, recipes, textures.         |
177 | Kotolegokot     | Nodeboxes for items.             |
178 | minerd247       | Textures.                        |
179 | Nore/Novatux    | Code.                            |
180 | RealBadAngel    | Fixes, improvements.             |
181 | sfan5           | Code, recipes, textures.         |
182 | suzenako        | Piston sounds.                   |
183 | Uberi/Temperest | Code, textures, documentation.   |
184 | VanessaE        | Code, recipes, textures, design. |
185 | Whiskers75      | Logic gates implementation.      |
186
187 There are also a whole bunch of other people helping with everything from code to testing and feedback. Mesecons would also not be possible without their help!
188
189 Alright, how can I use it?
190 --------------------------
191 All textures in this project are licensed under the CC-BY-SA 3.0 (Creative Commons Attribution-ShareAlike 3.0 Generic). That means you can distribute and remix them as much as you want to, under the condition that you give credit to the authors and the project, and that if you remix and release them, they must be under the same or similar license to this one.
192
193 All code in this project is licensed under the LGPL version 3 or later. That means you have unlimited freedom to distribute and modify the work however you see fit, provided that if you decide to distribute it or any modified versions of it, you must also use the same license. The LGPL also grants the additional freedom to write extensions for the software and distribute them without the extensions being subject to the terms of the LGPL, although the software itself retains its license.
194
195 No warranty is provided, express or implied, for any part of the project.
196
197 """
198
199         session.add(mod1)
200         session.add(mod2)
201
202         mod = Package()
203         mod.approved = True
204         mod.name = "handholds"
205         mod.title = "Handholds"
206         mod.license = licenses["MIT"]
207         mod.media_license = licenses["MIT"]
208         mod.type = PackageType.MOD
209         mod.author = ez
210         mod.tags.append(tags["player_effects"])
211         mod.repo = "https://github.com/ezhh/handholds"
212         mod.issueTracker = "https://github.com/ezhh/handholds/issues"
213         mod.forums = 17069
214         mod.short_desc = "Adds hand holds and climbing thingies"
215         mod.desc = "This is the long desc"
216         session.add(mod)
217
218         rel = PackageRelease()
219         rel.package = mod
220         rel.title = "v1.0.0"
221         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
222         rel.approved = True
223         session.add(rel)
224
225         mod = Package()
226         mod.approved = True
227         mod.name = "other_worlds"
228         mod.title = "Other Worlds"
229         mod.license = licenses["MIT"]
230         mod.media_license = licenses["MIT"]
231         mod.type = PackageType.MOD
232         mod.author = ez
233         mod.tags.append(tags["mapgen"])
234         mod.tags.append(tags["environment"])
235         mod.repo = "https://github.com/ezhh/other_worlds"
236         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
237         mod.forums = 16015
238         mod.short_desc = "Adds space with asteroids and comets"
239         mod.desc = "This is the long desc"
240         session.add(mod)
241
242         mod = Package()
243         mod.approved = True
244         mod.name = "food"
245         mod.title = "Food"
246         mod.license = licenses["LGPLv2.1"]
247         mod.media_license = licenses["MIT"]
248         mod.type = PackageType.MOD
249         mod.author = admin_user
250         mod.tags.append(tags["player_effects"])
251         mod.repo = "https://github.com/rubenwardy/food/"
252         mod.issueTracker = "https://github.com/rubenwardy/food/issues/"
253         mod.forums = 2960
254         mod.short_desc = "Adds lots of food and an API to manage ingredients"
255         mod.desc = "This is the long desc"
256         session.add(mod)
257
258         mod = Package()
259         mod.approved = True
260         mod.name = "food_sweet"
261         mod.title = "Sweet Foods"
262         mod.license = licenses["CC0"]
263         mod.media_license = licenses["MIT"]
264         mod.type = PackageType.MOD
265         mod.author = admin_user
266         mod.tags.append(tags["player_effects"])
267         mod.repo = "https://github.com/rubenwardy/food_sweet/"
268         mod.issueTracker = "https://github.com/rubenwardy/food_sweet/issues/"
269         mod.forums = 9039
270         mod.short_desc = "Adds sweet food"
271         mod.desc = "This is the long desc"
272         food_sweet = mod
273         session.add(mod)
274
275         game1 = Package()
276         game1.approved = True
277         game1.name = "capturetheflag"
278         game1.title = "Capture The Flag"
279         game1.type = PackageType.GAME
280         game1.license = licenses["LGPLv2.1"]
281         game1.media_license = licenses["MIT"]
282         game1.author = admin_user
283         game1.tags.append(tags["pvp"])
284         game1.tags.append(tags["survival"])
285         game1.tags.append(tags["multiplayer"])
286         game1.repo = "https://github.com/rubenwardy/capturetheflag"
287         game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
288         game1.forums = 12835
289         game1.short_desc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
290         game1.desc = """
291 As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
292
293 Uses the CTF PvP Engine.
294 """
295
296         session.add(game1)
297
298         rel = PackageRelease()
299         rel.package = game1
300         rel.title = "v1.0.0"
301         rel.url = "https://github.com/rubenwardy/capturetheflag/archive/master.zip"
302         rel.approved = True
303         session.add(rel)
304
305
306         mod = Package()
307         mod.approved = True
308         mod.name = "pixelbox"
309         mod.title = "PixelBOX Reloaded"
310         mod.license = licenses["CC0"]
311         mod.media_license = licenses["MIT"]
312         mod.type = PackageType.TXP
313         mod.author = admin_user
314         mod.forums = 14132
315         mod.short_desc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
316         mod.desc = "This is the long desc"
317         session.add(mod)
318
319         rel = PackageRelease()
320         rel.package = mod
321         rel.title = "v1.0.0"
322         rel.url = "http://mamadou3.free.fr/Minetest/PixelBOX.zip"
323         rel.approved = True
324         session.add(rel)
325
326         session.commit()
327
328         metas = {}
329         for package in Package.query.filter_by(type=PackageType.MOD).all():
330                 meta = None
331                 try:
332                         meta = metas[package.name]
333                 except KeyError:
334                         meta = MetaPackage(package.name)
335                         session.add(meta)
336                         metas[package.name] = meta
337                 package.provides.append(meta)
338
339         dep = Dependency(food_sweet, meta=metas["food"])
340         session.add(dep)