示例#1
0
文件: setup.py 项目: nicr9/dotfiles
    def run(self, gui=True):
        global dotfiles_path
        otto.debug_on()

        # Ask for user details first
        platform = otto.Dialog("Which platform is this?")
        platform.choose(SUPPORTED_PLATFORMS)

        username = otto.Dialog("What's your name?")
        username.input('Nic Roland')

        email = otto.Dialog("What's your email?")
        email.input('*****@*****.**')

        # Figure out some important details
        dotfiles_path = os.path.relpath(os.getcwd(), os.path.expanduser('~'))

        print

        # General setup
        _run_script(PRE[None])
        _run_script(PRE[platform.result])

        # Get all PPAs setup
        if platform.result == 'Ubuntu' and PPAS:
            otto.info("Adding regular PPAs...")
            for ppa in PPAS:
                otto.shell("sudo add-apt-repository %s" % ppa)
            otto.shell("sudo apt-get update")

        _packages(platform.result)
        _packages('python')

        # Configure everything
        with otto.ChangePath():
            _run(_install_symlinks, platform.result)
            _run(_cp_files, platform.result)

        # Add crons
        _run(_add_crons, platform.result)

        # More config
        details = {
                'username': username.result,
                'email': email.result,
                }
        otto.info("Some last minute config...")
        _run_script(POST[None], details)
        _run_script(POST[platform.result])
示例#2
0
 def tearDownClass(cls):
     from otto.utils import ConfigFile, info
     info("Cleaning up after CmdStore tests...")
     with ConfigFile('otto/test/.otto/config.json') as config:
         config['packs']['test'] = ''
示例#3
0
 def setUpClass(cls):
     from otto.utils import shell, ChangePath, info
     info("Setting up CmdStore tests...")
     with ChangePath('otto/test/'):
         shell('otto dr')
示例#4
0
文件: setup.py 项目: nicr9/dotfiles
def _run(func, platform):
    data, msg = METADATA[func]
    if data[platform] or data[None]:
        otto.info(msg)
        func(data[None])
        func(data[platform])
示例#5
0
文件: setup.py 项目: nicr9/dotfiles
def _packages(platform):
    """Install user packages"""
    if PACKAGES[platform]:
        otto.info("Installing %s packages..." % platform)
        to_install = ' '.join(PACKAGES[platform])
        otto.shell(PACKAGE_INSTALL_CMD[platform] % to_install)