-
Notifications
You must be signed in to change notification settings - Fork 515
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
rebar3 shell improvements (escript, rebar.config shell defaults) #893
Conversation
@@ -86,6 +89,7 @@ shell(State) -> | |||
setup_name(State), | |||
setup_paths(State), | |||
setup_shell(), | |||
maybe_run_script(State), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A gotcha there is that apps booting is what loads the sys.config
file if any is defined. Do you expect the script to run after or before that has been loaded?
If it needs to run after, then it must run after the apps have been loaded, but before they've been booted, and should be moved down inside maybe_boot_apps
(or rather, maybe_boot_apps
needs to be blown up in: maybe_load_apps
, maybe_load_config
, maybe_run_script
and then maybe_boot_apps
) -- but that depends on the intent of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the script stuff should run before booting Apps - I'm intending that people use it to setup fake servers that they would connect to on boot anyway. It would be nice to get access to their OTP config, but that would require splitting load and start as you say. I'm going to try the easier thing for now.
OK, this thing seems to work (no tests, hahaha :/). I also added the ability to pull defaults for {shell, [{script_file, FileName}, {config, ConfigFileName}]}. |
+1, waiting for squash as discussed off-channel |
e6e1748
to
bc01ed2
Compare
Incoming squash. |
+1. |
Adds the ability to run an escript before starting the apps and interactive shell for a project. This is intended to improve the local development experience for projects by providing an easy way to run companion services (mock rest APIs, databases etc) that the project relies on. This patch also adds {shell, Defaults} to the rebar config file so that a project can supply default values for many of the new or improved 'rebar3 shell' options: * {apps, OTPApps} * {script_file, EscriptFileName} * {config, ConfigFileName} The order of option precedence is command line, rebar.config, relx.
bc01ed2
to
7481428
Compare
Fixed the dialyzer warning and associated bug. |
rebar3 shell improvements (escript, rebar.config shell defaults)
Runs a user-specified escript to initialize a system before starting the project Apps and the interactive shell. This allows for development-only frameworks and scaffolding to start before brining up the system for interactive use.