Closed AndiLavera closed 3 years ago
@drujensen A spec has been added.
I had to read the routes file my self. I tried doing what routes_spec does with:
output = ""
Amber::CLI::MainCommand.run %w(routes) { |cmd| output = cmd.out.gets_to_end }
output_lines = route_table_rows(output)
But it would hang indefinitely.
Description of the Change
This adds the ability for plugin authors to create a
config.yml
file. The file is should be located in the plugin folder. Currently, I have only added the ability to inject routes into the usersroute.cr
file but I have no problem adding extra functionality if people bring up ideas.The code expects the YAML file to be in the following format:
Benefits
Right now, the benefit is routes can be auto-generated.
Possible Drawbacks
More code.
A current limitation is it breaks if you don't have the full information. The cli will not read the file if the file doesn't exist. It doesn't break if the file is empty. It does break when the file is just:
or
But plugin authors shouldn't be doing that anyways.