Workflow in mix / iex

67 views
Skip to first unread message

J David Eisenberg

unread,
Jul 1, 2016, 12:49:12 AM7/1/16
to elixir-lang-talk
Presume I am creating a new application with these commands:

    mix new my_app
    cd my_app

I then use the editor of my choice  to put some functions into lib/my_app.ex

If I want to test those functions in iex, am I best off doing this:

    iex -S mix

or
    cd lib
    iex

If I do the former, then when I make changes to the source file, I have to do this in iex:

   c("lib/my_app.ex")

whereas the second version needs only

   c("my_app.ex")


Both of these seem to work equally well. Which is the correct or preferred way, if either? Or is there a "best practices" method that I am totally missing here?

Louis Pilfold

unread,
Jul 1, 2016, 3:14:03 AM7/1/16
to elixir-lang-talk

Hey!

In iex recompile/0 will recompile the current project, so no need to specify paths.

http://elixir-lang.org/docs/stable/iex/IEx.Helpers.html#recompile/0

Cheers,
Louis

--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-talk/2efa495f-d3d0-44f0-9cf1-e029d8e2be94%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Steven Leiva

unread,
Jul 1, 2016, 9:10:36 AM7/1/16
to elixir-lang-talk, lo...@lpil.uk
Louis,

Great tip! Thanks. Funny how much more there is to IEx. I should certainly take the time to look at the docs.

OvermindDL1

unread,
Jul 1, 2016, 9:56:14 AM7/1/16
to elixir-lang-talk, lo...@lpil.uk
Though the correct way to test those functions should probably be by running `mix test`.  ^.^

Louis Pilfold

unread,
Jul 1, 2016, 11:49:06 AM7/1/16
to elixir-lang-talk
Reply all
Reply to author
Forward
0 new messages