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