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

Add Vagrant environment specific config support #95

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

patrickfweston
Copy link
Contributor

@patrickfweston patrickfweston commented Dec 19, 2017

Problem

Designers and developers often use Butler in different environments. Designers prefer to work locally for the increased speed, while developers work within Vagrant for Drupal support. Unfortunately, there is no easy way to differentiate this environment when running Butler. As a result, the URL in the config.yml file must be changed from something like localhost:4000 to project-name.local:4000 when the environment switches. This can be tedious to change and to avoid committing.

Proposed Solution

This PR adds a special Gulp task named butler-vagrant for running Butler within Vagrant. It executes Spress with config for a new Vagrant environment located in the config_vagrant.yml file.

It adds a task to Gulp named spress-serve-vagrant to serve content at the appropriate URL.

Next steps

Spress is supposed to allow per-environment configuration. We previously had a config_dev.yml file. I couldn't get Spress to acknowledge the config in this file, but everything worked when I changed the environment from dev to vagrant.

I currently have the develop-vagrant tasks defined in the butler.defaults.js file that is included in a project's overrides of the butler defaults. I don't believe this is the best place for it, but I wasn't sure where else to place it. Here is that code:

overrides.develop_tasks_vagrant = ['sass', 'spress-serve-vagrant', 'spress-watch', 'watch'];

@@ -162,6 +168,9 @@ gulp.task('watch', function() {
// Set Develop task
gulp.task('develop', defaults.develop_tasks);

// Set develop-vagrant task
gulp.task('develop-vagrant', defaults.develop_tasks_vagrant);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patrickfweston is develop-vagrant and defaults.develop_tasks_vagrant running the same thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Being honest, I've forgotten how the pieces fit together since I made this PR. It appears to me that I'm missing the definition of the default variable defaults.develop_tasks_vagrant in this PR. I believe it should be set up as such:

develop-vagrant is an ease-of-use task that calls the tasks defined in defaults.develop_tasks_vagrant. This is setup in the same way that develop calls the tasks defined in defaults.develop_tasks:

defaults.develop_tasks = ['sass', 'sculpin', 'watch'];

The only difference is that we use spress-serve-vagrant to serve the prototype so it runs with the appropriate config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants