Skip to content

feat: mix project setup #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .formatter.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Used by "mix format"
[
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
28 changes: 24 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,30 @@
/_build
/cover
/deps
/doc
# The directory Mix will write compiled artifacts to.
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover/

# The directory Mix downloads your dependencies sources to.
/deps/

# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
lambda_ethereum_consensus-*.tar

# Temporary files, for example, from tests.
/tmp/

*.beam
/config/*.secret.exs
.elixir_ls/
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: iex deps test

# Run an interactive terminal with the main supervisor setup.
iex:
iex -S mix

# Install mix dependencies.
deps:
mix deps.get

# Run tests
test:
mix test
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
# lambda_ethereum_consensus
# lambda_ethereum_consensus

## Prerequisites

- Elixir and mix [installed](https://elixir-lang.org/install.html) (e.g. with asdf, or brew).

## Installing and running

There are Makefile targets for these tasks.

```shell
make deps # Installs dependencies
make iex # Runs a terminal with the application started
make test # Runs tests
```

The iex terminal can be closed by pressing ctrl+c two times.
18 changes: 18 additions & 0 deletions lib/lambda_ethereum_consensus.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
defmodule LambdaEthereumConsensus do
@moduledoc """
Documentation for `LambdaEthereumConsensus`.
"""

@doc """
Hello world.

## Examples

iex> LambdaEthereumConsensus.hello()
:world

"""
def hello do
:world
end
end
20 changes: 20 additions & 0 deletions lib/lambda_ethereum_consensus/application.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
defmodule LambdaEthereumConsensus.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false

use Application

@impl true
def start(_type, _args) do
children = [
# Starts a worker by calling: LambdaEthereumConsensus.Worker.start_link(arg)
# {LambdaEthereumConsensus.Worker, arg}
]

# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: LambdaEthereumConsensus.Supervisor]
Supervisor.start_link(children, opts)
end
end
29 changes: 29 additions & 0 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
defmodule LambdaEthereumConsensus.MixProject do
use Mix.Project

def project do
[
app: :lambda_ethereum_consensus,
version: "0.1.0",
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
deps: deps()
]
end

# Run "mix help compile.app" to learn about applications.
def application do
[
extra_applications: [:logger],
mod: {LambdaEthereumConsensus.Application, []}
]
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
8 changes: 8 additions & 0 deletions test/lambda_ethereum_consensus_test.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule LambdaEthereumConsensusTest do
use ExUnit.Case
doctest LambdaEthereumConsensus

test "greets the world" do
assert LambdaEthereumConsensus.hello() == :world
end
end
1 change: 1 addition & 0 deletions test/test_helper.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ExUnit.start()