def config_settings(): """Returns dict of config settings set interactivly by user""" base_dir = get_string('What base directories do you want ' + \ 'for your repos?', example_settings.GITMARK_BASE_DIR) get_content = get_yes_or_no('Do you want to pull down ' + \ 'content of page when you download a bookmark?', example_settings.GET_CONTENT) content_cache_mb = get_int('Do you want to set a maximum MB ' + \ 'of content cache?', example_settings.CONTENT_CACHE_SIZE_MB) remote_pub_repo = get_string('Specify remote git repository ' + \ 'for your public bookmarks', example_settings.REMOTE_PUBLIC_REPO) remote_private_repo = get_string('Specify remote git ' + \ 'repository for your private bookmarks?', example_settings.REMOTE_PRIVATE_REPO) remote_content_repo = None content_as_reop = get_yes_or_no('Do you want your content ' + \ 'folder to be stored as a repository?', example_settings.CONTENT_AS_REPO) if content_as_reop is True: remote_content_repo = get_string('What is git ' + \ 'repository for your content?', example_settings.REMOTE_CONTENT_REPO) print "-- User Info --" user_name = get_string("What username do you want to use?", example_settings.USER_NAME) user_email = get_string("What email do you want to use?", example_settings.USER_EMAIL) machine_name = get_string("What is the name of this computer?", example_settings.MACHINE_NAME) return {'GITMARK_BASE_DIR': base_dir, 'GET_CONTENT': get_content, 'CONTENT_CACHE_SIZE_MB': content_cache_mb, 'CONTENT_AS_REPO': content_as_reop, 'REMOTE_PUBLIC_REPO': remote_pub_repo, 'REMOTE_PRIVATE_REPO': remote_private_repo, 'SAVE_CONTENT_TO_REPO': content_as_reop, 'REMOTE_CONTENT_REPO': remote_content_repo, 'PUBLIC_GITMARK_REPO_DIR': example_settings.PUBLIC_GITMARK_REPO_DIR, 'PRIVATE_GITMARK_REPO_DIR': example_settings.PRIVATE_GITMARK_REPO_DIR, 'CONTENT_GITMARK_DIR': example_settings.CONTENT_GITMARK_DIR, 'BOOKMARK_SUB_PATH': example_settings.BOOKMARK_SUB_PATH, 'TAG_SUB_PATH': example_settings.TAG_SUB_PATH, 'MSG_SUB_PATH': example_settings.MSG_SUB_PATH, 'HTML_SUB_PATH': example_settings.HTML_SUB_PATH, 'USER_NAME': user_name, 'USER_EMAIL': user_email, 'MACHINE_NAME': machine_name}
def config_settings(): """Returns dict of config settings set interactivly by user""" base_dir = get_string('What base directories do you want ' + \ 'for your repos?', example_settings.GITMARK_BASE_DIR) get_content = get_yes_or_no('Do you want to pull down ' + \ 'content of page when you download a bookmark?', example_settings.GET_CONTENT) content_cache_mb = get_int('Do you want to set a maximum MB ' + \ 'of content cache?', example_settings.CONTENT_CACHE_SIZE_MB) remote_pub_repo = get_string('Specify remote git repository ' + \ 'for your public bookmarks', example_settings.REMOTE_PUBLIC_REPO) remote_private_repo = get_string('Specify remote git ' + \ 'repository for your private bookmarks?', example_settings.REMOTE_PRIVATE_REPO) remote_content_repo = None content_as_reop = get_yes_or_no('Do you want your content ' + \ 'folder to be stored as a repository?', example_settings.CONTENT_AS_REPO) if content_as_reop is True: remote_content_repo = get_string('What is git ' + \ 'repository for your content?', example_settings.REMOTE_CONTENT_REPO) print "-- User Info --" user_name = get_string("What username do you want to use?", example_settings.USER_NAME) user_email = get_string("What email do you want to use?", example_settings.USER_EMAIL) machine_name = get_string("What is the name of this computer?", example_settings.MACHINE_NAME) return { 'GITMARK_BASE_DIR': base_dir, 'GET_CONTENT': get_content, 'CONTENT_CACHE_SIZE_MB': content_cache_mb, 'CONTENT_AS_REPO': content_as_reop, 'REMOTE_PUBLIC_REPO': remote_pub_repo, 'REMOTE_PRIVATE_REPO': remote_private_repo, 'SAVE_CONTENT_TO_REPO': content_as_reop, 'REMOTE_CONTENT_REPO': remote_content_repo, 'PUBLIC_GITMARK_REPO_DIR': example_settings.PUBLIC_GITMARK_REPO_DIR, 'PRIVATE_GITMARK_REPO_DIR': example_settings.PRIVATE_GITMARK_REPO_DIR, 'CONTENT_GITMARK_DIR': example_settings.CONTENT_GITMARK_DIR, 'BOOKMARK_SUB_PATH': example_settings.BOOKMARK_SUB_PATH, 'TAG_SUB_PATH': example_settings.TAG_SUB_PATH, 'MSG_SUB_PATH': example_settings.MSG_SUB_PATH, 'HTML_SUB_PATH': example_settings.HTML_SUB_PATH, 'USER_NAME': user_name, 'USER_EMAIL': user_email, 'MACHINE_NAME': machine_name }
def main(): """Main""" print """ Wecome to gitmarks configurator. This will setup a couple of local repositories for you to use as your gitmarks system. Gitmarks will maintain 2-3 repositories. - 1 for public use (world+dog read) - 1 for friends use (with some encryption) - 1 (optional) for content. This can be non-repo, or nonexistant. """ if not get_yes_or_no("Ready to start?"): print "Goodbye! Share and Enjoy." return 0 return configure_gitmarks()
def configure_gitmarks(): """ This function does the basic configuration of gitmarks. It tries to download needed software, get settings from users, and spawns the basic on-disk files for the bookmarks. """ # Pull needed libraries from Internet download_needed_software() # Generate our configuration settings user_settings = config_settings() try: cont = get_yes_or_no("Setup up local environment from " + \ "above settings?") except InputError, err: print str(err) return -1