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

  • Published on
    21-Feb-2017

  • View
    264

  • Download
    0

Transcript

DrupalConsoleDeepDive@drupalconsole|#drupalconsoleJesusManuelOlivasDrupal8SolutionsEngineer|IworkforFFW(andyoushouldtoo)Aboutme@jmolivas @drupalconsole@drupodcasthttp://twitter.com/jmolivashttp://twitter.com/drupalconsolehttp://twitter.com/drupodcastTopicsDrupalConsolethewhat,whyandhow.Generatecode/filesrequiredbyaDrupal8module.InteractandDebugDrupal8.LearnDrupal8.Writeanintegration.Automatecommandexecution.Remotecommandexecution.ContributetotheprojectandRoadmap.WhatistheDrupalConsole?ThenewCLIforDrupal.TheDrupalConsoleisatooltogenerateboilerplatecode,interactanddebugDrupal8.DavidFlores |@dmouseEduardoGarca|@enzolutionsJessManuelOlivas|@jmolivasOmarAguirre|@omersWhomaintainthisproject?Supportingorganizationshttp://www.ffw.co/http://www.indava.com/http://www.anexusit.com/Whyshouldyoucareaboutit?DrupalismoretehcnicallyadvancedHowdoesDrupalConsolehelp?GenerateboilerplatecodeforDrupal8.InteractanddebugDrupal8.LearnDrupal8.Wheredoyou ndtheproject?LandingPageDocumentationSupporthttp://drupalconsole.com/http://bit.ly/console-bookhttp://bit.ly/console-supporthttp://drupalconsole.com/http://bit.ly/console-bookhttp://bit.ly/console-supportDownloadDrupalConsoleUsingtheinstaller# 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 checkUsingComposer$ composer global require drupal/console:@stable# download path:# ~/.composer/vendor/drupal/console# run it using:$ ~/.composer/vendor/bin/consoleGitbook-UsingComposerhttp://hechoendrupal.gitbooks.io/drupal-console/content/using/composer.htmlUsingDrupalComposer$ composer create-project drupal-composer/drupal-project:8.x-dev drupal8.dev --stability dev --no-interactionhttps://github.com/drupal-composer/drupal-projecthttps://github.com/drupal-composer/drupal-projectUsingaVirtualMachine/ContainerDrupalVMDrupal8SprintBoxDrupaldevelopmentwithDockerDrude(DrupalDockerEnvironment)http://www.drupalvm.com/https://github.com/thom8/drupal8-vagranthttps://github.com/wadmiraal/docker-drupalhttps://github.com/blinkreaction/drudehttp://www.drupalvm.com/https://github.com/thom8/drupal8-vagranthttps://github.com/wadmiraal/docker-drupalhttps://github.com/blinkreaction/drudeUpdatingtheproject$ drupal self-update$ php console.phar self-update$ composer global update drupal/consoleCopycon guration lesdrupalinitValidatesystemrequirementsdrupalchecksite:newsite:installchainchainchain--file=~/.console/chain/quick-start.yml~/.console/chain/quick-start.ymldrupalchain--file=~/.console/chain/quick-start-mysql.ymlExecuteDrupalConsole# change directory to site path$ cd /var/www/drupal8.dev$ drupal# use --root option$ drupal --root=/var/www/drupal8.devGeneratethecodeand lesrequiredbyaDrupal8module.CreatingamoduleCreateanewdirectorynamed'example'at'modules/custom'directory.Createan'example.info.yml'fileat'modules/custom/example'directory.Customandcontributedmodulesmustbecreatedatmodulesfolderintherootdirectory.generate:moduleCreatingaCustomPageCreatea'HelloController'Classwitha'hello'methodat'src/Controller'Directory.Createaroutewithpathto'/hello/{name}'at'example.routing.yml'file.MakesureyourHelloControllerclassextendsfromControllerBasecoreclass.generate:controllerCreatingaCon gFormCreatea'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 gexample.routing.ymlsrc/Form/ExampleForm.phpsrc/Form/ExampleForm.phpsrc/Form/ExampleForm.phpCreatingaBlock(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-interactiongenerate:entity:content$ drupal generate:entity:content --module="example" --entity-class="Foo" --entity-name="foo" --no-interactionInteractanddebugDrupal8.drupalcontainer:debugcontainer:debugdrupalcontainer:debug|pecodrupalrouter:debugdrupalrouter:debug|peco|awk'{print$1}'|xargsdrupalrouter:debugdrupalrouter:debuguser.logindrupalsite:modedev[1/2]Performance/admin/config/development/performanceViewssettings/admin/structure/views/view/contentLogginganderrors/admin/config/development/loggingdrupalsite:modedev[2/2]Twigdebugdrupaldatabase:log:debug--reverse--limit=20drupaldatabase:log:debug828sitesite site:maintenance [ON/OFF] site:statuscon gconfig config:debug config:edit config:export config:export:content:type config:export:single config:export:view config:import config:import:single config:overrideuseruser user:login:clear:attempts user:login:url user:password:hash user:password:resetLearnDrupal8.Use--learningoption$ drupal generate:controller --module="example" --class="ExampleController" --routes="title:hello method:hello path:/hello/{name}" --test --no-interaction --learningWriteanintegrationgenerate:command$ drupal generate:command --module="example" --class-name="HelloCommand" --command="example:hello" --no-interactionRemotecommandexecutionGlobalcon guration~/.console/config.ymlapplication: ... remote: user: root port: 22 console: /usr/local/bin/drupal keys: public: ~/.ssh/id_rsa.pub private: ~/.ssh/id_rsa passphrase: ~/.ssh/passphrase.txtSitecon guration~/.console/sites/sample.ymllocal: 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.pharsite:debugsite:debugsample.dev--target||@$ drupal --target=sample.dev cr all$ drupal @sample.dev cr allRemotesiteexecutionHowtocontribute?GettingtheprojectForkyourowncopyoftheConsolerepositoryCloneyourforkedrepository.$ git clone git@github.com:[github-user]/DrupalConsole.gitDownloaddependenciesusingcomponser.$ cd /path/to/DrupalConsole$ composer installhttp://bit.ly/console-forkhttp://bit.ly/console-forkBeforecommitingyourcodeProjectcodeisPSR-2CodingStyle.GeneratedcodeisDrupalCodingStyle.http://www.php-fig.org/psr/psr-2/https://www.drupal.org/coding-standardshttp://www.php-fig.org/psr/psr-2/https://www.drupal.org/coding-standardsContributorshttps://drupalconsole.com/contributorshttps://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/contributorsSpreadthewordandlove.@drupalconsole|#drupalconsoleRoadmapIncreasecodecoverage.Improvedocumentationandtranslations.Improveverbosecode-output.(--learning)Improveautomatecapabilities.(chain)Milestoneshttps://github.com/hechoendrupal/DrupalConsole/milestoneshttps://github.com/hechoendrupal/DrupalConsole/milestonesCurrentandupcommingimplementationsWebpro ler(develsubmodule)MetatagDrupalCommerceScheduledUpdatesRulesCasper(theme)Liberty(theme)Whatif...IamnotaCLIguruGUIfortheCLI.Desktop/NativeapplicationusingElectronReactJSES6Questions&FeedbackFeelfreetostalkmeoraskanyquestionat:@jmolivas|@drupalconsole

Recommended

View more >