Skip to content

Boilerplate tempate(s?) idea #256

@artfulrobot

Description

@artfulrobot

(Sorry, I'm in an ideas mood today after returning from Exeter sprint yesterday!)

Several civix jobs are boilerplate creating jobs. May we add to those via hooks implemented in extensions, for example?

Use case:

I'm seeing a lot of interest recently about Inlay. Creating a new inlay is pretty simple - I was able to demo it in 15 mins. But there is some boilerplate.

It struck me that if I could implement civix generate:inlay "Name of Inlay type" [OptionalShorterCodeName] it would be good for onboarding devs. Running that command would:

  • call civix generate:angular-module
  • call civix generate:angular-page x y
  • edit the ang/* files to insert some boilerplate tweaks.
  • create a Civi\Inlay\NameOfType.php class
  • somehow implement the required hook (currently I do this in hook_container, but I'd like to use HookInterface on the \Civi\Inlay\NameOfType class instead once I get it to work.
  • report the files created.
  • run a flush

I could see two options for implementation

  1. I just do a PR here to ask to add this command to civix. You might feel that you don't want a pure-core tool polluted with pesky extensions' dirty work!
  2. civix supports plugins, scans installed extensions to find classes implementing Civix\Plugin or such.
  3. (a non-option): don't implement this with civix; just provide a cli/create-inlay.php script in the Inlay extension that does the work. This feels like duplicating logic though.
  4. (another non-option): don't implement this with civix; just provide typical boilerplate code in the Inlay extension, e.g. under boilerplate/ and then give devs clear instructions.

I'm not sure how generic a requirement this is; perhaps inlay is a special case. Obviously this is not a high priority issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions