Drupal Console Deep Dive: How to Develop Faster and Smarter on Drupal 8

  • Published on
    15-Apr-2017

  • View
    638

  • Download
    0

Transcript

  • DrupalConsoleDeepDive

    @drupalconsole|#drupalconsole

  • JesusManuelOlivas

    Drupal8SolutionsEngineer|

    IworkforFFW(andyoushouldtoo)

    Aboutme

    @jmolivas @drupalconsole@drupodcast

    http://twitter.com/jmolivashttp://twitter.com/drupalconsolehttp://twitter.com/drupodcast

  • Topics

    DrupalConsolethewhat,whyandhow.

    Generatecode/filesrequiredbyaDrupal8module.

    InteractandDebugDrupal8.

    LearnDrupal8.

    Writeanintegration.

    Automatecommandexecution.

    Remotecommandexecution.

    ContributetotheprojectandRoadmap.

  • WhatistheDrupalConsole?

    ThenewCLIforDrupal.

    TheDrupalConsoleisatooltogenerateboilerplatecode,interactanddebugDrupal8.

  • DavidFlores |@dmouse

    EduardoGarca|@enzolutions

    JessManuelOlivas|@jmolivas

    OmarAguirre|@omers

    Whomaintainthisproject?

  • Supportingorganizations

    http://www.ffw.co/http://www.indava.com/http://www.anexusit.com/

  • Whyshouldyoucareaboutit?

  • Drupalismoretehcnicallyadvanced

  • HowdoesDrupalConsolehelp?

    GenerateboilerplatecodeforDrupal8.

    InteractanddebugDrupal8.

    LearnDrupal8.

  • Wheredoyou ndtheproject?

    LandingPage

    Documentation

    Support

    http://drupalconsole.com/

    http://bit.ly/console-book

    http://bit.ly/console-support

    http://drupalconsole.com/http://bit.ly/console-bookhttp://bit.ly/console-support

  • DownloadDrupalConsole

  • Usingtheinstaller

    # Run this in your terminal to get the latest project version:curl https://drupalconsole.com/installer -L -o drupal.phar

    # Accessing from anywhere on your system:mv drupal.phar /usr/local/bin/drupal

    # Apply executable permissions on the downloaded file:chmod +x /usr/local/bin/drupal

    # Copy configuration files to user home directory:drupal init --override

    # Check and validate system requirementsdrupal check

  • UsingComposer

    $ composer global require drupal/console:@stable

    # download path:# ~/.composer/vendor/drupal/console

    # run it using:$ ~/.composer/vendor/bin/console

    Gitbook-UsingComposer

    http://hechoendrupal.gitbooks.io/drupal-console/content/using/composer.html

  • UsingDrupalComposer

    $ composer create-project drupal-composer/drupal-project:8.x-dev drupal8.dev --stability dev --no-interaction

    https://github.com/drupal-composer/drupal-project

    https://github.com/drupal-composer/drupal-project

  • UsingaVirtualMachine/Container

    DrupalVM

    Drupal8SprintBox

    DrupaldevelopmentwithDocker

    Drude(DrupalDockerEnvironment)

    http://www.drupalvm.com/

    https://github.com/thom8/drupal8-vagrant

    https://github.com/wadmiraal/docker-drupal

    https://github.com/blinkreaction/drude

    http://www.drupalvm.com/https://github.com/thom8/drupal8-vagranthttps://github.com/wadmiraal/docker-drupalhttps://github.com/blinkreaction/drude

  • Updatingtheproject

    $ drupal self-update

    $ php console.phar self-update

    $ composer global update drupal/console

  • Copycon guration lesdrupalinit

  • Validatesystemrequirementsdrupalcheck

  • site:new

  • site:install

  • chain

  • chainchain--file=~/.console/chain/quick-start.yml

  • ~/.console/chain/quick-start.yml

    drupalchain--file=~/.console/chain/quick-start-mysql.yml

  • ExecuteDrupalConsole

    # change directory to site path$ cd /var/www/drupal8.dev$ drupal

    # use --root option$ drupal --root=/var/www/drupal8.dev

  • Generatethecodeand lesrequiredbyaDrupal8module.

  • Creatingamodule

    Createanewdirectorynamed'example'at'modules/custom'directory.

    Createan'example.info.yml'fileat'modules/custom/example'directory.

    Customandcontributedmodulesmustbecreatedatmodulesfolderintherootdirectory.

  • generate:module

  • CreatingaCustomPage

    Createa'HelloController'Classwitha'hello'methodat'src/Controller'Directory.

    Createaroutewithpathto'/hello/{name}'at'example.routing.yml'file.

    MakesureyourHelloControllerclassextendsfromControllerBasecoreclass.

  • generate:controller

  • CreatingaCon gForm

    Createa'ExampleForm.php'classat'src/Form'Directory.

    Createaroutewithpathto'/admin/config/example/example'at'example.routing.yml'.

    Addexample.links.menu.ymlfileandsetsystem.admin_config_systemasparent.

    Makesureyouuse_forminsteadof_controlleronroutedefaults.

  • generate:form:con g

  • example.routing.yml

  • src/Form/ExampleForm.php

  • src/Form/ExampleForm.php

  • src/Form/ExampleForm.php

  • CreatingaBlock(Plugin)

    Createa'ExampleBlock'classat'src/Plugin/Block'.

    ExtendfromBlockBasecoreclass.

    Add@Blockannotation.

    AddblockForm,blockSubmitandbuildmethods.

    Addingthe@Blockannotation,makethisblockdiscoverablebythesystem.

  • generate:plugin:block

    $ drupal generate:plugin:block --module="example" --class="ExampleBlock" --label="example_block" --plugin-id="example_block" --no-interaction

  • generate:entity:content

    $ drupal generate:entity:content --module="example" --entity-class="Foo" --entity-name="foo" --no-interaction

  • InteractanddebugDrupal8.

  • drupalcontainer:debug

  • container:debug

    drupalcontainer:debug|peco

  • drupalrouter:debugdrupalrouter:debug|peco|awk'{print$1}'|xargsdrupalrouter:debug

  • drupalrouter:debuguser.login

  • drupalsite:modedev[1/2]

  • Performance/admin/config/development/performance

  • Viewssettings/admin/structure/views/view/content

  • Logginganderrors/admin/config/development/logging

  • drupalsite:modedev[2/2]

  • Twigdebug

  • drupaldatabase:log:debug--reverse--limit=20

  • drupaldatabase:log:debug828

  • site

    site site:maintenance [ON/OFF] site:status

  • con g

    config config:debug config:edit config:export config:export:content:type config:export:single config:export:view config:import config:import:single config:override

  • user

    user user:login:clear:attempts user:login:url user:password:hash user:password:reset

  • LearnDrupal8.

  • Use--learningoption

    $ drupal generate:controller --module="example" --class="ExampleController" --routes="title:hello method:hello path:/hello/{name}" --test --no-interaction --learning

  • Writeanintegration

  • generate:command

    $ drupal generate:command --module="example" --class-name="HelloCommand" --command="example:hello" --no-interaction

  • Remotecommandexecution

  • Globalcon guration~/.console/config.yml

    application:

    ...

    remote: user: root port: 22 console: /usr/local/bin/drupal keys: public: ~/.ssh/id_rsa.pub private: ~/.ssh/id_rsa passphrase: ~/.ssh/passphrase.txt

  • Sitecon guration~/.console/sites/sample.yml

    local: root: /var/www/drupal8.dev host: localdev: root: /var/www/html/drupal host: 140.211.10.62 user: drupalprod: root: /var/www/html/docroot host: live.drupal.org user: drupal console: /var/www/html/docroot/console.phar

  • site:debug

  • site:debugsample.dev

  • --target||@

    $ drupal --target=sample.dev cr all

    $ drupal @sample.dev cr all

  • Remotesiteexecution

  • Howtocontribute?

  • GettingtheprojectForkyourowncopyoftheConsolerepository

    Cloneyourforkedrepository.

    $ git clone git@github.com:[github-user]/DrupalConsole.git

    Downloaddependenciesusingcomponser.

    $ cd /path/to/DrupalConsole$ composer install

    http://bit.ly/console-fork

    http://bit.ly/console-fork

  • Beforecommitingyourcode

    ProjectcodeisPSR-2CodingStyle.

    GeneratedcodeisDrupalCodingStyle.

    http://www.php-fig.org/psr/psr-2/

    https://www.drupal.org/coding-standards

    http://www.php-fig.org/psr/psr-2/https://www.drupal.org/coding-standards

  • Contributors

    https://drupalconsole.com/contributors

    https://github.com/jmolivashttps://github.com/enzolutionshttps://github.com/dmousehttps://github.com/omerohttps://github.com/novia713https://github.com/kgauthttps://github.com/raileanuanielahttps://github.com/ranqiangjunhttps://github.com/DmitryDrozdikhttps://github.com/blasolivahttps://github.com/blauerberghttps://github.com/BenSF93https://github.com/jatempahttps://github.com/dalguetehttps://github.com/danielnv18https://github.com/Sutharsanhttps://github.com/vachohttps://github.com/mnicohttps://github.com/dkgndechttps://github.com/esodhttps://github.com/darol100https://github.com/durgeshshttps://github.com/cordovalhttps://github.com/acbramleyhttps://github.com/alxvallejohttps://github.com/manuelerhttps://github.com/tstoecklerhttps://github.com/karmazzinhttps://github.com/rmelikehttps://github.com/alex-arriagahttps://github.com/pfrenssenhttps://github.com/balagan73https://github.com/wuinfohttps://github.com/webflohttps://github.com/dinarconhttps://github.com/vmartinswebhttps://github.com/FatherShawnhttps://github.com/fregahttps://github.com/Cobra0107https://github.com/Ashwini7https://github.com/subhojit777https://github.com/hugronaphorhttps://github.com/chipkayehttps://github.com/Prabhurajnhttps://github.com/mdrummondhttps://github.com/webtommehttps://github.com/martinfrances107https://github.com/ericpughhttps://github.com/eiriksmhttps://github.com/greg-1-andersonhttps://github.com/1mdarwinhttps://github.com/kenneth-bolivar-castrohttps://github.com/bojanzhttps://github.com/czettnersandorhttps://github.com/lucasmingarrohttps://github.com/fluxsaucehttps://github.com/Jaesinhttps://github.com/gauravjeethttps://github.com/neelam-chaudharyhttps://github.com/Crellhttps://github.com/joshuataylorhttps://github.com/opdavieshttps://github.com/favrikhttps://github.com/MiguelC301https://github.com/Eyal-Shalevhttps://github.com/rpayanmhttps://github.com/danielrose28https://github.com/drupalicushttps://github.com/maramailhttps://github.com/smalothttps://github.com/jjcarrionhttps://github.com/azarzaghttps://github.com/iadyaxhttps://github.com/gnugethttps://github.com/killua99https://github.com/mmenavashttps://github.com/miguel303https://github.com/ardnethttps://github.com/yobottehghttps://github.com/revagomeshttps://github.com/charliewebhttps://github.com/chris-hamperhttps://github.com/mimiochttps://github.com/alexweberhttps://github.com/lnunesbrhttps://github.com/eleagahttps://github.com/kepfordhttps://github.com/rocketeerbkwhttps://github.com/Chi-teckhttps://github.com/chuonglehttps://github.com/daceveshttps://github.com/eguliashttps://github.com/edutrulhttps://github.com/codexmashttps://github.com/heilophttps://github.com/skyredhttps://github.com/zviryatkohttps://github.com/LowellMontgomeryhttps://github.com/lucowebhttps://github.com/Cottserhttps://drupalconsole.com/contributors

  • Spreadthewordandlove.

    @drupalconsole|#drupalconsole

  • Roadmap

  • Increasecodecoverage.

    Improvedocumentationandtranslations.

    Improveverbosecode-output.(--learning)

    Improveautomatecapabilities.(chain)

  • Milestones

    https://github.com/hechoendrupal/DrupalConsole/milestones

    https://github.com/hechoendrupal/DrupalConsole/milestones

  • Currentandupcommingimplementations

    Webpro ler(develsubmodule)

    Metatag

    DrupalCommerce

    ScheduledUpdates

    Rules

    Casper(theme)

    Liberty(theme)

  • Whatif...IamnotaCLIguru

  • GUIfortheCLI.

    Desktop/Nativeapplicationusing

    Electron

    ReactJS

    ES6

  • Questions&Feedback

    Feelfreetostalkmeoraskanyquestionat:

    @jmolivas|@drupalconsole

Recommended

View more >