Skip to content

Commit 617776a

Browse files
author
José Valim
committed
Let's talk about the tooling too
1 parent 8b5b197 commit 617776a

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

index.html

+39
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,45 @@ <h4>Pattern matching</h4>
142142
</div>
143143
</div>
144144

145+
<div class="hentry post">
146+
<h4>Tooling included</h4>
147+
148+
<div class="entry-summary">
149+
<p>Elixir ships with a great set of tools to ease development. Mix allows you to easily create your new project, manage tasks and dependencies:</p>
150+
151+
{% highlight text %}
152+
$ mix new my_app
153+
$ cd my_app
154+
$ mix test
155+
.
156+
157+
Finished in 0.04 seconds (0.04s on load, 0.00s on tests)
158+
1 tests, 0 failures
159+
{% endhighlight %}
160+
161+
<p>In the example above, we have created a new project and ran its initial test suite powered by the ExUnit test framework.</p>
162+
163+
<p>Elixir also ships with an Interactive Shell, called IEx, which provides a great set of helpers for writing code, like easy access to documentation (shown above), code reloading and so on. It is also great companion for production, as it allows, for example, connecting to remote nodes. Here is a quick example you can try locally. In one terminal, do:</p>
164+
165+
{% highlight text %}
166+
$ iex --name hello
167+
iex(hello@machine)1> defmodule Hello do
168+
...(hello@machine)1> def world, do: IO.puts "Distributed hello world"
169+
...(hello@machine)1> end
170+
{% endhighlight %}
171+
172+
<p>See the name in between parenthesis starting with hello? Copy that, open up another terminal and pass it to <code>--remsh</code> (short for remote shell):</p>
173+
174+
{% highlight text %}
175+
$ iex --name world --remsh "hello@machine"
176+
iex(hello@machine)1> Hello.world
177+
"Distributed hello world"
178+
{% endhighlight %}
179+
180+
<p>Notice we were able to invoke a function from a module defined in the other terminal! Even the node names are the same. This will work in between machines in the same network as long as they have the same value in the <code>~/.erlang.cookie</code> file!</p>
181+
</div>
182+
</div>
183+
145184
<div class="hentry post">
146185
<h4>Erlang all the way down</h4>
147186

0 commit comments

Comments
 (0)