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

Access to variables within .bref.yml #50

Closed
gregmsanderson opened this issue Aug 2, 2018 · 3 comments
Closed

Access to variables within .bref.yml #50

gregmsanderson opened this issue Aug 2, 2018 · 3 comments

Comments

@gregmsanderson
Copy link

Hello,

I see you can add a build hook within .bref.yml. I was wondering about using that to run grunt to prepare the static files (CSS, JS etc). So I would run a hook like 'grunt production' and presumably then those generated (minified) files would get deployed.

... which got me thinking ...

Can you access variables within that .yml file in the same way serverless mentions you can in its yml? (https://serverless.com/framework/docs/providers/aws/guide/variables/). Only if so, would it be possible to set the build hook to be like 'grunt ${opt:stage}'? Since then it could dynamically run 'grunt staging' or 'grunt production', or whatever the stage being deployed was, and so do a different set of operations (like upload them to a different location). Thanks!

@mnapoli
Copy link
Member

mnapoli commented Aug 3, 2018

Can you access variables within that .yml file in the same way serverless mentions you can in its yml?

It is not possible at the moment indeed. It sounds like a good idea though.

@gregmsanderson
Copy link
Author

Ok. If you wanted to add for a build hook, I would think you would simply pass it along:

  1. https://github.com/mnapoli/bref/blob/master/src/Console/Deployer.php#L74
    $this->generateArchive($io, $progress);
    .... to
    $this->generateArchive($io, $progress, $stage);

(and the function params would need that third one adding, so it expects it)

  1. https://github.com/mnapoli/bref/blob/master/src/Console/Deployer.php#L193
    Add a line prior to that one:
if (null !== $stage) {
  $buildHook = str_replace('${opt:stage}', $stage, $buildHook);
}

... so that would simply turn 'grunt ${opt:stage}' into 'grunt production' (or whatever). Replacing the string with the stage.
Thanks.

@mnapoli
Copy link
Member

mnapoli commented Jan 5, 2019

This issue is made obsolete by v0.3.

@mnapoli mnapoli closed this as completed Jan 5, 2019
brefphp-bot pushed a commit to brefphp-bot/bref that referenced this issue Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants