Closed johngluckmdsol closed 3 years ago
Does it do anything when you run config:generate_all
?
Do you get an error message printed out or in a log file you could share?
Locally it works, could it be related to your environment/project? Is this a rails app btw?
Okay, well I'm getting slightly different results now
in mauth
bundle exec rake config:generate_all
MonitorWares configuration file could not be found (expected it to be present at /Users/jgluck/repos/mauth/config/monitor_wares.yml).
Please run `bundle exec rake config`.
identical config/dalli.yml.dice
identical config/monitor_wares.yml.dice
identical config/newrelic.yml.dice
jgluck ~/repos/mauth (develop) $ ls config
amazon_s3.yml.dice boot.rb environment.rb initializers monitor_wares.yml.dice privileged_uuids.yml.dice secrets.yml.dice tokens.yml.dice
application.rb dalli.yml.dice environments locales newrelic.yml.dice routes.rb shamus.yml.dice
I would have expected this to generate files. Yes, this is a rails app.
Just to be clear, "it should generates the files" you're talking about the *.dice
templates, right?
Because that's what the config:generate_all
task is for, it picks up the templates that gems supporting this dice_bag feature advertise and creates the *.dice
templates in the app's repository.
The :force
switch turns off the action prompt on conflict.
See https://github.com/mdsol/dice_bag#generating-the-pre-packaged-templates.
If you're expecting this command to generate the configs file *from the `.dicetemplates** (e.g.
my_file.yml.dice→
my_file.yml), then that's the
config` task you're looking for.
I cloned mauth and as far as I can tell it works as advertised.
The current codebase contains old templates for dalli and MW, so upon the first generate_all
run it prompts:
bx rake config:generate_all
conflict config/dalli.yml.dice
Overwrite /Users/jfeltesse/dev/repos/mauth/config/dalli.yml.dice? (enter "h" for help) [Ynaqdh]
(...)
If I restore the repo to its original state and run the command again with the :force
switch, it doesn't prompt and generates the template files:
bx rake config:generate_all:force
force config/dalli.yml.dice
force config/monitor_wares.yml.dice
identical config/newrelic.yml.dice
So this is a documentation problem. It is not clear what generate_all is supposed to be generating
How do you think we can improve the section of the README I linked to in my previous comment?
Change
config:generate_all will generate all the templates it can find. Since sometimes this behavior is not desirable you can use the config:generate_from_gems task to specify gem names:
to
config:generate_all will generate all the *.dice templates it can find from available gems. Note, it will not the yaml files, only the *.dice templates. Since sometimes this behavior is not desirable you can use the config:generate_from_gems task to specify gem names:
And add the same description to the task description in the rake file or link to the documentation. This documentation is buried and I can assure you that developers don't use this because they don't understand the documentation or read it.
I would also change the structure and formatting of the documentation so that each task is it's own bold bullet point with descriptions, examples, recommendations
I agree the README is a bit messy and can lead to some confusion. It probably stems from the fact dice_bag has been developed in waves, by different people.
I think that if it's structured correctly we don't need to repeat all over the place that generate* commands are about generating the templates though.
And sorry if it was a bit unclear but when I write "we" I'm referring to the mdsol org, including you. As I wrote in my comment yesterday, no team owns dice_bag and PRs are welcomed.
I think this old discussion can be closed. No follow-up action items needed. If something has to be improved in the README, a PR shall be opened with actual changes.
Repro steps In a project with the most recent version of the
dice_bag
gem installed, run `bundle exec rake config:generate_all:forceExpected: This should generate all files without prompting
Actual: No files are generated