feat: add rebar3 nova gen_live command#62
Closed
Taure wants to merge 2 commits into
Closed
Conversation
Single command replaces multiple templates with composable flags: rebar3 nova new myapp [--kura] [--pgo] [--arizona] [--lfe] [--ci] [--docker] [--otel] - --kura/--pgo mutually exclusive, all others freely combinable - Each flag conditionally adds deps, plugins, config, and source files - Adds write_file/2 and copy_priv_file/2 to rebar3_nova_utils - 11 CT tests covering all flags and combinations
Generates Arizona LiveView CRUD views, Kura schema, migration, and
test suite for a resource. Similar to Phoenix's phx.gen.live.
Usage:
rebar3 nova gen_live --name users --fields name:string,email:string
Generated files:
- src/views/{app}_{resource}_{action}_view.erl (index/show/new/edit)
- src/schemas/{app}_{resource}.erl (Kura schema)
- src/migrations/m{ts}_create_{table}.erl (Kura migration)
- test/{app}_{resource}_live_SUITE.erl (CT test suite)
Also fixes the home_view scaffold in `nova new --arizona` to use
the current Arizona API (arizona_view:new/3, arizona_template:from_html,
arizona_parse_transform).
burbas
requested changes
Mar 19, 2026
burbas
left a comment
Contributor
There was a problem hiding this comment.
I think that we don't need a new command for each type of sub-component we are generating. It would make more sense to have something similar to
rebar3 nova gen live users -- fields name:string, email:string,active:boolean
The name (In this example users) will always be required so don't see any point of having that as a flag. And we might want to be able to generate controllers, plugins etc. So just calling rebar3 nova gen would then result in a help-section describing all different modules to generate.
Contributor
Author
|
Superseded by #63 which includes gen_live plus the unified gen dispatcher, template system, and tests. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
rebar3 nova gen_livecommand that generates Arizona LiveView CRUD views mapped to Kura schemas (similar tomix phx.gen.live)nova new --arizonahome_view scaffold to use the current Arizona API (arizona_view:new/3,arizona_template:from_html,arizona_parse_transform)Usage
Generated files
src/views/{app}_user_index_view.erlsrc/views/{app}_user_show_view.erlsrc/views/{app}_user_new_view.erlsrc/views/{app}_user_edit_view.erlsrc/schemas/{app}_user.erlsrc/migrations/m{ts}_create_users.erltest/{app}_user_live_SUITE.erlFlags
--actions index,show,new,edit— select which views to generate--no-schema— skip schema + migration generationstring,text,integer,float,boolean,date,utc_datetime,uuid,jsonbKey design decisions
kura_repo_worker/kura_changesetdirectly (no context layer)~""""(4-quote) outer templates with~"""(3-quote) inner templates forrender_listcallbacksarizona_view:get_state/update_state+arizona_stateful:put_binding/get_bindingDepends on #62 (
feat/nova-new)Test plan
rebar3 ct— all 21 tests pass (10 gen_live + 11 nova_new)--arizona --kura, rungen_live, verifyrebar3 compilesucceeds