Pro Yearly is on sale from $80 to $50! »

WP-CLI 入門

WP-CLI 入門

WordCamp Kyoto 2017

A0412ba4d1cc922f1950a46d8804a5f9?s=128

Takayuki Miyauchi

June 24, 2017
Tweet

Transcript

  1. 81$-*ೖ໳ 8PSE$BNQ,ZPUP 5BLBZVLJ.JZBVDIJ !NJZB

  2. • ౦ژͷλϩεΧΠגࣜձࣾ͞ΜͱҰॹʹ࢓ࣄͯ͠·͢ɻ • VCCW։ൃऀɻVVVɺWordmoveɺWP-CLIɺWP-APIͳͲ ͷϓϩδΣΫτʹߩݙ • ࿨Վࢁݝ۲ຊொࡏॅ • capitalp.jp ͍ͬͯ͏ڞಉϒϩά΍ͬͯ·͢ɻ

  3. None
  4. None
  5. None
  6. w81$-*ͷΠϯετʔϧํ๏ wઃఆ w׆༻ࣄྫ w֦ு wߩݙ ࠓ೔͓࿩͢Δ͜ͱ

  7. 81$-*ͱ͸

  8. • WordPress ΛίϚϯυϥΠϯͰૢ࡞͢ΔͨΊͷπʔϧ • ؅ཧը໘ͰͰ͖Δ͜ͱʴα ΛίϚϯυϥΠϯͰ࣮ߦՄೳ • VVVɺVCCWɼAMIMOTOɺԤถͷϗεςΟϯάձࣾͳͲ Ͱར༻͞Ε͍ͯΔɻ http://wp-cli.org/

  9. Daniel Bachhuber @danielbachhuber Alain Schlesser @schlessera ίϛολʔ

  10. wp core download --path=$(pwd) --locale=ja wp config create \ --dbhost=localhost

    \ --dbname=wordpress \ --dbuser=root \ --dbprefix=wp_ \ --locale=ja wp core install \ --url=http://127.0.0.1:8080 \ --title="WordPress" \ --admin_user="admin" \ --admin_password="admin" \ --admin_email="admin@example.com" wp server --host=0.0.0.0 --port=8080 --docroot=$(pwd) https://gist.github.com/miya0001/f3e3aed260efa8823116500b5e70db74
  11. Πϯετʔϧํ๏

  12. $ curl -O https://.../wp-cli.phar $ chmod 755 wp.phar $ mv

    wp.phar /usr/local/bin/wp $ wp --info https://wp-cli.org/#installing
  13. ಈ࡞؀ڥ • Unixܥͷ؀ڥʢWindowsͰ͸Ұ෦੍ݶ͋Γʣ • PHP 5.3.29 or later • WordPress

    3.7 or later
  14. ઃఆϑΝΠϧ

  15. ~/.wp-cli/config.yml ./wp-cli.yml https://make.wordpress.org/cli/ handbook/config/ ઃఆͳ͠Ͱ΋ಈ࡞͠·͕͋͢Δͱศར

  16. ׆༻ࣄྫ

  17. ΤΠϦΞεͰ
 ෳ਺ͷ8PSE1SFTTΛ
 Ξοϓσʔτ

  18. @example.dev: path: /Users/miyauchi/valet/example @vccw.dev: ssh: user@vccw.dev:22/var/www/html dXQDMJDPOpHʹҎԼͷΑ͏ʹهड़ $ wp @vccw.dev

    plugin list $ wp @all plugin list
  19. #!/usr/bin/env bash wp @all core update wp @all plugin update

    --all wp @all theme update --all wp @all core language update
  20. @live: - @vccw.dev @staging: - @example.dev $ wp @staging core

    update εςʔδϯάͱຊ൪ʹ෼͚࣮ͯߦ͢Δ͜ͱ΋Մೳ @staging ͷΈίΞΛΞοϓσʔτ
  21. ΠϯϑϥߏஙΛࣗಈԽ

  22. - name: Run `wp plugin install` command: | wp plugin

    install {{ item }} --activate --path={{ path }} with_items: "{{ vccw.plugins }}" ϓϥάΠϯΛΠϯετʔϧ͢ΔͨΊͷ
 Ansible playbook ͷྫ https://github.com/vccw-team/vccw/blob/ master/provision/playbooks/wordpress.yml
  23. 4FSWFSTQFDͰ ಈ࡞ςετΛࣗಈԽ

  24. https://travis-ci.org/vccw-team/vccw/jobs/237365166

  25. ֦ு

  26. • WP-CLIͰ͸αʔυύʔςΟͷίϚϯυΛ௥Ճ͢Δ͜ͱ͕ Ͱ͖·͢ɻ • WordPress ϓϥάΠϯͱͯ͠։ൃ • ύοέʔδίϚϯυͱͯ͠։ൃ https://make.wordpress.org/cli/handbook/ commands-cookbook/

  27. ͓͢͢Ίύοέʔδ http://wp-cli.org/package-index/

  28. $ wp valet • Laravel ༻ͷ։ൃ؀ڥ Valet ্ʹ WordPress ؀ڥΛߏங

    • खͬऔΓૣ͘ WordPress Λ࡞ͬͨΓࣺͯͨΓ͢Δࡍʹศ རɻ https://github.com/aaemnnosttv/wp-cli-valet-command
  29. $ wp scaffold vccw VCCW ༻ͷϑΝΠϧΛੜ੒͢ΔίϚϯυɻ https://github.com/vccw-team/scaffold-vccw

  30. $ wp shifter σδλϧΩϡʔϒ͞ΜͷαʔϏε Shifter ʹ
 WordPress ΛσϓϩΠ͢ΔͨΊͷίϚϯυ https://github.com/getshifter/wp-cli-shifter

  31. 81$-*΁ͷߩݙ

  32. $ git clone wp-cli/media-command.git $ cd media-command $ composer install

    $ vendor/bin/behat όάͬΆ͍΋ͷΛݟ͚ͭͨΒ @miya0001 ʹ࿩͔͚ͯ͠΋Βͬͯ΋େৎ෉Ͱ͢ɻ
  33. ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ