Upgrade to Pro — share decks privately, control downloads, hide ads and more …

WordCamp St Louis 2014

WordCamp St Louis 2014

My chat on speeding up your theme development workflow with automation. I showed some tools I use regularly YeoPress Grunt and Git for installation, live reload and compiling as well as basic deployments.

Joshua Ray

March 01, 2014
Tweet

More Decks by Joshua Ray

Other Decks in Programming

Transcript

  1. Adding Automation
    to your theme development workflow
    Joshua Ray
    WordCamp St. Louis 2014
    @pdxOllo
    http://ollomedia.com
    http://github.com/Ollo

    View Slide

  2. Hi

    View Slide

  3. Take the repetitive tasks for every WP project
    set up localhost
    set up local database
    find WP core or download again because you can’t remember
    where you saved it last.
    run 5 minute install
    install favorite theme or boiler
    install favorite plugins
    build push to git
    set up WP on remote server { dev, staging, production }
    install favorite plugins
    use ftp? to upload modified theme / boiler for review

    View Slide

  4. View Slide

  5. Automate it
    Install
    Build
    Deploy

    View Slide

  6. View Slide

  7. Automation isn't about
    being lazy its about being
    efficient.
    ~Addy Osmani

    View Slide

  8. As an engineer, there is a short list of
    tools that you must be rabid about.
    Rabid. Foaming at the mouth crazy.
    ~Michael Lopp

    View Slide

  9. Don’t fear your terminal

    View Slide

  10. YeoPress

    View Slide

  11. The officially un-official Yeoman
    generator for WordPress
    https://github.com/wesleytodd/YeoPress
    Requires Node
    http://nodejs.org/
    Requires Yeoman
    http://yeoman.io/

    View Slide

  12. $ npm install -g yo
    $ npm install -g yo generator-wordpress
    $ yo wordpress

    View Slide

  13. Grunt
    The Javascript Taskrunner

    View Slide

  14. Already Installed by Yeoman :D
    Grunt Cli
    http://gruntjs.com/getting-started#installing-the-cli
    Plugins
    http://gruntjs.com/plugins
    $ npm install -g grunt-cli

    View Slide

  15. distributed version control system

    View Slide

  16. If you’re not already using a version control
    system START NOW!

    View Slide

  17. Webhooks
    http://developer.github.com/webhooks/

    View Slide

  18. View Slide

  19. // Init vars
    $LOCAL_ROOT = "/var/www/my_new_site";
    $LOCAL_REPO_NAME = "public_html";
    $LOCAL_REPO = "{$LOCAL_ROOT}/{$LOCAL_REPO_NAME}";
    $REMOTE_REPO = "[email protected]:jonathanstark/my_new_site.git";
    $DESIRED_BRANCH = "dev";
    // Delete local repo if it exists
    if (file_exists($LOCAL_REPO)) {
    shell_exec("rm -rf {$LOCAL_REPO}");
    }
    // Clone fresh repo from github using desired local repo name and checkout the
    desired branch
    echo shell_exec("cd {$LOCAL_ROOT} && git clone {$REMOTE_REPO} {$LOCAL_REPO_NAME} &&
    cd {$LOCAL_REPO} && git checkout {$BRANCH}");
    die("done " . mktime());

    View Slide

  20. Dandelion
    https://github.com/scttnlsn/dandelion
    Incremental Git repository deployment for OS X and Linux.
    $ gem install dandelion

    View Slide

  21. scheme: sftp
    host: example.com
    username: user
    password: pass
    path: path/to/deployment
    exclude:
    - .gitignore
    - dandelion.yml
    - folder/
    additional:
    - public/css/print.css
    - public/css/screen.css
    - public/js/main.js

    View Slide

  22. $ git commit -am “my new feature”
    $ git push origin master
    $ dandelion deploy

    View Slide

  23. Others
    Beanstalk
    http://beanstalkapp.com/
    FTPloy
    http://ftploy.com/
    Capistrano
    http://capistranorb.com/
    Rocketeer
    http://rocketeer.autopergamene.eu/

    View Slide

  24. Questions?

    View Slide

  25. View Slide