Closed iteles closed 5 years ago
In the initial output after mix new <project-name>
is now:
* creating README.md
* creating .formatter.exs
* creating .gitignore
* creating mix.exs
* creating lib
* creating lib/animals.ex
* creating test
* creating test/test_helper.exs
* creating test/animals_test.exs
The example in the boilerplate lib/animals.ex
is now:
## Examples
iex> Animals.hello()
:world
For the first project code this was kind of it 😄 Not really tinkering with the basics in version iterations 😉
Added one or two clarifications to the readme for good measure.
Moving onto the Documentation section and beyond.
Updating the version of ex_doc installed to 0.21 because there's no reason not to for the sake of this simple initial tutorial.
defp deps do
[
{:ex_doc, "~> 0.21"}
]
end
The boiler plate for this has also changed to:
defmodule AnimalsTest do
use ExUnit.Case
doctest Animals
test "greets the world" do
assert Animals.hello() == :world
end
end
It wasn't until I ran mix test
that I realised why some Examples were missing from the animals.exs
file removed in this commit: https://github.com/dwyl/learn-elixir/commit/748ce190742a53973821b637624c1d12680879f2
I'm assuming now it's because the doctest for this will often fail based on the example.
I imagine that rather than doing this, we'll want to alert people in the readme that because of the dotests, they should remove examples from functions like this to test them well?
Aside from #136 which I have created as a separate question:
When you create a new project in Elixir 1.9, the .formatter.exs
file is now created by default with the following code:
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
This means we no longer need to create it ourselves, so we need to update the readme accordingly:
Moved PR to review as I've finished going over the first project 'section' (generating the project, basic functions, docs, testing, formatting and publishing) with which this issue is concerned.
Further issues to be opened for the rest if relevant.
PR #135 merged.
I currently have Elixir v1.9 installed and as I go through the first project, I'm catching a few things that have been updated in elixir since the README was written.
They're very minor but may throw off complete beginners!