]> git.lizzy.rs Git - cheatdb.git/blob - setup.py
Add dependency support
[cheatdb.git] / setup.py
1 # Content DB
2 # Copyright (C) 2018  rubenwardy
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
16
17
18 import os, sys, datetime
19
20 if not "FLASK_CONFIG" in os.environ:
21         os.environ["FLASK_CONFIG"] = "../config.cfg"
22
23 delete_db = len(sys.argv) >= 2 and sys.argv[1].strip() == "-d"
24
25 if delete_db and os.path.isfile("db.sqlite"):
26         os.remove("db.sqlite")
27
28 if not os.path.isfile("db.sqlite"):
29         from app.models import *
30
31         print("Creating database tables...")
32         db.create_all()
33         print("Filling database...")
34
35         ruben = User("rubenwardy")
36         ruben.github_username = "rubenwardy"
37         ruben.forums_username = "rubenwardy"
38         ruben.rank = UserRank.ADMIN
39         db.session.add(ruben)
40
41
42         ez = User("Shara")
43         ez.github_username = "Ezhh"
44         ez.forums_username = "Shara"
45         ez.rank = UserRank.EDITOR
46         db.session.add(ez)
47
48         not1 = Notification(ruben, ez, "Awards approved", "/packages/rubenwardy/awards/")
49         db.session.add(not1)
50
51         jeija = User("Jeija")
52         jeija.github_username = "Jeija"
53         db.session.add(jeija)
54
55         tags = {}
56         for tag in ["Inventory", "Mapgen", "Building", \
57                         "Mobs and NPCs", "Tools", "Player effects", \
58                         "Environment", "Transport", "Maintenance", "Plants and farming", \
59                         "PvP", "PvE", "Survival", "Creative", "Puzzle", "Multiplayer", "Singleplayer"]:
60                 row = Tag(tag)
61                 tags[row.name] = row
62                 db.session.add(row)
63
64
65         licenses = {}
66         for license in ["GPLv2.1", "GPLv3", "LGPLv2.1", "LGPLv3", "AGPLv2.1", "AGPLv3",
67                                         "Apache", "BSD 3-Clause", "BSD 2-Clause", "CC0", "CC-BY-SA",
68                                         "CC-BY", "CC-BY-NC-SA", "MIT", "ZLib"]:
69                 row = License(license)
70                 licenses[row.name] = row
71                 db.session.add(row)
72
73
74         mod = Package()
75         mod.approved = True
76         mod.name = "alpha"
77         mod.title = "Alpha Test"
78         mod.license = licenses["MIT"]
79         mod.type = PackageType.MOD
80         mod.author = ruben
81         mod.tags.append(tags["mapgen"])
82         mod.tags.append(tags["environment"])
83         mod.repo = "https://github.com/ezhh/other_worlds"
84         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
85         mod.forums = 16015
86         mod.shortDesc = "The content library should not be used yet as it is still in alpha"
87         mod.desc = "This is the long desc"
88         db.session.add(mod)
89
90         rel = PackageRelease()
91         rel.package = mod
92         rel.title = "v1.0.0"
93         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
94         rel.approved = True
95         db.session.add(rel)
96
97         mod1 = Package()
98         mod1.approved = True
99         mod1.name = "awards"
100         mod1.title = "Awards"
101         mod1.license = licenses["LGPLv2.1"]
102         mod1.type = PackageType.MOD
103         mod1.author = ruben
104         mod1.tags.append(tags["player_effects"])
105         mod1.repo = "https://github.com/rubenwardy/awards"
106         mod1.issueTracker = "https://github.com/rubenwardy/awards/issues"
107         mod1.forums = 4870
108         mod1.shortDesc = "Adds achievements and an API to register new ones."
109         mod1.desc = """
110 Majority of awards are back ported from Calinou's old fork in Carbone, under same license.
111
112 ```
113 awards.register_achievement("award_mesefind",{
114     title = "First Mese Find",
115     description = "Found some Mese!",
116     trigger = {
117         type   = "dig",          -- award is given when
118         node   = "default:mese", -- this type of node has been dug
119         target = 1,              -- this number of times
120     },
121 })
122 ```
123 """
124
125         rel = PackageRelease()
126         rel.package = mod1
127         rel.title = "v1.0.0"
128         rel.url = "https://github.com/rubenwardy/awards/archive/master.zip"
129         rel.approved = True
130         db.session.add(rel)
131
132         mod2 = Package()
133         mod2.approved = True
134         mod2.name = "mesecons"
135         mod2.title = "Mesecons"
136         mod2.tags.append(tags["tools"])
137         mod2.type = PackageType.MOD
138         mod2.license = licenses["LGPLv3"]
139         mod2.author = jeija
140         mod2.repo = "https://github.com/minetest-mods/mesecons/"
141         mod2.issueTracker = "https://github.com/minetest-mods/mesecons/issues"
142         mod2.forums = 628
143         mod2.shortDesc = "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."
144         mod2.desc = """
145     ########################################################################
146     ##  __    __   _____   _____   _____   _____   _____   _   _   _____  ##
147     ## |  \  /  | |  ___| |  ___| |  ___| |  ___| |  _  | | \ | | |  ___| ##
148     ## |   \/   | | |___  | |___  | |___  | |     | | | | |  \| | | |___  ##
149     ## | |\__/| | |  ___| |___  | |  ___| | |     | | | | |     | |___  | ##
150     ## | |    | | | |___   ___| | | |___  | |___  | |_| | | |\  |  ___| | ##
151     ## |_|    |_| |_____| |_____| |_____| |_____| |_____| |_| \_| |_____| ##
152     ##                                                                    ##
153     ########################################################################
154
155 MESECONS by Jeija and contributors
156
157 Mezzee-what?
158 ------------
159 [Mesecons](http://mesecons.net/)! They're yellow, they're conductive, and they'll add a whole new dimension to Minetest's gameplay.
160
161 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.
162
163 Mesecons has a similar goal to Redstone in Minecraft, but works in its own way, with different rules and mechanics.
164
165 OK, I want in.
166 --------------
167 Go get it!
168
169 [DOWNLOAD IT NOW](https://github.com/minetest-mods/mesecons/archive/master.zip)
170
171 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:
172
173 1. If Mesecons is still in a ZIP file, extract the folder inside to somewhere on the computer.
174 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.
175 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.
176 4. Copy the Mesecons folder into the mods folder.
177
178 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.
179
180 There are no dependencies - it will work right after installing!
181
182 How do I use this thing?
183 ------------------------
184 How about a [quick overview video](https://www.youtube.com/watch?v=6kmeQj6iW5k)?
185
186 Or maybe a [comprehensive reference](http://mesecons.net/items.html) is your style?
187
188 An overview for the very newest of new beginners? How does [this one](http://uberi.mesecons.net/projects/MeseconsBasics/index.html) look?
189
190 Want to get more into building? Why not check out the [Mesecons Laboratory](http://uberi.mesecons.net/), a website dedicated to advanced Mesecons builders?
191
192 Want to contribute to Mesecons itself? Check out the [source code](https://github.com/minetest-mods/mesecons)!
193
194 Who wrote it anyways?
195 ---------------------
196 These awesome people made Mesecons possible!
197
198 | Contributor     | Contribution                     |
199 | --------------- | -------------------------------- |
200 | Hawk777         | Code for VoxelManip caching      |
201 | Jat15           | Various tweaks.                  |
202 | Jeija           | **Main developer! Everything.**  |
203 | Jordach         | Noteblock sounds.                |
204 | khonkhortistan  | Code, recipes, textures.         |
205 | Kotolegokot     | Nodeboxes for items.             |
206 | minerd247       | Textures.                        |
207 | Nore/Novatux    | Code.                            |
208 | RealBadAngel    | Fixes, improvements.             |
209 | sfan5           | Code, recipes, textures.         |
210 | suzenako        | Piston sounds.                   |
211 | Uberi/Temperest | Code, textures, documentation.   |
212 | VanessaE        | Code, recipes, textures, design. |
213 | Whiskers75      | Logic gates implementation.      |
214
215 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!
216
217 Alright, how can I use it?
218 --------------------------
219 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.
220
221 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.
222
223 No warranty is provided, express or implied, for any part of the project.
224
225 """
226
227         db.session.add(mod1)
228         db.session.add(mod2)
229
230         mod = Package()
231         mod.approved = True
232         mod.name = "handholds"
233         mod.title = "Handholds"
234         mod.license = licenses["MIT"]
235         mod.type = PackageType.MOD
236         mod.author = ez
237         mod.tags.append(tags["player_effects"])
238         mod.repo = "https://github.com/ezhh/handholds"
239         mod.issueTracker = "https://github.com/ezhh/handholds/issues"
240         mod.forums = 17069
241         mod.shortDesc = "Adds hand holds and climbing thingies"
242         mod.desc = "This is the long desc"
243         db.session.add(mod)
244
245         rel = PackageRelease()
246         rel.package = mod
247         rel.title = "v1.0.0"
248         rel.url = "https://github.com/ezhh/handholds/archive/master.zip"
249         rel.approved = True
250         db.session.add(rel)
251
252         mod = Package()
253         mod.approved = True
254         mod.name = "other_worlds"
255         mod.title = "Other Worlds"
256         mod.license = licenses["MIT"]
257         mod.type = PackageType.MOD
258         mod.author = ez
259         mod.tags.append(tags["mapgen"])
260         mod.tags.append(tags["environment"])
261         mod.repo = "https://github.com/ezhh/other_worlds"
262         mod.issueTracker = "https://github.com/ezhh/other_worlds/issues"
263         mod.forums = 16015
264         mod.shortDesc = "Adds space with asteroids and comets"
265         mod.desc = "This is the long desc"
266         db.session.add(mod)
267
268         mod = Package()
269         mod.approved = True
270         mod.name = "food"
271         mod.title = "Food"
272         mod.license = licenses["LGPLv2.1"]
273         mod.type = PackageType.MOD
274         mod.author = ruben
275         mod.tags.append(tags["player_effects"])
276         mod.repo = "https://github.com/rubenwardy/food/"
277         mod.issueTracker = "https://github.com/rubenwardy/food/issues/"
278         mod.forums = 2960
279         mod.shortDesc = "Adds lots of food and an API to manage ingredients"
280         mod.desc = "This is the long desc"
281         food = mod
282         db.session.add(mod)
283
284         mod = Package()
285         mod.approved = True
286         mod.name = "food_sweet"
287         mod.title = "Sweet Foods"
288         mod.license = licenses["CC0"]
289         mod.type = PackageType.MOD
290         mod.harddeps.append(food)
291         mod.author = ruben
292         mod.tags.append(tags["player_effects"])
293         mod.repo = "https://github.com/rubenwardy/food_sweet/"
294         mod.issueTracker = "https://github.com/rubenwardy/food_sweet/issues/"
295         mod.forums = 9039
296         mod.shortDesc = "Adds sweet food"
297         mod.desc = "This is the long desc"
298         db.session.add(mod)
299
300         game1 = Package()
301         game1.approved = True
302         game1.name = "capturetheflag"
303         game1.title = "Capture The Flag"
304         game1.type = PackageType.GAME
305         game1.license = licenses["LGPLv2.1"]
306         game1.author = ruben
307         game1.tags.append(tags["pvp"])
308         game1.tags.append(tags["survival"])
309         game1.tags.append(tags["multiplayer"])
310         game1.repo = "https://github.com/rubenwardy/capturetheflag"
311         game1.issueTracker = "https://github.com/rubenwardy/capturetheflag/issues"
312         game1.forums = 12835
313         game1.shortDesc = "Two teams battle to snatch and return the enemy's flag, before the enemy takes their own!"
314         game1.desc = """
315 As seen on the Capture the Flag server (minetest.rubenwardy.com:30000)
316
317 Uses the CTF PvP Engine.
318 """
319
320         db.session.add(game1)
321
322         rel = PackageRelease()
323         rel.package = game1
324         rel.title = "v1.0.0"
325         rel.url = "https://github.com/rubenwardy/capturetheflag/archive/master.zip"
326         rel.approved = True
327         db.session.add(rel)
328
329
330         mod = Package()
331         mod.approved = True
332         mod.name = "pixelbox"
333         mod.title = "PixelBOX Reloaded"
334         mod.license = licenses["CC0"]
335         mod.type = PackageType.TXP
336         mod.author = ruben
337         mod.forums = 14132
338         mod.shortDesc = "This is an update of the original PixelBOX texture pack by the brillant artist Gambit"
339         mod.desc = "This is the long desc"
340         db.session.add(mod)
341
342         rel = PackageRelease()
343         rel.package = mod
344         rel.title = "v1.0.0"
345         rel.url = "http://mamadou3.free.fr/Minetest/PixelBOX.zip"
346         rel.approved = True
347         db.session.add(rel)
348
349         db.session.commit()
350 else:
351         print("Database already exists")