diff --git a/livebook/ex_plain_playbook.livemd b/livebook/ex_plain_playbook.livemd new file mode 100644 index 0000000..6503cc9 --- /dev/null +++ b/livebook/ex_plain_playbook.livemd @@ -0,0 +1,46 @@ +# ex_plain playbook + +```elixir +Mix.install([ + {:kino, "~> 0.12.0"} +]) +``` + +## Execute code from other Node + +### Instructions + +1. Open a Node session in your application `iex --sname ex_plain --cookie secret -S mix` +2. Open a new Notebook +3. Add a `Remote execution` smart cell. +4. Add the node and the cookie choosen, in this cell you can execute your code. +5. You can assign the data in the `assign to` input. So in this way you can work with that data. +6. You can continue using the livebook implementations with your data. + + + +```elixir +require Kino.RPC +node = :"ex_plain@MacBook-Pro-de-Carlo-Gilmar" +Node.set_cookie(node, String.to_atom(System.fetch_env!("LB_COOKIE"))) + +d2_diagram = + Kino.RPC.eval_string( + node, + ~S""" + module = + %ExPlain.Reader.ModuleUnit{ + name: "UsersContext", + public_functions: ["create_user/1"], + private_functions: ["validate_changeset/2"] + } + + d2_diagram = ExPlain.D2.Backbone.create_diagram(module) + """, + file: __ENV__.file + ) +``` + +```elixir +IO.write(d2_diagram) +```