This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/vendor/chi-teck/drupal-code-generator
2018-11-23 12:29:20 +00:00
..
bin Update Composer, update everything 2018-11-23 12:29:20 +00:00
resources Update Composer, update everything 2018-11-23 12:29:20 +00:00
src Update Composer, update everything 2018-11-23 12:29:20 +00:00
templates Update Composer, update everything 2018-11-23 12:29:20 +00:00
composer.json Update Composer, update everything 2018-11-23 12:29:20 +00:00
LICENSE.txt Update Composer, update everything 2018-11-23 12:29:20 +00:00
README.md Update Composer, update everything 2018-11-23 12:29:20 +00:00

Drupal Code Generator

Build Status

A command line code generator for Drupal.

Installation

  1. Download the latest stable release of the code generator.
  2. Make the file executable.
  3. Move it to a directory that is part of your PATH.
release_url=https://api.github.com/repos/chi-teck/drupal-code-generator/releases/latest
wget $(wget -qO- $release_url | awk -F'"' '/browser_download_url/ { print $4 }')
chmod +x dcg.phar
sudo mv dcg.phar /usr/local/bin/dcg
dcg --version

Installation using Composer is also supported.

Upgrade

Simply repeat installation commands.

Usage

# Display main menu.
dcg

# Display Drupal 8 submenu.
dcg d8

# Call generator directly.
dcg d8:plugin:field:widget

# Generate code non interactively.
dcg twig-extension -a '{"name": "Example", "machine_name": "example", "class": "ExampleTwigExtension"}'

Extending

All custom generators should be placed to $HOME/.dcg/Command directory. The following command will help you to get started with creating own generators.

# Create custom DCG command.
dcg dcg-command -d $HOME/.dcg/Command

License

GNU General Public License, version 2 or later.