hechoendrupal / drupal-console

The Drupal CLI. A tool to generate boilerplate code, interact with and debug Drupal.
http://drupalconsole.com
GNU General Public License v2.0
939 stars 560 forks source link

[console] Add support for project configuration files #2725

Open gergelypap opened 7 years ago

gergelypap commented 7 years ago

Drupal Console should have support for per-project configuration, similar to Drush. This could be handy for setting up things related to specific project, instead of using the global ~/.console settings.

Solution

Proposal for settings

A .drushrc should allow settings of at least the following things:

(See full featured examples of drushrc.php)

What do you guys think?

jmolivas commented 7 years ago

@gergelypap This currently supported already and will be improved on RC-1.

Actual places where DrupalConsole, search for configurations

Starting on RC-1

drupal-not-installed

drupal-no-config

drupal-init-1

drupal-init-2

jmolivas commented 7 years ago

@gagarine Already fixed on RC-1

Per site or global values for:

This is an example of a config file on a site I am currently working on (we using DC master branch not beta-5)

application:
    environment: prod
    language: en
    editor: vim
    temp: /tmp
    develop: 'false'
    command: about
    checked: 'true'
    remote:
        user: root
        port: '22'
        console: /usr/local/bin/drupal
        keys:
            public: ~/.ssh/id_rsa.pub
            private: ~/.ssh/id_rsa
            passphrase: ~/.ssh/passphrase.txt
    disable:
        modules:
          - metatag
        commands: {}
        namespaces: {}
    options:
        learning: false
        examples: false
        generate-inline: false
        generate-chain: false
        composer: false
        root: docroot
jmolivas commented 7 years ago

We also have some chains files we use to install modules, and fill the site with dummy data after every rebuild.

/path/to/site/console/chain/after-build.yml

commands:
  - command: module:install
    options:
        root: docroot
        latest: true
    arguments:
        module:
            - features_ui
            - views_ui
  - command: create:terms
    options:
        root: docroot
        limit: 50
  - command: create:nodes
    options:
        limit: 50
        time-range: 604800
        root: docroot
    arguments:
        content-types:
            - blog_post
            - news_detail
            - video_detail
gergelypap commented 7 years ago

Wow... :open_mouth: Now this is great news, thanks for pointing it out. I have searched in the source, but found nothing.

Then the only thing we really should improve on, is the project documentation :wink:

jmolivas commented 7 years ago

@gergelypap RC-4 was released and this si supported now.

Next step add to the docs.

nvaken commented 7 years ago

Not entirely sure what this means. I'm searching for a possibility to add yml project-specific for a project. So ideally, I would like to add targets into a file in /path/to/composer/project-folder/console/, reading above, I'm having the feeling that this should somehow be possible?

Additionally, I see the flag --composer mentioned to define if it's a composer project, I have not yet found where this flag is being defined. Could you elaborate? Thanks!

jmolivas commented 7 years ago

@nvaken when you mentioned /path/to/composer/project-folder/console/ it does mean the path where drupal was downloaded ?

The --composeris no longer valid as global option.

nvaken commented 7 years ago

Hi @jmolivas, thanks for your quick reply. I meant a composer directory, like:

/path/to/composer/project-folder/console/
/path/to/composer/project-folder/composer.json
/path/to/composer/project-folder/web/[Drupal Install]

A few ago I managed to get this working, it seems that it does indeed work, without configuration. I only needed to create a console/sites folder to add the .yml files to.