diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-11-21 22:20:45 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-11-21 22:20:45 -0500 |
commit | ee9335d17ca228778123a1968ceccb312863c022 (patch) | |
tree | 4fdfc9364478b9ae0299826e7ad8a0fead9396f0 /askbot/deployment | |
parent | e811e9d5b152c01428a954a44bbab348fbe374e8 (diff) | |
download | askbot-ee9335d17ca228778123a1968ceccb312863c022.tar.gz askbot-ee9335d17ca228778123a1968ceccb312863c022.tar.bz2 askbot-ee9335d17ca228778123a1968ceccb312863c022.zip |
added rename_tags, rename_tags_id and delete_unused_tags management commands
Diffstat (limited to 'askbot/deployment')
-rw-r--r-- | askbot/deployment/__init__.py | 12 | ||||
-rw-r--r-- | askbot/deployment/dialogs.py | 20 | ||||
-rw-r--r-- | askbot/deployment/path_utils.py | 14 |
3 files changed, 18 insertions, 28 deletions
diff --git a/askbot/deployment/__init__.py b/askbot/deployment/__init__.py index 9f4ebaf9..59bb1a03 100644 --- a/askbot/deployment/__init__.py +++ b/askbot/deployment/__init__.py @@ -2,8 +2,8 @@ module for deploying askbot """ import os.path +from askbot.utils import console from askbot.deployment import messages -from askbot.deployment import dialogs from askbot.deployment import path_utils def startforum(): @@ -41,9 +41,10 @@ def startforum(): { 'path': directory } - should_add_app = dialogs.multiple_choice_input( + should_add_app = console.choice_dialog( message, - options = ['yes','no'] + choices = ['yes','no'], + invalid_phrase = messages.INVALID_INPUT ) if should_add_app == 'yes': assert(create_new == False) @@ -71,9 +72,10 @@ def startforum(): continue else: message = messages.format_msg_create(directory) - should_create_new = dialogs.multiple_choice_input( + should_create_new = console.choice_dialog( message, - options = ['yes','no'] + choices = ['yes','no'], + invalid_phrase = messages.INVALID_INPUT ) if should_create_new == 'yes': if path_utils.dir_name_acceptable(directory): diff --git a/askbot/deployment/dialogs.py b/askbot/deployment/dialogs.py deleted file mode 100644 index 40f0d2ee..00000000 --- a/askbot/deployment/dialogs.py +++ /dev/null @@ -1,20 +0,0 @@ -"""functions that directly handle user input -""" -from askbot.deployment import messages -import time - -def multiple_choice_input(prompt_phrase, options = None): - """prints a prompt, accepts keyboard input - and makes sure that user response is one of given - in the options argument, which is required - and must be a list - """ - assert(isinstance(options, list)) - while 1: - response = raw_input('\n%s (type %s): ' % (prompt_phrase, '/'.join(options))) - if response in options: - return response - else: - opt_string = ','.join(options) - print messages.INVALID_INPUT % {'opt_string': opt_string} - time.sleep(1) diff --git a/askbot/deployment/path_utils.py b/askbot/deployment/path_utils.py index 71e66182..eb32e4e5 100644 --- a/askbot/deployment/path_utils.py +++ b/askbot/deployment/path_utils.py @@ -115,11 +115,19 @@ def deploy_into(directory, new_project = None): assert(new_project is not None) if new_project: copy_files = ('__init__.py', 'settings.py', 'manage.py', 'urls.py') - print 'copying files: ', + blank_files = ('__init__.py', 'manage.py') + print 'Copying files: ' for file_name in copy_files: src = os.path.join(SOURCE_DIR, 'setup_templates', file_name) - print '%s ' % file_name, - shutil.copy(src, directory) + if os.path.exists(os.path.join(directory, file_name)): + if file_name in blank_files: + continue + else: + print '* %s' % file_name, + print "- you already have one, please add contents of %s" % src + else: + print '* %s ' % file_name + shutil.copy(src, directory) #copy log directory src = os.path.join(SOURCE_DIR, 'setup_templates', 'log') dst = os.path.join(directory, 'log') |