Mercurial > hg > cmmr2012-drupal-site
annotate vendor/chi-teck/drupal-code-generator/README.md @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
rev | line source |
---|---|
Chris@0 | 1 # Drupal Code Generator |
Chris@0 | 2 |
Chris@0 | 3 [](https://travis-ci.org/Chi-teck/drupal-code-generator) |
Chris@0 | 4 |
Chris@0 | 5 A command line code generator for Drupal. |
Chris@0 | 6 |
Chris@0 | 7 ## Installation |
Chris@0 | 8 |
Chris@0 | 9 1. Download the latest [stable release](https://github.com/Chi-teck/drupal-code-generator/releases/latest) of the code generator. |
Chris@0 | 10 2. Make the file executable. |
Chris@0 | 11 3. Move it to a directory that is part of your `PATH`. |
Chris@0 | 12 |
Chris@0 | 13 ```shell |
Chris@0 | 14 release_url=https://api.github.com/repos/chi-teck/drupal-code-generator/releases/latest |
Chris@0 | 15 wget $(wget -qO- $release_url | awk -F'"' '/browser_download_url/ { print $4 }') |
Chris@0 | 16 chmod +x dcg.phar |
Chris@0 | 17 sudo mv dcg.phar /usr/local/bin/dcg |
Chris@0 | 18 dcg --version |
Chris@0 | 19 ``` |
Chris@0 | 20 Installation using Composer is also supported. |
Chris@0 | 21 |
Chris@0 | 22 ## Upgrade |
Chris@0 | 23 Simply repeat installation commands. |
Chris@0 | 24 |
Chris@0 | 25 ## Usage |
Chris@0 | 26 ```shell |
Chris@0 | 27 # Display main menu. |
Chris@0 | 28 dcg |
Chris@0 | 29 |
Chris@0 | 30 # Display Drupal 8 submenu. |
Chris@0 | 31 dcg d8 |
Chris@0 | 32 |
Chris@0 | 33 # Call generator directly. |
Chris@0 | 34 dcg d8:plugin:field:widget |
Chris@0 | 35 |
Chris@0 | 36 # Generate code non interactively. |
Chris@0 | 37 dcg twig-extension -a '{"name": "Example", "machine_name": "example", "class": "ExampleTwigExtension"}' |
Chris@0 | 38 ``` |
Chris@0 | 39 ## Extending |
Chris@0 | 40 All custom generators should be placed to _$HOME/.dcg/Command_ directory. The following command will help you to get started with creating own generators. |
Chris@0 | 41 ```bash |
Chris@0 | 42 # Create custom DCG command. |
Chris@0 | 43 dcg dcg-command -d $HOME/.dcg/Command |
Chris@0 | 44 ``` |
Chris@0 | 45 ## License |
Chris@0 | 46 GNU General Public License, version 2 or later. |