simple elixir example

This commit is contained in:
Ruidy 2023-01-05 15:58:59 +01:00
parent f1742ce075
commit 4bc60f8d3e
9 changed files with 3 additions and 78 deletions

View file

@ -1,4 +0,0 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]

18
elixir/.gitignore vendored
View file

@ -1,26 +1,10 @@
# The directory Mix will write compiled artifacts to.
/_build/ /_build/
# If you run "mix test --cover", coverage assets end up here.
/cover/ /cover/
# The directory Mix downloads your dependencies sources to.
/deps/ /deps/
# Where third-party dependencies like ExDoc output generated docs.
/doc/ /doc/
# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch /.fetch
# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump erl_crash.dump
# Also ignore archive artifacts (built via "mix archive.build").
*.ez *.ez
# Ignore package tarball (built via "mix hex.build").
example-*.tar example-*.tar
# Temporary files, for example, from tests.
/tmp/ /tmp/
.elixir_ls

View file

@ -1 +0,0 @@
IEx.after_spawn(fn -> Example.hello() |> IO.puts() end)

View file

@ -4,4 +4,4 @@ WORKDIR /app
COPY . . COPY . .
CMD ["iex", "-S", "mix"] CMD ["elixir", "hello.exs"]

1
elixir/hello.exs Normal file
View file

@ -0,0 +1 @@
IO.puts("Hello, World!")

View file

@ -1,18 +0,0 @@
defmodule Example do
@moduledoc """
Documentation for `Example`.
"""
@doc """
Hello world.
## Examples
iex> Example.hello()
:world
"""
def hello do
:world
end
end

View file

@ -1,28 +0,0 @@
defmodule Example.MixProject do
use Mix.Project
def project do
[
app: :example,
version: "0.1.0",
elixir: "~> 1.13",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end
# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger]
]
end
# Run "mix help deps" to learn about dependencies.
defp deps do
[
# {:dep_from_hexpm, "~> 0.3.0"},
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
]
end
end

View file

@ -1,8 +0,0 @@
defmodule ExampleTest do
use ExUnit.Case
doctest Example
test "greets the world" do
assert Example.hello() == :world
end
end

View file

@ -1 +0,0 @@
ExUnit.start()