Skip to content

Instantly share code, notes, and snippets.

@busla
Last active November 21, 2016 07:52
Show Gist options
  • Save busla/a3612e79b80dc523d28fc6c48aa03884 to your computer and use it in GitHub Desktop.
Save busla/a3612e79b80dc523d28fc6c48aa03884 to your computer and use it in GitHub Desktop.
Development environment for Yild providers

Yield provider development environment

One-liner for installing a fresh Drupal instance with Yild and contributed providers using a make file.

drush make drupal.make.yml your-drupal-folder-name && \
cd your-drupal-folder-name && \
drush si --db-url=mysql://user:[email protected]:port/your-db-name --site-name="Yild provider development" --yes && \
drush en yild, yild_your_provider_name

What does it do?

  • Creates the folder your-drupal-folder-name
  • Installs the latest Drupal 7.x version.
  • Installs the Yild module
  • Enables Yild and your Yild provider(s)
  • Clones all the Yild providers in the make file from their respective git repository.
  • Creates the database: your-db-name
  • Adds the user admin to the database, generates a password and prints it to the console. Use --account-pass=your password to manually set a password.

Notes about Mysql

The --db-url argument assumes that mysql is installed and in your $PATH.

If you are using MAMP then mysql will not be included in $PATH. Add mysql to your .bash_profile by adding the following line at the end of the file.

export PATH=$PATH:/Applications/MAMP/Library/bin

Or if using OhMyZsh, then add it to .zshrc.

Notes and considerations

  • Make sure to edit your-drupal-folder-name, user, pass, port and your-db-name accordingly.
  • Edit the list of Yild provider modules in the drush en command.
  • The --yes argument will not ask you any questions. The si (--site-install) command will drop all existing tables without asking if --yes is used.
  • Other arguments for the site-install command can be found here.

You can also add the following arguments (optional) to use a different user to create the database. It must have GRANT permission:

--db-su=your-user --db-su-pw=your-pass

The providers are now checked out in their respective folders, e.g. sites/all/modules/contrib/yild/modules/providers/yild_your_provider_name. You can start committing and pushing from any provider folder, given that you have access to that particular Github repo.

Before trashing the drupal folder, make sure you git push your provider :-D

One-liner drop DB

If --site-install fails to drop your DB you can do it manually:

drush sql-drop --database=your-db-name --db-url=mysql://user:[email protected]:port/your-db-name --yes

# Core version
# ------------
core: "7.x"
# API version
# ------------
api: 2
# Projects
# ------------
projects:
drupal:
version: ~ # Tilda get´s the latest version
yild:
version: ~
subdir: "contrib"
# To get the Yild module with the proposed fix at https://github.com/busla/yild-ruv/commit/166fadcb28a3e598d875d9e8b758ed73125faad8,
# remove the yild item above and uncomment the yild item below.
#yild:
#type: "module"
#subdir: "contrib"
#download:
#url: "https://github.com/busla/yild-ruv.git"
yild_icelandic_companies:
type: "module"
overwrite: true # Necessary to add the provider inside the existing Yild directory
subdir: "contrib/yild/modules/providers"
download:
working-copy: true # Clones from Git instead of using wget.
url: "https://github.com/ruv-ohf/yild_icelandic_companies.git"
#branch: "7.x-1.x"
#yild_some_other_provider:
#type: "module"
#overwrite: true # Necessary to add the provider inside the existing Yild directory
#subdir: "contrib/yild/modules/providers"
#download:
#working-copy: true # Checks out source files from Git instead of downloading.
#url: "https://github.com/ruv-ohf/yild_your_provider_name.git"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment