Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use chain as actual command #1898

Closed
itsdarrylnorris opened this issue Feb 10, 2016 · 20 comments
Closed

Use chain as actual command #1898

itsdarrylnorris opened this issue Feb 10, 2016 · 20 comments

Comments

@itsdarrylnorris
Copy link
Contributor

@itsdarrylnorris itsdarrylnorris commented Feb 10, 2016

Problem / Motivation

We need to add the ability using chain as extension for the DrupalConsole commands. This can be very help to extend the drupal list from the chain commands.

Why ?

This is a nice way to easily integrate DC with other projects without need of writing any code or hacking DC to extend their functionality.

Solution

We can add two extra parameters to define the group and the command.

group-chain: bestgroup
  command: bestcommand
  chain-url: projectname/chain/chain-name.yml

Then in drupal list we are going to be able to see an extention like this

bestgroup
  bestgroup:bestcommand

And the user will be able to type drupal bestgroup:bestcommand and it will simulate this drupal chain --file=~/drupal/modules/projectname/chain/chain-name.yml

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Feb 11, 2016

@darol100 like the idea, is this kinda like drush shell aliases?

@itsdarrylnorris
Copy link
Contributor Author

@itsdarrylnorris itsdarrylnorris commented Feb 11, 2016

I'm not 100% sure if what is exactly you are referring too..

drush shell aliases

But Drush does something very similar, there are many contrib projects that carry drush command which is very handling because extend the functionality of the Drush commands. They have this hook hook_drush_command which allows you to define your own commands.

So the goal of this issue is to be able to write DC commands base of chain pre-config information that can be extend drupal list

@itsdarrylnorris itsdarrylnorris added this to the 0.10.13 milestone Feb 25, 2016
@jmolivas jmolivas removed this from the 0.10.13 milestone Mar 18, 2016
@jmolivas jmolivas added this to the 1.0.0-alpha-1 milestone Mar 18, 2016
@jmolivas jmolivas added this to the 1.0.0-alpha-1 milestone Mar 18, 2016
@jmolivas jmolivas removed this from the 0.10.13 milestone Mar 18, 2016
@jmolivas jmolivas removed this from the 1.0.0-alpha-1 milestone Mar 25, 2016
@jmolivas jmolivas added this to the 1.0.0-beta-1 milestone Mar 25, 2016
@jmolivas jmolivas added this to the 1.0.0-beta-1 milestone Mar 25, 2016
@jmolivas jmolivas removed this from the 1.0.0-alpha-1 milestone Mar 25, 2016
@jmolivas
Copy link
Member

@jmolivas jmolivas commented Mar 26, 2016

Since we already wrote the auto-discovery of chain files on ~/.console/chain/ directory and actually is used on chain:debug command.
drupal-chain-debug

I re-use that discovery feature to added to chain when not --file option is passed by the user.
drupal-chain-interact

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Mar 26, 2016

This is how the execution looks like:
drupal-chain-debug-interact

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Mar 26, 2016

Based on how the current configuration for commands is handled, we can add something like this to the YAML files in order to discover and register them as commands.

  • Discovering YAML file as command:
command:
  name: casper:config
  description: Import casper Manage Form and Manage Display configuration.

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Mar 27, 2016

I merged the discovery feature on the interactive mode PR => #2068

@kenneth-bolivar-castro
Copy link
Contributor

@kenneth-bolivar-castro kenneth-bolivar-castro commented Apr 21, 2016

It's a great improvement, I haven't check how [drupal:chain] is working right now, but it would be lovely if I could add a YAML file with my commands into my root project, then It will be able to be manage by control version, then discovering process gets smart enough to grab it and exposes it as an option while I execute chain command even chain:debug.

Perhaps, if we define another path to discover those commands into D8 installation, or remove "--file" parameter and define it as first argument. does it make sense?
CC: @jmolivas

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Apr 21, 2016

@kenneth-bolivar-castro we got you covered, the chain command search for YAML files at:

  • User home directory ~/.console/chain
  • Site root directory /path/to/d8.dev/console/chain/
  • Module directory
    • /path/to/d8.dev/custom/module_name/console/chain/
    • /path/to/d8.dev/contrib/module_name/console/chain/

@kenneth-bolivar-castro
Copy link
Contributor

@kenneth-bolivar-castro kenneth-bolivar-castro commented Apr 21, 2016

Awesome! @jmolivas Drupal Console rocks! 👍

@kenneth-bolivar-castro
Copy link
Contributor

@kenneth-bolivar-castro kenneth-bolivar-castro commented Apr 21, 2016

@jmolivas I'm running Drupal Console version 0.11.2, I just added "console/chain" folder structure on my root project, also I rebuild all caches, however I can't see YAML file yet, am I missing anything?

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Apr 21, 2016

@kenneth-bolivar-castro Yes try updating to 0.11.3 if you site is 8.0.x or 1.0.0-apha1 if your site is 8.1.x

@kenneth-bolivar-castro
Copy link
Contributor

@kenneth-bolivar-castro kenneth-bolivar-castro commented Apr 21, 2016

@jmolivas looks like it isn't available yet,

$ drupal self-update
Checking for updates from version: 0.11.2
 The latest version 0.11.2, was already installed on your system.

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Apr 21, 2016

@kenneth-bolivar-castro try this instead

$ curl https://github.com/hechoendrupal/DrupalConsole/releases/download/0.11.3/drupal.phar -L -o drupal.phar

@kenneth-bolivar-castro
Copy link
Contributor

@kenneth-bolivar-castro kenneth-bolivar-castro commented Apr 21, 2016

@jmolivas great! thx now it's up and running! 👍

@jmolivas jmolivas removed this from the 1.0.0-beta1 milestone May 5, 2016
@jmolivas jmolivas added this to the 1.0.0-beta2 milestone May 5, 2016
@jmolivas jmolivas added this to the 1.0.0-beta2 milestone May 5, 2016
@jmolivas jmolivas removed this from the 1.0.0-beta1 milestone May 5, 2016
@jmolivas
Copy link
Member

@jmolivas jmolivas commented May 27, 2016

👍 on this feature

@jmolivas jmolivas removed this from the 1.0.0-beta2 milestone Jun 2, 2016
@jmolivas jmolivas added this to the 1.0.0-beta3 milestone Jun 2, 2016
@jmolivas jmolivas added this to the 1.0.0-beta3 milestone Jun 2, 2016
@jmolivas jmolivas removed this from the 1.0.0-beta2 milestone Jun 2, 2016
@novia713
Copy link
Contributor

@novia713 novia713 commented Jun 23, 2016

@darol100 if you're busy these days, i would like to contribute to this issue with some of my (few) time.
my problem is i have no idea on how to accomplish this. if you have some ideas to enlighten this task, please provide them to me. i will try to do my best.

@jmolivas jmolivas removed this from the 1.0.0-beta3 milestone Jun 27, 2016
@jmolivas jmolivas added this to the 1.0.0-beta4 milestone Jun 27, 2016
@jmolivas jmolivas added this to the 1.0.0-beta4 milestone Jun 27, 2016
@jmolivas jmolivas removed this from the 1.0.0-beta3 milestone Jun 27, 2016
@jmolivas jmolivas removed this from the 1.0.0-beta4 milestone Jul 14, 2016
@jmolivas jmolivas added this to the 1.0.0 milestone Jul 14, 2016
@jmolivas jmolivas added this to the 1.0.0 milestone Jul 14, 2016
@jmolivas jmolivas removed this from the 1.0.0-beta4 milestone Jul 14, 2016
@jmolivas
Copy link
Member

@jmolivas jmolivas commented Nov 16, 2016

This PR #2953 from @marcelovani address this.

@jmolivas
Copy link
Member

@jmolivas jmolivas commented Dec 2, 2016

Completed with this other PRs
hechoendrupal/drupal-console-core#97
#2989
#2990

To make a chain file automatically registered as command this new block of meta-data should be added on to the file.

command:
  name: site:setup
  description: Setup site

Complete file

command:
  name: site:setup
  description: Setup site
commands:
  - command: site:install
    arguments:
      profile: standard
    options:
      force: true
      no-interaction: true
  - command: cache:rebuild
    arguments:
      cache: all

@jmolivas jmolivas closed this Dec 2, 2016
@jmolivas
Copy link
Member

@jmolivas jmolivas commented Dec 2, 2016

@itsdarrylnorris
Copy link
Contributor Author

@itsdarrylnorris itsdarrylnorris commented Dec 2, 2016

w00T... Good work guys...

@jmolivas jmolivas added this to the 1.0.0-rc11 milestone Dec 2, 2016
@jmolivas jmolivas removed this from the 1.0.0 milestone Dec 2, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants