| 1 | # GNU MediaGoblin -- federated, autonomous media hosting |
| 2 | # Copyright (C) 2011 Free Software Foundation, Inc |
| 3 | # |
| 4 | # This program is free software: you can redistribute it and/or modify |
| 5 | # it under the terms of the GNU Affero 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 Affero General Public License for more details. |
| 13 | # |
| 14 | # You should have received a copy of the GNU Affero General Public License |
| 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 16 | |
| 17 | import sys |
| 18 | import pymongo |
| 19 | import sys |
| 20 | import os |
| 21 | import shutil |
| 22 | |
| 23 | |
| 24 | def wipe_parser_setup(subparser): |
| 25 | pass |
| 26 | |
| 27 | |
| 28 | def wipe(args): |
| 29 | print "*** WARNING! ***" |
| 30 | print "" |
| 31 | print "Running this will destroy your mediagoblin database," |
| 32 | print "remove all your media files in user_dev/, etc." |
| 33 | |
| 34 | drop_it = raw_input( |
| 35 | 'Are you **SURE** you want to destroy your environment? ' |
| 36 | '(if so, type "yes")> ') |
| 37 | |
| 38 | if not drop_it == 'yes': |
| 39 | return |
| 40 | |
| 41 | print "nixing data in mongodb...." |
| 42 | conn = pymongo.Connection() |
| 43 | conn.drop_database('mediagoblin') |
| 44 | |
| 45 | for directory in [os.path.join(os.getcwd(), "user_dev", "media"), |
| 46 | os.path.join(os.getcwd(), "user_dev", "beaker")]: |
| 47 | if os.path.exists(directory): |
| 48 | print "nixing %s...." % directory |
| 49 | shutil.rmtree(directory) |
| 50 | |
| 51 | print "removed all your stuff! okay, now re-run ./bin/buildout" |