Example #1
0
def find_package_management_program():
    if env.get("install_package_command"):
        return
    if is_linux():
        if program_exists("apt-get"):
            env.install_package_command = "sudo apt-get install -y"
        elif program_exists("yum"):
            env.install_package_command = "sudo yum -y install"
    elif is_macos():
        ensure_homebrew()
        env.install_package_command = "brew install"
Example #2
0
def wordpress_nginx():
    if not is_linux():
        print 'This task is only supported on linux' 
    # install LEMP (nginx + mysql + php)
    pkgs = ['mysql-server', 'mysql-client', 'nginx', 'php5', 'php5-fpm', 'php5-mysql', 'wordpress']
    #[ensure_package(pkg) for pkg in pkgs]
    sed('/etc/php5/fpm/php.ini', '^;? *cgi.fix_pathinfo *= *1', 'cgi.fix_pathinfo=0', use_sudo=True)
    upload_template('wp_blog', '/etc/nginx/sites-available/wp_blog', use_sudo=True,
        context={'server_name' : 'ryanye.me, blog.ryanye.me, www.ryanye.me'})    
    with cd('/etc/nginx/sites-enabled/'):
        sudo('ln -sf ../sites-available/wp_blog')
    sudo('service nginx restart')
    sudo('bash /usr/share/doc/wordpress/examples/setup-mysql -n wordpress blog.ryanye.me')
    # fix uploads directory permission issue
    sudo('chown www-data:www-data -R /srv/www/wp-uploads')
    # set default language to Chinese in wp-config
    print "To allow direct plugin/content upload, add the following line to /etc/wordpress/confg-localhost.php"
    print "    define('FS_METHOD', 'direct');"
    print "To change default language to Chinese,"
    print "    define('WPLANG', 'zh_CN');"
Example #3
0
def vim():
    # get vim version
    ensure_git_repo('.vim', 'git://github.com/yejianye/vim-setup.git', pushurl='[email protected]:yejianye/vim-setup.git', submodules=True)
    ensure_link('.vimrc_common', '~/.vim/.vimrc_common')
    ensure_file('.vimrc', append='source ~/.vimrc_common')
    # With Mac gcc and make should be installed with Xcode
    if not is_macos():
        ensure_package('gcc')
        ensure_package('make')
    with(cd('~/.vim/bundle/vimproc')):
        if is_macos():
            run('make -f make_mac.mak')
        elif is_linux():
            run('make -f make_unix.mak')
    # setup pushurl for submodules
    with(cd('~/.vim/bundle/textobj_function')):    
        run('git config remote.origin.pushurl [email protected]:yejianye/vim-textobj-function.git')
    with(cd('~/.vim/bundle/vim-ref-jquery')):
        run('git config remote.origin.pushurl [email protected]:yejianye/vim-ref-jquery.git')
    with(cd('~/.vim/bundle/syntastic')):
        run('git config remote.origin.pushurl [email protected]:yejianye/syntastic.git')
Example #4
0
def watchdog():
    if is_linux():
        ensure_python_pkg('pyinotify')
    ensure_python_pkg('git+git://github.com/yejianye/watchdog-tricks.git')