Skip to content

Commit 75b5b86

Browse files
authored
project setup (#8)
1 parent 536db5b commit 75b5b86

File tree

9 files changed

+134
-5
lines changed

9 files changed

+134
-5
lines changed

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.gitignore

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
1-
/_build
2-
/cover
3-
/deps
4-
/doc
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where third-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
514
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
617
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
720
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
lambda_ethereum_consensus-*.tar
24+
25+
# Temporary files, for example, from tests.
26+
/tmp/
27+
828
*.beam
929
/config/*.secret.exs
1030
.elixir_ls/

Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.PHONY: iex deps test
2+
3+
# Run an interactive terminal with the main supervisor setup.
4+
iex:
5+
iex -S mix
6+
7+
# Install mix dependencies.
8+
deps:
9+
mix deps.get
10+
11+
# Run tests
12+
test:
13+
mix test

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
# lambda_ethereum_consensus
1+
# lambda_ethereum_consensus
2+
3+
## Prerequisites
4+
5+
- Elixir and mix [installed](https://elixir-lang.org/install.html) (e.g. with asdf, or brew).
6+
7+
## Installing and running
8+
9+
There are Makefile targets for these tasks.
10+
11+
```shell
12+
make deps # Installs dependencies
13+
make iex # Runs a terminal with the application started
14+
make test # Runs tests
15+
```
16+
17+
The iex terminal can be closed by pressing ctrl+c two times.

lib/lambda_ethereum_consensus.ex

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
defmodule LambdaEthereumConsensus do
2+
@moduledoc """
3+
Documentation for `LambdaEthereumConsensus`.
4+
"""
5+
6+
@doc """
7+
Hello world.
8+
9+
## Examples
10+
11+
iex> LambdaEthereumConsensus.hello()
12+
:world
13+
14+
"""
15+
def hello do
16+
:world
17+
end
18+
end
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
defmodule LambdaEthereumConsensus.Application do
2+
# See https://hexdocs.pm/elixir/Application.html
3+
# for more information on OTP Applications
4+
@moduledoc false
5+
6+
use Application
7+
8+
@impl true
9+
def start(_type, _args) do
10+
children = [
11+
# Starts a worker by calling: LambdaEthereumConsensus.Worker.start_link(arg)
12+
# {LambdaEthereumConsensus.Worker, arg}
13+
]
14+
15+
# See https://hexdocs.pm/elixir/Supervisor.html
16+
# for other strategies and supported options
17+
opts = [strategy: :one_for_one, name: LambdaEthereumConsensus.Supervisor]
18+
Supervisor.start_link(children, opts)
19+
end
20+
end

mix.exs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
defmodule LambdaEthereumConsensus.MixProject do
2+
use Mix.Project
3+
4+
def project do
5+
[
6+
app: :lambda_ethereum_consensus,
7+
version: "0.1.0",
8+
elixir: "~> 1.14",
9+
start_permanent: Mix.env() == :prod,
10+
deps: deps()
11+
]
12+
end
13+
14+
# Run "mix help compile.app" to learn about applications.
15+
def application do
16+
[
17+
extra_applications: [:logger],
18+
mod: {LambdaEthereumConsensus.Application, []}
19+
]
20+
end
21+
22+
# Run "mix help deps" to learn about dependencies.
23+
defp deps do
24+
[
25+
# {:dep_from_hexpm, "~> 0.3.0"},
26+
# {:dep_from_git, git: "https://github.com/elixir-lang/my_dep.git", tag: "0.1.0"}
27+
]
28+
end
29+
end
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
defmodule LambdaEthereumConsensusTest do
2+
use ExUnit.Case
3+
doctest LambdaEthereumConsensus
4+
5+
test "greets the world" do
6+
assert LambdaEthereumConsensus.hello() == :world
7+
end
8+
end

test/test_helper.exs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ExUnit.start()

0 commit comments

Comments
 (0)