Skip to content

Commit

Permalink
Reformatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Virviil committed Mar 16, 2019
1 parent 302e951 commit f4915c8
Show file tree
Hide file tree
Showing 19 changed files with 652 additions and 162 deletions.
4 changes: 3 additions & 1 deletion lib/aqua/bootstraper.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
defmodule Aqua.Bootstraper do
def generate(path_to_template, args) do
Mix.Shell.IO.info("• Generating from #{inspect path_to_template} with args: #{inspect args}")
Mix.Shell.IO.info(
"• Generating from #{inspect(path_to_template)} with args: #{inspect(args)}"
)
end
end
26 changes: 12 additions & 14 deletions lib/aqua/config/common_args.ex
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
defmodule Aqua.Config.CommonArgs do
defstruct [
test: true,
verbose: false,
force: false,
update: false
]
defstruct test: true,
verbose: false,
force: false,
update: false

@type t :: %__MODULE__{
test: boolean(),
verbose: boolean(),
force: boolean(),
update: boolean()
}
test: boolean(),
verbose: boolean(),
force: boolean(),
update: boolean()
}

defimpl Collectable do
def into(original) do
fun = fn
map, {:cont, {k, v}} -> %{map| k => v}
map, {:cont, {k, v}} -> %{map | k => v}
map, :done -> map
_, :halt -> :ok
end
Expand All @@ -30,8 +28,8 @@ defmodule Aqua.Config.CommonArgs do
"""
@spec parse(args_list :: list(String.t())) :: __MODULE__.t()
def parse(args_list) do
OptionParser.parse(
args_list,
args_list
|> OptionParser.parse(
strict: [test: :boolean, verbose: :boolean, force: :boolean, update: :boolean],
aliases: [V: :verbose, F: :force, U: :update]
)
Expand Down
5 changes: 5 additions & 0 deletions lib/aqua/config/local_config.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
defmodule Aqua.Config.LocalConfig do
@moduledoc """
Module represents the structure of a configuration for Aqua
"""
end
9 changes: 8 additions & 1 deletion lib/aqua/generator.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@ defmodule Aqua.Generator do
def generate_template(generate_path, template, assigns) do
with false <- assigns[:force],
true <- File.exists?(generate_path),
false <- Aqua.View.safe_yes?([:red, :bright, "⚠ ", :normal, " Project already exists. Override?"]) do
false <-
Aqua.View.safe_yes?([
:red,
:bright,
"⚠ ",
:normal,
" Project already exists. Override?"
]) do
{:ok, :success}
else
_ ->
Expand Down
3 changes: 2 additions & 1 deletion lib/aqua/github.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ defmodule Aqua.Github do
[]
) do
{:ok, {_, _, body_char_list}} ->
Jason.decode!(body_char_list)
body_char_list
|> Jason.decode!()
|> Enum.map(fn %{"name" => name, "url" => url} ->
%Aqua.Schema.Template{name: name, url: url}
end)
Expand Down
20 changes: 10 additions & 10 deletions lib/aqua/jason/codegen.ex
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,11 @@ defmodule Aqua.Jason.Codegen do
ranges
|> jump_table(default)
|> Enum.flat_map(fn {byte_value, action} ->
quote do
<<unquote(byte_value), unquote(rest)::bits>> ->
unquote(action)
end
end)
quote do
<<unquote(byte_value), unquote(rest)::bits>> ->
unquote(action)
end
end)

clauses = clauses ++ quote(do: (<<>> -> empty_error(original, skip)))

Expand All @@ -113,12 +113,12 @@ defmodule Aqua.Jason.Codegen do
defp ranges_to_orddict(ranges) do
ranges
|> Enum.flat_map(fn
{int, value} when is_integer(int) ->
[{int, value}]
{int, value} when is_integer(int) ->
[{int, value}]

{enum, value} ->
Enum.map(enum, &{&1, value})
end)
{enum, value} ->
Enum.map(enum, &{&1, value})
end)
|> :orddict.from_list()
end

Expand Down
Loading

0 comments on commit f4915c8

Please sign in to comment.