2017 © Pedro Peláez
 

drupal-module drupal-usync

Drupal features-like configuration file driven synchronization module

image

makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  • Monday, April 23, 2018
  • by pounard
  • Repository
  • 19 Watchers
  • 2 Stars
  • 562 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 4 Open issues
  • 22 Versions
  • 6 % Grown

The README.md

µSync

Minimal yet powerfull config file based features-like toolkit for Drupal 7., (*1)

How does it work

It works by building a fully featured AST composed of typed nodes representing your configuration file, then browsing the tree and executing code over it., (*2)

Getting started

Create a sample module

Let's assume you are working on a custom blog module:, (*3)

sites/all/modules/myblog/
    myblog.module
    myblog.info
    myblog.yml

Contents of the myblog.info file:, (*4)

name = My blog feature
description = Very simple blog feature for my site.
core = 7.x
usync[] = myblog.yml

Contents of the myblog.yml file:, (*5)

field:
  blog_image:
    label: Post photo
    type: image

entity:
  blog_post:
    blog:
      name: Blog post
      field:
        blog_image: true
        body: true

view:
  node:
    blog_post:

      default:
        post_image:
          type: image
          settings:
            image_style: thumbnail
        body: true

      teaser:
        blog_image:
          type: image
          settings:
            image_style: thumbnail
        body:
          type: text_summary_or_trimmed
          settings:
            trim_length: 200

List available data sources on site

> drush usync-list

Module  Source
myblog  myblog.yml 

List available data in tree

There is three alternative syntaxes for this use case., (*6)

Show a tree of everything declared by the myblog module:, (*7)

> drush usync-tree --source=myblog:

Show a tree of the myblog.yml file declared by the myblog module:, (*8)

> drush usync-tree --source=myblog:myblog.yml

Show a tree of the myblog.yml file accessing it directly:, (*9)

> drush usync-tree --source=sites/all/modules/myblog/myblog.yml

Note that the --source parameter will be the same for all drush commands of this module, which means you can work directly on files without those needing to be defined by a specific module., (*10)

Output for the sample file should be:, (*11)

 + field.blog_image
 + field.body
 + entity.node.post.field.blog_image
 + entity.node.post.field.body
 + entity.node.post
 + view.node.blog_post.default
 + view.node.post.teaser

Listing matching elements in tree

Let's use the same source as upper, our 'myblog' module., (*12)

> drush usync-tree --source=myblog: \
    --match=entity.node.%

 + entity.node.post

Matching rules are the following:, (*13)

  • Words will match node names strictly, (*14)

  • % wildcard will match any name, (*15)

Injecting configuration into Drupal

Now that you are experienced users of the --source and --match parameters you can proceed to Drupal injection. Just replace the usync-tree command by usync-run using the same parameters and it will work., (*16)

For example, inject everything which is in the file:, (*17)

> drush usync-tree --source=myblog:

Once everything is injected, you can proceed to partial updates, for example revert all the view modes:, (*18)

> drush usync-tree --source=myblog:
    --match=view.node.blog_post.%

FAQ

But why?

Why not. Features is slow to revert, features need to be configured via the UI, and features are not easy to modify manually, features may bring weird conflicts, and features don't know what to do when there is an error and get broken. You can't define things easily, you can make objects inherit from each other one, and features uses CTools, supports Views, and push forward very bad practices. Drupal Way is unperformant, unperforming, and I needed something to write things faster and make things run faster., (*19)

But why Yaml?

Why not, and you can use plain old PHP arrays instead if you don't like it. It will work like a charm., (*20)

Why should I use it?

I'm not your mamma, if you like to click, use features. Choice is yours. Oh and it's an experimental, unfinshed product, so I would be you, I wouldn't use it., (*21)

The Versions

23/04 2018

dev-master

9999999-dev http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

23/04 2018

1.0.20

1.0.20.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

12/12 2017

1.0.19

1.0.19.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

24/11 2017

1.0.17

1.0.17.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

24/11 2017

1.0.18

1.0.18.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

29/10 2017

1.0.16

1.0.16.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

20/09 2017

1.0.15

1.0.15.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

20/09 2017

1.0.14

1.0.14.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

25/07 2017

1.0.13

1.0.13.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

09/05 2017

1.0.12

1.0.12.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

20/04 2017

1.0.11

1.0.11.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

18/04 2017

1.0.10

1.0.10.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

27/02 2017

dev-field-update

dev-field-update http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

27/02 2017

1.0.9

1.0.9.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

26/02 2017

1.0.7

1.0.7.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

02/02 2017

1.0.6

1.0.6.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

20/01 2017

1.0.5

1.0.5.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

12/10 2016

1.0.4

1.0.4.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

01/09 2016

1.0.3

1.0.3.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

31/08 2016

1.0.2

1.0.2.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

14/06 2016

1.0.1

1.0.1.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires

 

19/05 2016

1.0.0

1.0.0.0 http://github.com/makinacorpus/drupal-usync

Drupal features-like configuration file driven synchronization module

  Sources   Download

GPL-2

The Requires