From 40a07c4751bab9951bfb6d94dc167615e7779628 Mon Sep 17 00:00:00 2001 From: Carlo Gilmar Date: Sun, 28 Apr 2024 19:36:01 -0600 Subject: [PATCH] Update livebook to use the project as a dependency --- livebook/ex_plain_playbook.livemd | 40 +++++++------------------------ 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/livebook/ex_plain_playbook.livemd b/livebook/ex_plain_playbook.livemd index 6503cc9..6de4f31 100644 --- a/livebook/ex_plain_playbook.livemd +++ b/livebook/ex_plain_playbook.livemd @@ -2,45 +2,21 @@ ```elixir Mix.install([ - {:kino, "~> 0.12.0"} + {:kino, "~> 0.12.0"}, + {:ex_plain, path: "/Users/carlogilmar/Code/GitHub/ex_plain"} ]) ``` ## 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"))) +module = %ExPlain.Reader.ModuleUnit{ + name: "UsersContext", + public_functions: ["create_user/1"], + private_functions: ["validate_changeset/2"] +} -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) - d2_diagram = ExPlain.D2.Backbone.create_diagram(module) - """, - file: __ENV__.file - ) -``` - -```elixir IO.write(d2_diagram) ```