Skip to content

Commit

Permalink
fix: ditch faker from dev env
Browse files Browse the repository at this point in the history
  • Loading branch information
zoedsoupe committed Sep 9, 2024
1 parent d8f6ff4 commit 46f4e3e
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 37 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ RUN apk add --no-cache chromium --repository=http://dl-cdn.alpinelinux.org/alpin

ARG MIX_ENV

ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV LANGUAGE=en_US:en
ENV LC_ALL=en_US.UTF-8

WORKDIR "/app"
RUN chown nobody /app
Expand Down
1 change: 0 additions & 1 deletion lib/mix/tasks/seed.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ defmodule Mix.Tasks.Seed do
@impl Mix.Task
def run(_args) do
Mix.Task.run("app.start", ["--preload-modules"])
Faker.start()

:ok = contato_seeds()
:ok = usuario_seeds()
Expand Down
4 changes: 1 addition & 3 deletions lib/pescarte/application.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ defmodule Pescarte.Application do
:ok
end

defp children do
if Pescarte.env() == :dev, do: Faker.start()

def children do
[
Pescarte.Database.Supervisor,
PescarteWeb.Telemetry,
Expand Down
20 changes: 10 additions & 10 deletions lib/seeder/identidades/contato.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ defmodule Seeder.Identidades.Contato do
[
%Contato{
email_principal: "[email protected]",
endereco: Faker.Address.street_address(true),
celular_principal: Faker.Phone.PtBr.phone()
endereco: "943 Schuppe Row Suite 906",
celular_principal: "(63) 5906-7216"
},
%Contato{
email_principal: "[email protected]",
endereco: Faker.Address.street_address(true),
celular_principal: Faker.Phone.PtBr.phone()
endereco: "99981 Nicolas Orchard Apt. 060",
celular_principal: "(62) 9 0254-9051"
},
%Contato{
email_principal: "[email protected]",
endereco: Faker.Address.street_address(true),
celular_principal: Faker.Phone.PtBr.phone()
endereco: "2 Shanny Shore Apt. 674",
celular_principal: "(71) 3570-5710"
},
%Contato{
email_principal: "[email protected]",
endereco: Faker.Address.street_address(true),
celular_principal: Faker.Phone.PtBr.phone()
endereco: "74132 Alessandra Place Apt. 299",
celular_principal: "(86) 9 4994-3367"
},
%Contato{
email_principal: "[email protected]",
endereco: Faker.Address.street_address(true),
celular_principal: Faker.Phone.PtBr.phone()
endereco: "6864 Suzanne Overpass Apt. 273",
celular_principal: "(92) 4225-7846"
}
]
end
Expand Down
4 changes: 2 additions & 2 deletions lib/seeder/modulo_pesquisa/campus.ex
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ defmodule Seeder.ModuloPesquisa.Campus do
acronimo: "UENF",
nome: "Campos dos Goytacazes",
nome_universidade: "Universidade Estadual do Norte Fluminense Darcy Ribeiro",
endereco: Faker.Address.street_address(true)
endereco: "57 Georgette Hill Apt. 898"
},
%Campus{
acronimo: "UFSCar",
nome: "Sorocaba",
nome_universidade: "Universidade Federal de São Carlos",
endereco: Faker.Address.street_address(true)
endereco: "8 Morris Inlet Suite 355"
}
]
end
Expand Down
17 changes: 9 additions & 8 deletions lib/seeder/modulo_pesquisa/linha_pesquisa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,27 @@ defmodule Seeder.ModuloPesquisa.LinhaPesquisa do
[
%LinhaPesquisa{
numero: 1,
desc: Faker.Lorem.sentence(1..25),
desc_curta: Faker.Lorem.sentence(1..10),
desc:
"Praesentium architecto est fugit modi repudiandae amet architecto dolorem corrupti voluptas consequatur eveniet?",
desc_curta: "Velit qui repellat sunt harum.",
nucleo_pesquisa: nucleo_pesquisa_by(letra: "A")
},
%LinhaPesquisa{
numero: 2,
desc: Faker.Lorem.sentence(1..25),
desc_curta: Faker.Lorem.sentence(1..10),
desc: "Debitis culpa ex accusamus sequi?",
desc_curta: "Aliquam dolores.",
nucleo_pesquisa: nucleo_pesquisa_by(letra: "B")
},
%LinhaPesquisa{
numero: 3,
desc: Faker.Lorem.sentence(1..25),
desc_curta: Faker.Lorem.sentence(1..10),
desc: "Aspernatur repudiandae rerum.",
desc_curta: "Natus commodi provident sint et recusandae!",
nucleo_pesquisa: nucleo_pesquisa_by(letra: "C")
},
%LinhaPesquisa{
numero: 4,
desc: Faker.Lorem.sentence(1..25),
desc_curta: Faker.Lorem.sentence(1..10),
desc: "Voluptatem est rerum sit quia aut autem vero esse odit est quam optio quo dolor?",
desc_curta: "Minus.",
nucleo_pesquisa: nucleo_pesquisa_by(letra: "D")
}
]
Expand Down
17 changes: 9 additions & 8 deletions lib/seeder/modulo_pesquisa/nucleo_pesquisa.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,24 @@ defmodule Seeder.ModuloPesquisa.NucleoPesquisa do
def entries do
[
%NucleoPesquisa{
nome: Faker.Lorem.sentence(1..8),
desc: Faker.Lorem.sentence(1..25),
nome: "Voluptatem eaque aliquam error.",
desc: "Provident libero aliquid impedit explicabo voluptatibus ea fugit atque!",
letra: "A"
},
%NucleoPesquisa{
nome: Faker.Lorem.sentence(1..8),
desc: Faker.Lorem.sentence(1..25),
nome: "In tempore?",
desc: "Culpa vero est perferendis natus aut.",
letra: "B"
},
%NucleoPesquisa{
nome: Faker.Lorem.sentence(1..8),
desc: Faker.Lorem.sentence(1..25),
nome: "Voluptatem nobis molestias.",
desc: "Cumque commodi odio illum distinctio consequatur?",
letra: "C"
},
%NucleoPesquisa{
nome: Faker.Lorem.sentence(1..8),
desc: Faker.Lorem.sentence(1..25),
nome: "Sit qui nesciunt sint?",
desc:
"Non veritatis similique exercitationem similique expedita et eos corporis architecto.",
letra: "D"
}
]
Expand Down
8 changes: 6 additions & 2 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ defmodule Pescarte.MixProject do
]
end

def cli do
[preferred_envs: [seed: :test]]
end

def application do
[mod: {Pescarte.Application, []}, extra_applications: [:logger]]
end

defp elixirc_paths(e) when e in [:dev, :test], do: ["lib", "test/support"]
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]

defp deps do
Expand Down Expand Up @@ -74,7 +78,7 @@ defmodule Pescarte.MixProject do
{:phoenix_html_helpers, "~> 1.0"},
{:nimble_csv, "~> 1.1"},
{:sentry, "~> 10.2.0"},
{:faker, "~> 0.18", only: [:dev, :test]},
{:faker, "~> 0.18", only: :test},
{:dialyxir, "~> 1.3", only: [:dev], runtime: false},
{:credo, "~> 1.5", only: [:dev, :test], runtime: false},
# {:ex_doc, "> 0.0.0", only: [:dev, :test], runtime: false},
Expand Down

0 comments on commit 46f4e3e

Please sign in to comment.