Faster and Smarter Development with Drupal Console

  • Published on
    14-Apr-2017

  • View
    425

  • Download
    2

Transcript

  • FasterandSmarterDevelopmentwithDrupal

    Console

  • JesusManuelOlivas

    Drupal8SolutionsEngineer|

    IworkforFFW(andyoushouldtoo)

    Aboutme

    @jmolivas @drupalconsole@drupodcast

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

  • WhatistheDrupalConsole?

    Itisasuiteoftoolsthatyourunonacommandlineinterface(CLI)togenerate

    boilerplatecodeandinteractwithaDrupal8installation.

  • 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?

  • Topics

    WheretofindandhowtoDownloadDrupalConsole

    Generatecode/filesrequiredbyaDrupal8module.

    InteractwithyourDrupal8installation.

    LearnDrupal8.

    Writeanintegration.

    Automatecommandexecution.

    Remotecommandexecution.

    ContributetotheprojectandRoadmap.

  • 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

    InstalltheConsolelocallybyrunningtheinstallerinyourprojectdirectory:

    $ curl http://drupalconsole.com/installer | php

    $ mv console.phar /usr/local/bin/drupal

    $ drupal

  • UsingComposer

    $ composer global require drupal/console:@stable

    # download at: # ~/.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

    DrupalVM

    AVMforlocalDrupaldevelopment

    Drupal8SprintBox

    SimpleDrupal8DevelopmentEnvironment

    http://www.drupalvm.com/

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

    http://www.drupalvm.com/https://github.com/thom8/drupal8-vagrant

  • Updatingtheproject

    Dependingonthedownloadmethod:

    $ drupal self-update

    $ console self-update

    $ php console.phar self-update

  • Copycon guration les

    $ drupal init

    # ~/.console/config.yml# ~/.console/chain/sample.yml

  • Generatethecodeand lesrequiredbyaDrupal8module.

  • generate:module

  • generate:controller

  • generate:form:con g

  • example.routing.yml

  • src/Form/ExampleForm.php

  • src/Form/ExampleForm.php

  • src/Form/ExampleForm.php

  • generate:plugin:block

    $ drupal generate:plugin:block --module="example" --class-name="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

  • Othergenerators

    generate:authentication:provider generate:entity:config generate:event:subscriber generate:permissions generate:plugin:field generate:plugin:fieldformatter generate:plugin:fieldtype generate:plugin:fieldwidget generate:plugin:imageeffect generate:plugin:rest:resource generate:plugin:rulesaction generate:plugin:type:annotation generate:plugin:type:yaml generate:service generate:theme

  • InteractwithyourDrupalinstallation.

  • site:new

  • site:install

  • container:debug

  • router:debug

  • router:debug

  • site:mode

  • 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-name="ExampleController" --method-name="hello" --route="/hello/{name}" --learning --no-interaction

  • Writeanintegration

  • generate:command

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

  • webpro ler

    https://www.drupal.org/project/webpro ler

    https://www.drupal.org/project/webprofiler

  • webpro ler:benchmark

  • webpro ler

    webprofiler:benchmark webprofiler:export webprofiler:list

  • Automatecommandexecution

  • chain

    $ drupal chain --file=~/path/to/start-project.yml

  • Remotecommandexecution

  • site:debug

    $ drupal site:debug

    $ drupal site:debug sample.dev

    # Sites configuration files at:# ~/.console/sites/

  • --target

    $ drupal --target=sample.dev c:r all

  • Tips

  • #Protip1Use--rootoption

    $ drupal --root=/var/www/drupal8.dev

  • #Protip2Usemultilanguagefeature

    # ~/.console/config.yml

    application: environment: 'prod' language: en #available: en,es,fr,hu,pt,ro editor: vim temp: /tmp

  • #Protip3Usedefaultvalues

    # ~/.console/config.ymlapplication:

    ...

    default: commands: generate: controller: options: module: my_current_project

  • #Protip4Disablecontributedcommands

    # ~/.console/config.ymlapplication:

    ...

    disable: modules: - broken_module_name_one - broken_module_name_two

  • #Protip5Usecommandalias

    $ drupal cache:rebuild all

    $ drupal c:r all

  • #Protip6Use--helpoption

    $ drupal generate:module --help

  • #Protip7Use--generate-inline

    $ drupal generate:entity:config --generate-inline

  • #Protip8Use--generate-chain

    $ drupal generate:module --generate-chain

  • #Protip9Use--generate-doc

    $ drupal webprofiler:benchmark --generate-doc

  • #Protip10Usepecocommand

    $ drupal router:debug | peco | awk -F ' ' '{print $1}' | xargs drupal router:debug

    https://github.com/peco/peco

    https://github.com/peco/peco

  • Howtocontribute?

  • Gettingtheproject

    ForkyourowncopyoftheConsolerepository

    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

  • Codeanalysis

    http://bit.ly/console-insight

    http://bit.ly/console-travis

    http://bit.ly/console-insighthttp://bit.ly/console-travis

  • PHPQAall-in-oneAnalyzerCLItool

    PHPParallelLint

    PHP_CodeSniffer

    PHPLOC

    PHPMessDetector

    PHPUnit

    https://github.com/jmolivas/phpqa

    https://github.com/jmolivas/phpqa

  • RunningPHPQAmanually

    $ cd /path/to/DrupalConsole$ phpqa analyze --files=src/

    RunningPHPQAautomatically

    $ vim .git/hooks/pre-commit# Paste this:phpqa analyze --git

  • jmolivas dmouse enzolutions omero danielnv18 vacho esod cordoval Sutharsan chipkaye hugronaphor

    kgaut webflo czettnersandor fluxsauce greg-1-anderson lucasmingarro Crell martinfrances107 bojanz danielrose28

    MiguelC301 azarzag Jaesin rpayanm iadyax alexweber mimioc revagomes Chi-teck egulias heilop

    LowellMontgomery mmenavas sethfischer emacoti jeqq benjy carlosroh edutrul albertvolkman jjcarrion dasjo

    joshuataylor kendallsv kostajh lussoluca stevector ysramirez brantwynn langelhc

    Contributors

    https://github.com/jmolivashttps://github.com/dmousehttps://github.com/enzolutionshttps://github.com/omerohttps://github.com/danielnv18https://github.com/vachohttps://github.com/esodhttps://github.com/cordovalhttps://github.com/Sutharsanhttps://github.com/chipkayehttps://github.com/hugronaphorhttps://github.com/kgauthttps://github.com/webflohttps://github.com/czettnersandorhttps://github.com/fluxsaucehttps://github.com/greg-1-andersonhttps://github.com/lucasmingarrohttps://github.com/Crellhttps://github.com/martinfrances107https://github.com/bojanzhttps://github.com/danielrose28https://github.com/MiguelC301https://github.com/azarzaghttps://github.com/Jaesinhttps://github.com/rpayanmhttps://github.com/iadyaxhttps://github.com/alexweberhttps://github.com/mimiochttps://github.com/revagomeshttps://github.com/Chi-teckhttps://github.com/eguliashttps://github.com/heilophttps://github.com/LowellMontgomeryhttps://github.com/mmenavashttps://github.com/sethfischerhttps://github.com/emacotihttps://github.com/jeqqhttps://github.com/benjyhttps://github.com/carlosrohhttps://github.com/edutrulhttps://github.com/albertvolkmanhttps://github.com/jjcarrionhttps://github.com/dasjohttps://github.com/joshuataylorhttps://github.com/kendallsvhttps://github.com/kostajhhttps://github.com/lussolucahttps://github.com/stevectorhttps://github.com/ysramirezhttps://github.com/brantwynnhttps://github.com/langelhc

  • Spreadthewordandlove.

    @drupalconsole|#drupalconsole

    /~drupalconsole

    https://gratipay.com/~drupalconsole/

  • Roadmap

  • Increasecodecoverage.

    Multi-sitesupport.

    Improvedocumentationandtranslations.

    Improveverbosecode-output.

    Dummycontentgeneration.

  • Milestones

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

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

  • Upcommingimplementations

    Metatag

    Rules

    [Yourmodulehere]

  • Let'sworktogethertomake

    awesometoolsevenbetter.

  • Drushintegration

    https://github.com/drush-ops/drush/pull/1337

    https://github.com/drush-ops/drush/pull/1337

  • Onemorething...

  • GUIfortheCLI.

  • http://drupalgenerator.com/

    http://drupalgenerator.com/

  • Questions&Feedback

    Feelfreetostalkmeoraskanyquestionat:

    @jmolivas|@drupalconsole

Recommended

View more >