├── priv ├── lib │ ├── rebar.config │ ├── src │ │ ├── lib.erl │ │ └── lib.app.src │ ├── README.md │ ├── .gitignore │ └── LICENSE ├── release │ ├── config │ │ ├── sys.config │ │ └── vm.args │ ├── README.md │ ├── .gitignore │ ├── apps │ │ └── release │ │ │ └── src │ │ │ ├── release.app.src │ │ │ ├── release_app.erl │ │ │ └── release_sup.erl │ ├── rebar.config │ └── LICENSE ├── plugin │ ├── rebar.config │ ├── src │ │ ├── plugin.erl │ │ ├── plugin.app.src │ │ └── plugin_prv.erl │ ├── .gitignore │ ├── README.md │ └── LICENSE ├── app │ ├── README.md │ ├── rebar.config │ ├── .gitignore │ ├── src │ │ ├── app.app.src │ │ ├── app_app.erl │ │ └── app_sup.erl │ └── LICENSE ├── escript │ ├── README.md │ ├── .gitignore │ ├── src │ │ ├── escript.app.src │ │ └── escript.erl │ ├── rebar.config │ └── LICENSE ├── app.src │ └── jsx │ │ └── jsx.app.src ├── sys.config │ └── sys.config └── rebar.config │ └── hackney │ └── rebar.config ├── .formatter.exs ├── lib ├── shaker │ ├── parsers │ │ ├── parsers.ex │ │ ├── sysconfig.ex │ │ ├── common.ex │ │ ├── app_src.ex │ │ └── rebar_config.ex │ ├── generator │ │ ├── generator.ex │ │ ├── config.ex │ │ ├── function.ex │ │ └── mix.ex │ ├── model │ │ ├── model.ex │ │ ├── config.ex │ │ └── mix.ex │ ├── resolver │ │ ├── resolver.ex │ │ ├── dialyzer.ex │ │ └── deps.ex │ ├── renderer.ex │ └── errors.ex ├── mix │ └── tasks │ │ ├── sys2config.ex │ │ └── rebar2mix.ex └── shaker.ex ├── .gitignore ├── mix.exs ├── mix.lock └── README.md /priv/lib/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /priv/lib/src/lib.erl: -------------------------------------------------------------------------------- 1 | -module(lib). 2 | 3 | -export([]). 4 | -------------------------------------------------------------------------------- /priv/release/config/sys.config: -------------------------------------------------------------------------------- 1 | [ 2 | {release, []} 3 | ]. 4 | -------------------------------------------------------------------------------- /priv/plugin/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. -------------------------------------------------------------------------------- /priv/release/config/vm.args: -------------------------------------------------------------------------------- 1 | -sname release 2 | 3 | -setcookie release_cookie 4 | 5 | +K true 6 | +A30 7 | -------------------------------------------------------------------------------- /.formatter.exs: -------------------------------------------------------------------------------- 1 | # Used by "mix format" 2 | [ 3 | inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] 4 | ] 5 | -------------------------------------------------------------------------------- /priv/lib/README.md: -------------------------------------------------------------------------------- 1 | lib 2 | ===== 3 | 4 | An OTP library 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /priv/app/README.md: -------------------------------------------------------------------------------- 1 | app 2 | ===== 3 | 4 | An OTP application 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /priv/release/README.md: -------------------------------------------------------------------------------- 1 | release 2 | ===== 3 | 4 | An OTP application 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | -------------------------------------------------------------------------------- /priv/app/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {shell, [ 5 | % {config, "config/sys.config"}, 6 | {apps, [app]} 7 | ]}. 8 | -------------------------------------------------------------------------------- /priv/escript/README.md: -------------------------------------------------------------------------------- 1 | escript 2 | ===== 3 | 4 | An escript 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 escriptize 10 | 11 | Run 12 | --- 13 | 14 | $ _build/default/bin/escript 15 | -------------------------------------------------------------------------------- /priv/plugin/src/plugin.erl: -------------------------------------------------------------------------------- 1 | -module(plugin). 2 | 3 | -export([init/1]). 4 | 5 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 6 | init(State) -> 7 | {ok, State1} = plugin_prv:init(State), 8 | {ok, State1}. 9 | -------------------------------------------------------------------------------- /lib/shaker/parsers/parsers.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Parsers do 2 | 3 | @moduledoc """ 4 | Simple behaviour for file parsers 5 | """ 6 | 7 | @callback parse(Shaker.Model.Mix.t(), Path.t()) :: Shaker.Model.Mix.t() 8 | 9 | end 10 | -------------------------------------------------------------------------------- /lib/shaker/generator/generator.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Generator do 2 | 3 | @moduledoc """ 4 | Simple behaviour for modules generating ASTs from Models 5 | """ 6 | 7 | @callback gen(atom(), Shaker.Model.t()) :: Macro.t() 8 | 9 | end 10 | -------------------------------------------------------------------------------- /priv/app/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | logs 15 | _build 16 | .idea 17 | *.iml 18 | rebar3.crashdump 19 | *~ 20 | -------------------------------------------------------------------------------- /priv/lib/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | logs 15 | _build 16 | .idea 17 | *.iml 18 | rebar3.crashdump 19 | *~ 20 | -------------------------------------------------------------------------------- /lib/shaker/model/model.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Model do 2 | 3 | @moduledoc """ 4 | Models are structures representing configs in different enviroments 5 | """ 6 | 7 | @type t :: Shaker.Model.Mix.t() | Shaker.Model.Config.t() 8 | 9 | end 10 | -------------------------------------------------------------------------------- /priv/escript/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | logs 15 | _build 16 | .idea 17 | *.iml 18 | rebar3.crashdump 19 | *~ 20 | -------------------------------------------------------------------------------- /priv/plugin/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | logs 15 | _build 16 | .idea 17 | *.iml 18 | rebar3.crashdump 19 | *~ 20 | -------------------------------------------------------------------------------- /priv/release/.gitignore: -------------------------------------------------------------------------------- 1 | .rebar3 2 | _* 3 | .eunit 4 | *.o 5 | *.beam 6 | *.plt 7 | *.swp 8 | *.swo 9 | .erlang.cookie 10 | ebin 11 | log 12 | erl_crash.dump 13 | .rebar 14 | logs 15 | _build 16 | .idea 17 | *.iml 18 | rebar3.crashdump 19 | *~ 20 | -------------------------------------------------------------------------------- /lib/shaker/model/config.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Model.Config do 2 | 3 | @type t :: %{{atom(), atom()} => any()} 4 | 5 | @spec put(t(), atom(), atom(), any()) :: t() 6 | def put(model, app, param, value) do 7 | Map.put(model, {app, param}, value) 8 | end 9 | 10 | end 11 | -------------------------------------------------------------------------------- /lib/shaker/resolver/resolver.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Resolver do 2 | 3 | @moduledoc "Behaviour for Options Resolvers" 4 | 5 | @doc """ 6 | Resolves data and returns resolved data or error 7 | """ 8 | @callback convert(any()) :: {:ok, {atom(), any()}} | {:error, any()} 9 | 10 | end 11 | -------------------------------------------------------------------------------- /priv/lib/src/lib.app.src: -------------------------------------------------------------------------------- 1 | {application, lib, 2 | [{description, "An OTP library"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {licenses, ["Apache 2.0"]}, 13 | {links, []} 14 | ]}. 15 | -------------------------------------------------------------------------------- /priv/escript/src/escript.app.src: -------------------------------------------------------------------------------- 1 | {application, escript, 2 | [{description, "An escript"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {licenses, ["Apache 2.0"]}, 13 | {links, []} 14 | ]}. 15 | -------------------------------------------------------------------------------- /priv/plugin/src/plugin.app.src: -------------------------------------------------------------------------------- 1 | {application, plugin, 2 | [{description, "A rebar plugin"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {applications, 6 | [kernel, 7 | stdlib 8 | ]}, 9 | {env,[]}, 10 | {modules, []}, 11 | 12 | {licenses, ["Apache 2.0"]}, 13 | {links, []} 14 | ]}. 15 | -------------------------------------------------------------------------------- /priv/app/src/app.app.src: -------------------------------------------------------------------------------- 1 | {application, app, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, {app_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {licenses, ["Apache 2.0"]}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /priv/escript/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [no_debug_info]}. 2 | {deps, []}. 3 | 4 | {escript_incl_apps, 5 | [escript]}. 6 | {escript_main_app, escript}. 7 | {escript_name, escript}. 8 | {escript_emu_args, "%%! +sbtu +A1\n"}. 9 | 10 | %% Profiles 11 | {profiles, [{test, 12 | [{erl_opts, [debug_info]} 13 | ]}]}. 14 | -------------------------------------------------------------------------------- /priv/release/apps/release/src/release.app.src: -------------------------------------------------------------------------------- 1 | {application, release, 2 | [{description, "An OTP application"}, 3 | {vsn, "0.1.0"}, 4 | {registered, []}, 5 | {mod, {release_app, []}}, 6 | {applications, 7 | [kernel, 8 | stdlib 9 | ]}, 10 | {env,[]}, 11 | {modules, []}, 12 | 13 | {licenses, ["Apache 2.0"]}, 14 | {links, []} 15 | ]}. 16 | -------------------------------------------------------------------------------- /priv/app/src/app_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc app public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(app_app). 7 | 8 | -behaviour(application). 9 | 10 | -export([start/2, stop/1]). 11 | 12 | start(_StartType, _StartArgs) -> 13 | app_sup:start_link(). 14 | 15 | stop(_State) -> 16 | ok. 17 | 18 | %% internal functions 19 | -------------------------------------------------------------------------------- /priv/release/apps/release/src/release_app.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc release public API 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(release_app). 7 | 8 | -behaviour(application). 9 | 10 | -export([start/2, stop/1]). 11 | 12 | start(_StartType, _StartArgs) -> 13 | release_sup:start_link(). 14 | 15 | stop(_State) -> 16 | ok. 17 | 18 | %% internal functions 19 | -------------------------------------------------------------------------------- /priv/plugin/README.md: -------------------------------------------------------------------------------- 1 | plugin 2 | ===== 3 | 4 | A rebar plugin 5 | 6 | Build 7 | ----- 8 | 9 | $ rebar3 compile 10 | 11 | Use 12 | --- 13 | 14 | Add the plugin to your rebar config: 15 | 16 | {plugins, [ 17 | {plugin, {git, "https://host/user/plugin.git", {tag, "0.1.0"}}} 18 | ]}. 19 | 20 | Then just call your plugin directly in an existing application: 21 | 22 | 23 | $ rebar3 plugin 24 | ===> Fetching plugin 25 | ===> Compiling plugin 26 | 27 | -------------------------------------------------------------------------------- /priv/release/rebar.config: -------------------------------------------------------------------------------- 1 | {erl_opts, [debug_info]}. 2 | {deps, []}. 3 | 4 | {relx, [{release, {release, "0.1.0"}, 5 | [release, 6 | sasl]}, 7 | 8 | {sys_config, "./config/sys.config"}, 9 | {vm_args, "./config/vm.args"}, 10 | 11 | {dev_mode, true}, 12 | {include_erts, false}, 13 | 14 | {extended_start_script, true}] 15 | }. 16 | 17 | {profiles, [{prod, [{relx, [{dev_mode, false}, 18 | {include_erts, true}]}] 19 | }] 20 | }. -------------------------------------------------------------------------------- /lib/shaker/resolver/dialyzer.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Resolver.Dialyzer do 2 | 3 | @moduledoc """ 4 | Module to convert Dialyzer config to Dialyxir config 5 | """ 6 | 7 | @behaviour Shaker.Resolver 8 | 9 | @bad_configs ~w[plt_apps]a 10 | 11 | def convert({:warnings, warnings}) do 12 | {:ok, {:flags, warnings}} 13 | end 14 | 15 | def convert({key, _} = pair) when key not in @bad_configs do 16 | {:ok, pair} 17 | end 18 | 19 | def convert({key, _}) do 20 | {:error, {:bad_dialyzer_key, key}} 21 | end 22 | 23 | end 24 | -------------------------------------------------------------------------------- /priv/escript/src/escript.erl: -------------------------------------------------------------------------------- 1 | -module(escript). 2 | 3 | %% API exports 4 | -export([main/1]). 5 | 6 | %%==================================================================== 7 | %% API functions 8 | %%==================================================================== 9 | 10 | %% escript Entry point 11 | main(Args) -> 12 | io:format("Args: ~p~n", [Args]), 13 | erlang:halt(0). 14 | 15 | %%==================================================================== 16 | %% Internal functions 17 | %%==================================================================== 18 | -------------------------------------------------------------------------------- /lib/shaker/renderer.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Renderer do 2 | @moduledoc """ 3 | Renders quoted code to the file 4 | """ 5 | 6 | @spec render(Macro.t(), Path.t()) :: :ok 7 | def render(quoted, file_name) do 8 | string = 9 | quoted 10 | |> Macro.to_string() 11 | |> String.replace(~r/(defmodule|defp|def)\((.*)\) do/, "\\1 \\2 do") 12 | |> String.replace(~r/(defmodule|defp|def) (.*)\(\) do/, "\\1 \\2 do") 13 | |> String.replace(~r/(use|import|config)\((.*)\)\n/, "\\1 \\2\n") 14 | 15 | File.write!(file_name, string) 16 | end 17 | 18 | end 19 | -------------------------------------------------------------------------------- /priv/app.src/jsx/jsx.app.src: -------------------------------------------------------------------------------- 1 | {application, jsx, 2 | [ 3 | {description, "a streaming, evented json parsing toolkit"}, 4 | {vsn, "3.0.0"}, 5 | {modules, [ 6 | jsx, 7 | jsx_encoder, 8 | jsx_decoder, 9 | jsx_parser, 10 | jsx_to_json, 11 | jsx_to_term, 12 | jsx_config, 13 | jsx_verify 14 | ]}, 15 | {registered, []}, 16 | {applications, [ 17 | kernel, 18 | stdlib 19 | ]}, 20 | {env, []}, 21 | 22 | {licenses, ["MIT"]}, 23 | {links, [{"Github", "https://github.com/talentdeficit/jsx"}]} 24 | ]}. -------------------------------------------------------------------------------- /lib/shaker/generator/config.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Generator.Config do 2 | 3 | @moduledoc """ 4 | Generates config file from config model 5 | """ 6 | 7 | @behaviour Shaker.Generator 8 | 9 | def gen(_, model) do 10 | model 11 | |> Enum.map(fn {{app, param}, value} -> 12 | value = Macro.escape(value) 13 | quote do 14 | config unquote(app), unquote(param), unquote(value) 15 | end 16 | end) 17 | |> to_config() 18 | end 19 | 20 | defp to_config(quoteds) do 21 | quote do 22 | import Config 23 | unquote_splicing(quoteds) 24 | end 25 | |> IO.inspect() 26 | end 27 | 28 | end 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 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. 14 | /.fetch 15 | 16 | # If the VM crashes, it generates a dump, let's ignore it too. 17 | erl_crash.dump 18 | 19 | # Also ignore archive artifacts (built via "mix archive.build"). 20 | *.ez 21 | 22 | # Ignore package tarball (built via "mix hex.build"). 23 | shaker-*.tar 24 | 25 | # ElixirLS 26 | /.elixir_ls/ 27 | -------------------------------------------------------------------------------- /lib/mix/tasks/sys2config.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.Sys2config do 2 | use Mix.Task 3 | 4 | @shortdoc "Generates config.exs from sys.config file" 5 | @moduledoc """ 6 | Generates config.exs from sys.config file 7 | 8 | Usage: 9 | ``` 10 | $ mix rebar2mix 11 | ``` 12 | """ 13 | 14 | alias Shaker.Generator.Config, as: Generator 15 | alias Shaker.Renderer 16 | 17 | def run([]), do: run(["sys.config"]) 18 | def run([input]), do: run([input, "config.exs"]) 19 | def run([input, output]) do 20 | model = Shaker.Parsers.Sysconfig.parse(%{}, input) 21 | Generator.gen(nil, model) 22 | |> Renderer.render(output) 23 | 24 | Mix.Task.run("format", [output]) 25 | end 26 | 27 | end 28 | -------------------------------------------------------------------------------- /lib/shaker/parsers/sysconfig.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Parsers.Sysconfig do 2 | 3 | @moduledoc """ 4 | Parser to parse sys.config into config model 5 | """ 6 | 7 | @behaviour Shaker.Parsers 8 | 9 | alias Shaker.Model.Config, as: Model 10 | 11 | def parse(model, path_to_sys_config) do 12 | case :file.consult(path_to_sys_config) do 13 | {:ok, config} -> do_parse(model, config) 14 | error -> Mix.raise inspect(error) 15 | end 16 | end 17 | 18 | def do_parse(model, [config]) do 19 | Enum.reduce( 20 | config, 21 | model, 22 | &proceed_sys_config_entry/2 23 | ) 24 | end 25 | 26 | defp proceed_sys_config_entry({app, app_cfg}, model) do 27 | Enum.reduce(app_cfg, model, fn {param, value}, model -> 28 | Model.put(model, app, param, value) 29 | end) 30 | end 31 | 32 | end 33 | -------------------------------------------------------------------------------- /lib/shaker/generator/function.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Generator.Function do 2 | 3 | @moduledoc """ 4 | Generates quoted def-functions 5 | """ 6 | 7 | @type option :: {:no_escape, boolean()} | {:private, boolean()} 8 | @type options :: [option()] 9 | 10 | @spec gen_one(atom(), any(), options()) :: Macro.t() 11 | def gen_one(name, body, opts \\ []) do 12 | gen_func(name, [], body, opts) 13 | end 14 | 15 | @spec gen_clauses(atom(), Keyword.t(), options()) :: Macro.t() 16 | def gen_clauses(name, clauses, opts \\ []) do 17 | Enum.map(clauses, fn {arg, code} -> 18 | gen_func(name, [arg], code, opts) 19 | end) 20 | end 21 | 22 | defp gen_func(name, args, body, opts) do 23 | body = if(opts[:no_escape], do: body, else: Macro.escape(body)) 24 | d = if(opts[:private], do: quote(do: defp), else: quote(do: def)) 25 | quote do 26 | unquote(d)(unquote(name)(unquote_splicing(args))) do 27 | unquote(body) 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /mix.exs: -------------------------------------------------------------------------------- 1 | defmodule Shaker.MixProject do 2 | use Mix.Project 3 | 4 | @app :shaker 5 | @version "0.1.0" 6 | 7 | def project do 8 | [ 9 | app: @app, 10 | version: @version, 11 | elixir: "~> 1.10", 12 | start_permanent: Mix.env() == :prod, 13 | deps: deps(), 14 | aliases: aliases() 15 | ] 16 | end 17 | 18 | def application do 19 | [ 20 | extra_applications: [:logger] 21 | ] 22 | end 23 | 24 | defp aliases() do 25 | [ 26 | build: [&build_releases/1], 27 | reinstall: ["build", &reinstall_archive/1] 28 | ] 29 | end 30 | 31 | defp build_releases(_) do 32 | Mix.env(:prod) 33 | Mix.Tasks.Compile.run([]) 34 | Mix.Tasks.Compile.run([]) 35 | Mix.Tasks.Archive.Build.run(["--output=./#{@app}-archive/#{@app}-#{@version}.ez"]) 36 | File.cp("./#{@app}-archive/#{@app}-#{@version}.ez", "./#{@app}-archive/#{@app}.ez") 37 | end 38 | 39 | defp reinstall_archive(_) do 40 | Mix.Tasks.Archive.Install.run(["#{@app}-archive/#{@app}.ez", "--force"]) 41 | end 42 | 43 | defp deps do 44 | [ 45 | {:dialyxir, "~> 1.0.0", only: :dev, runtime: false}, 46 | {:credo, "~> 1.1", only: :dev, runtime: false} 47 | ] 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /mix.lock: -------------------------------------------------------------------------------- 1 | %{ 2 | "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, 3 | "credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"}, 4 | "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"}, 5 | "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, 6 | "jason": {:hex, :jason, "1.2.2", "ba43e3f2709fd1aa1dce90aaabfd039d000469c05c56f0b8e31978e03fa39052", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "18a228f5f0058ee183f29f9eae0805c6e59d61c3b006760668d8d18ff0d12179"}, 7 | } 8 | -------------------------------------------------------------------------------- /priv/app/src/app_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc app top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(app_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | -export([start_link/0]). 11 | 12 | -export([init/1]). 13 | 14 | -define(SERVER, ?MODULE). 15 | 16 | start_link() -> 17 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 18 | 19 | %% sup_flags() = #{strategy => strategy(), % optional 20 | %% intensity => non_neg_integer(), % optional 21 | %% period => pos_integer()} % optional 22 | %% child_spec() = #{id => child_id(), % mandatory 23 | %% start => mfargs(), % mandatory 24 | %% restart => restart(), % optional 25 | %% shutdown => shutdown(), % optional 26 | %% type => worker(), % optional 27 | %% modules => modules()} % optional 28 | init([]) -> 29 | SupFlags = #{strategy => one_for_all, 30 | intensity => 0, 31 | period => 1}, 32 | ChildSpecs = [], 33 | {ok, {SupFlags, ChildSpecs}}. 34 | 35 | %% internal functions 36 | -------------------------------------------------------------------------------- /lib/shaker/parsers/common.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Parsers.Common do 2 | 3 | @moduledoc """ 4 | Common functions for Parsers 5 | """ 6 | 7 | def read_from(root_path, wildcard) do 8 | root_path 9 | |> Path.join(wildcard) 10 | |> Path.wildcard() 11 | |> Enum.filter(fn x -> not (x =~ "/deps/") end) 12 | |> case do 13 | [] -> 14 | {:error, :bad_file} 15 | 16 | paths -> 17 | paths 18 | |> select_from_many() 19 | |> :file.consult() 20 | end 21 | end 22 | 23 | def stringify_values(keyword) do 24 | Enum.map(keyword, fn {k, v} -> 25 | if is_list(v) and List.ascii_printable?(v) do 26 | {k, to_string(v)} 27 | else 28 | {k, v} 29 | end 30 | end) 31 | end 32 | 33 | @spec select_from_many([Path.t()]) :: Path.t() 34 | defp select_from_many([path]), do: path 35 | defp select_from_many(paths) do 36 | Mix.shell().info("") 37 | paths 38 | |> Enum.with_index() 39 | |> Enum.each(fn {path, index} -> 40 | Mix.shell().info("#{index} #{path}") 41 | end) 42 | {index, _} = 43 | Mix.shell().prompt("Please select right path (Enter number)> ") 44 | |> Integer.parse() 45 | 46 | Enum.at(paths, index) 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /priv/release/apps/release/src/release_sup.erl: -------------------------------------------------------------------------------- 1 | %%%------------------------------------------------------------------- 2 | %% @doc release top level supervisor. 3 | %% @end 4 | %%%------------------------------------------------------------------- 5 | 6 | -module(release_sup). 7 | 8 | -behaviour(supervisor). 9 | 10 | -export([start_link/0]). 11 | 12 | -export([init/1]). 13 | 14 | -define(SERVER, ?MODULE). 15 | 16 | start_link() -> 17 | supervisor:start_link({local, ?SERVER}, ?MODULE, []). 18 | 19 | %% sup_flags() = #{strategy => strategy(), % optional 20 | %% intensity => non_neg_integer(), % optional 21 | %% period => pos_integer()} % optional 22 | %% child_spec() = #{id => child_id(), % mandatory 23 | %% start => mfargs(), % mandatory 24 | %% restart => restart(), % optional 25 | %% shutdown => shutdown(), % optional 26 | %% type => worker(), % optional 27 | %% modules => modules()} % optional 28 | init([]) -> 29 | SupFlags = #{strategy => one_for_all, 30 | intensity => 0, 31 | period => 1}, 32 | ChildSpecs = [], 33 | {ok, {SupFlags, ChildSpecs}}. 34 | 35 | %% internal functions 36 | -------------------------------------------------------------------------------- /priv/plugin/src/plugin_prv.erl: -------------------------------------------------------------------------------- 1 | -module(plugin_prv). 2 | 3 | -export([init/1, do/1, format_error/1]). 4 | 5 | -define(PROVIDER, plugin). 6 | -define(DEPS, [app_discovery]). 7 | 8 | %% =================================================================== 9 | %% Public API 10 | %% =================================================================== 11 | -spec init(rebar_state:t()) -> {ok, rebar_state:t()}. 12 | init(State) -> 13 | Provider = providers:create([ 14 | {name, ?PROVIDER}, % The 'user friendly' name of the task 15 | {module, ?MODULE}, % The module implementation of the task 16 | {bare, true}, % The task can be run by the user, always true 17 | {deps, ?DEPS}, % The list of dependencies 18 | {example, "rebar3 plugin"}, % How to use the plugin 19 | {opts, []}, % list of options understood by the plugin 20 | {short_desc, "A rebar plugin"}, 21 | {desc, "A rebar plugin"} 22 | ]), 23 | {ok, rebar_state:add_provider(State, Provider)}. 24 | 25 | 26 | -spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. 27 | do(State) -> 28 | {ok, State}. 29 | 30 | -spec format_error(any()) -> iolist(). 31 | format_error(Reason) -> 32 | io_lib:format("~p", [Reason]). 33 | -------------------------------------------------------------------------------- /priv/sys.config/sys.config: -------------------------------------------------------------------------------- 1 | %% -*- mode: erlang -*- 2 | [ 3 | {mtproto_proxy, 4 | %% see src/mtproto_proxy.app.src for examples. 5 | [ 6 | %% PUT YOUR CUSTOM SETTINGS BELOW vvvvv 7 | 8 | %% {ports, 9 | %% [#{name => mtp_handler_1, 10 | %% listen_ip => "0.0.0.0", 11 | %% port => 1443, 12 | %% secret => <<"d0d6e111bada5511fcce9584deadbeef">>, 13 | %% tag => <<"dcbe8f1493fa4cd9ab300891c0b5b326">>} 14 | %% ]} 15 | %% ^^^^^ END 16 | ]}, 17 | 18 | %% Logging config 19 | {lager, 20 | [{log_root, "/var/log/mtproto-proxy"}, 21 | {crash_log, "crash.log"}, 22 | {handlers, 23 | [ 24 | {lager_console_backend, 25 | [{level, critical}]}, 26 | 27 | {lager_file_backend, 28 | [{file, "application.log"}, 29 | {level, info}, 30 | 31 | %% Do fsync only on critical messages 32 | {sync_on, critical}, 33 | %% If we logged more than X messages in a second, flush the rest 34 | {high_water_mark, 300}, 35 | %% If we hit hwm and msg queue len is >X, flush the queue 36 | {flush_queue, true}, 37 | {flush_threshold, 2000}, 38 | %% How often to check if log should be rotated 39 | {check_interval, 5000}, 40 | %% Rotate when file size is 100MB+ 41 | {size, 104857600} 42 | ]} 43 | ]}]}, 44 | {sasl, 45 | [{errlog_type, error}]} 46 | ]. 47 | -------------------------------------------------------------------------------- /lib/shaker.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker do 2 | 3 | @moduledoc """ 4 | Rebar to Mix migration tool 5 | 6 | --- 7 | 8 | Project description for developers: 9 | 10 | ### Short algorithm description 11 | 12 | Entrypoint: lib/mix/tasks/rebar2mix.ex 13 | This task parses command line arguments, detects if application is in umbrella. 14 | Then, for each detected application, it creates model, detects *.app.src and rebar.config 15 | file and fills model with values from these files. 16 | Then task resolves errors occured during filling with `Shaker.Errors`. 17 | Then, task generates quoted module with `Shaker.Generator.Mix` from filled model. 18 | Then task renders quoted module to file with `Shaker.Renderer` 19 | 20 | ### Model 21 | 22 | Model is a structure which contains representation of some mix project file 23 | It can be `mix.exs` or `config.exs` which is going to be implemented soon. 24 | Model contains data for each MIX_ENV and Model can manipulate it 25 | 26 | ### Filling 27 | 28 | Filling consists of parsing files with Parsers, resolving special cases with Resolvers. 29 | Each resolver and parser must refer to special behaviour to make further development easier. 30 | Our principles behind filling are minimal interaction with user and mix-style compliance. 31 | For example: thought we can implement overrides with creating aliases, this won't be mix-way. 32 | """ 33 | 34 | end 35 | -------------------------------------------------------------------------------- /priv/rebar.config/hackney/rebar.config: -------------------------------------------------------------------------------- 1 | %% -*- tab-width: 4;erlang-indent-level: 4;indent-tabs-mode: nil -*- 2 | %% ex: ft=erlang ts=4 sw=4 et 3 | 4 | {erl_opts, [debug_info, 5 | {platform_define, "R14", no_callback_support}, 6 | {platform_define, "^[0-9]+", namespaced_types}, 7 | {platform_define, "^R", no_proxy_sni_support}, 8 | {platform_define, "^(19)|(20)", no_customize_hostname_check}, 9 | {platform_define, "^20\.3", buggy_chacha_ciphers} 10 | ]}. 11 | 12 | {erl_first_files, 13 | ["src/hackney_ssl_certificate.erl" % required by `hackney_ssl' at compile time 14 | ]}. 15 | 16 | {xref_checks, [undefined_function_calls]}. 17 | 18 | {cover_enabled, true}. 19 | {eunit_opts, [verbose]}. 20 | 21 | {post_hooks, [{clean, "rm -rf *~ */*~ */*.xfm test/*.beam"}]}. 22 | 23 | {deps, [ 24 | {idna, "6.0.1"}, 25 | {mimerl, "~>1.1"}, 26 | {certifi, "2.5.2"}, 27 | {metrics, "1.0.1"}, 28 | {parse_trans, "3.3.0"}, 29 | {ssl_verify_fun, "1.1.6"}, 30 | {unicode_util_compat, "0.5.0"} 31 | ]}. 32 | 33 | {profiles, [{docs, [{deps, 34 | [ 35 | {edown, 36 | {git, "https://github.com/uwiger/edown.git", 37 | {tag, "0.8.1"}}} 38 | ]}, 39 | 40 | {edoc_opts, [{doclet, edown_doclet}, 41 | {packages, false}, 42 | {subpackages, true}, 43 | {top_level_readme, 44 | {"./README.md", "http://github.com/benoitc/hackney"}}]}]}, 45 | {test, [ 46 | {deps, [{cowboy, "1.1.2"}, {jsone, "1.4.7"}]} 47 | ]} 48 | ]}. 49 | 50 | 51 | %% == Dialyzer == 52 | %% 53 | {dialyzer, [ 54 | {warnings, [ 55 | race_conditions, 56 | no_return, 57 | unmatched_returns, 58 | error_handling%, 59 | %unknown 60 | ]}, 61 | {plt_apps, top_level_deps}, 62 | {plt_extra_apps, []}, 63 | {plt_location, local}, 64 | {plt_prefix, "hackney"}, 65 | {base_plt_location, "."}, 66 | {base_plt_prefix, "hackney"} 67 | ]}. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Shaker 2 | 3 | **Shaker** - CLI tool, that automates migrations from `Rebar3` into `Mix` for Erlang projects of any kind. It supports: 4 | 5 | * Applications 6 | * Libraries 7 | * Escripts 8 | * Releases (not yet) 9 | * Erlang test-lint tools support (`eunit`, `ct`, `elvis`) 10 | * Any other tools you can imagine as an Erlang project 11 | 12 | ## The problem 13 | 14 | While **Mix** tools is perfect for both `Erlang` and `Elixir` projects, it's not so much distributed inside `Erlang`'s world. One of the main reasons - severity of migration **already existing** projects from one package manager into another. 15 | 16 | This process *can* and *must* be automated. **Shaker** tries to eliminate this gap. 17 | 18 | ## Quick start 19 | 20 | Project is made in a form of a `mix archive`, which can be simply installed from **Hex**: 21 | 22 | ```bash 23 | $ mix archive.install hex shaker 24 | ``` 25 | 26 | This installation brings to a user a new `mix` command: 27 | 28 | ```bash 29 | $ mix rebar2mix 30 | ``` 31 | 32 | This command must be executed inside any valid **Rebar3** project, with next effects: 33 | 34 | 1. An interactive process of `mix project` generation starts 35 | 1. During the process user can be prompted to choose different options and configurations 36 | 1. After the process is finished - `mix project` artifacts are created in the manner, when the project itself is ready 37 | to run inside a `mix` package management tool. 38 | 39 | 40 | For example 41 | 42 | ```bash 43 | $ mix deps.get 44 | $ iex -S mix 45 | $ mix test 46 | $ mix compile 47 | $ mix deps.get 48 | ``` 49 | 50 | will be available to run as in a standard `mix` project. 51 | 52 | You can also run other task to generate `config.exs` file from `sys.config` 53 | 54 | ```bash 55 | $ mix sys2config 56 | ``` 57 | 58 | ## Roadmap 59 | 60 | 1. Improve the code quality - making refactoring, adding more tests, docs and specs 61 | 2. Implementing more and more uncovered `Rebar3` features, until full coverage. 62 | 3. Relx 63 | 4. `sys.config` detection 64 | 5. Overrides handling 65 | 66 | ## Contributions 67 | 68 | Project is still in an active development phase so feel free to submit any Issues or Pull requests! 69 | -------------------------------------------------------------------------------- /lib/shaker/resolver/deps.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Resolver.Deps do 2 | 3 | @moduledoc """ 4 | Module to convert rebar deps to mix deps 5 | """ 6 | 7 | @behaviour Shaker.Resolver 8 | 9 | defguardp is_git(t) when is_tuple(t) and 10 | ((:erlang.element(1, t) == :git) or (:erlang.element(1, t) == :git_subdir)) 11 | 12 | def convert(dep_name) when is_atom(dep_name) do 13 | {:ok, {dep_name, ">= 0.0.0"}} 14 | end 15 | 16 | def convert({dep_name, dep_version}) when is_atom(dep_name) and is_list(dep_version) do 17 | case Version.parse_requirement("#{dep_version}") do 18 | {:ok, requirement} -> 19 | {:ok, {dep_name, "#{requirement}"}} 20 | 21 | :error -> 22 | case Version.parse("#{dep_version}") do 23 | {:ok, version} -> {:ok, {dep_name, "== #{version}"}} 24 | :error -> {:error, {:deps, :parse, {dep_name, dep_version}}} 25 | end 26 | end 27 | end 28 | 29 | # Source dependencies 30 | 31 | # Git 32 | def convert({dep_name, t}) when is_git(t) and is_atom(dep_name) do 33 | {:ok, {dep_name, convert_git(t)}} 34 | end 35 | def convert({dep_name, b, t}) when is_list(b) and is_git(t) and is_atom(dep_name) do 36 | {:ok, {dep_name, convert_git(t)}} 37 | end 38 | 39 | # Hg is not supported 40 | def convert({dep_name, {:hg, _}}) when is_atom(dep_name) do 41 | {:error, {:deps, :hg, dep_name}} 42 | end 43 | 44 | # HG with refs 45 | def convert({dep_name, {:hg, _, _}}) when is_atom(dep_name) do 46 | {:error, {:deps, :hg, dep_name}} 47 | end 48 | 49 | def convert(dep_record) do 50 | case elem(dep_record, 0) do 51 | dep when is_atom(dep) -> {:error, {:unknown_dep, dep}} 52 | _ -> {:error, {:deps, :parse, dep_record}} 53 | end 54 | end 55 | 56 | defp convert_git({:git, repo_url, {ref_type, ref_value}}) do 57 | [{:git, "#{repo_url}"}, {ref_type, "#{ref_value}"}] 58 | end 59 | defp convert_git({:git, repo_url}) do 60 | [{:git, "#{repo_url}"}] 61 | end 62 | defp convert_git({:git, repo_url, 'HEAD'}) do 63 | [{:git, "#{repo_url}"}] 64 | end 65 | defp convert_git({:git_subdir, repo_url, {ref_type, ref_value}, subdir_path}) do 66 | [{:git, "#{repo_url}"}, {ref_type, "#{ref_value}"}, {:sparse, "#{subdir_path}"}] 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/shaker/errors.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Errors do 2 | 3 | @moduledoc """ 4 | Resolves occured errors in model 5 | """ 6 | 7 | @ignore_keys ~w[plugins xref_checks xref_queries 8 | erl_files_first provider_hooks]a 9 | 10 | alias Shaker.Model.Mix, as: Model 11 | 12 | @spec render_until_empty(Model.t()) :: Model.t() 13 | def render_until_empty(%{"$errors": []} = model), do: model 14 | def render_until_empty(model) do 15 | render_until_empty(render(model)) 16 | end 17 | 18 | @spec render(Model.t()) :: Model.t() 19 | def render(%{"$errors": errors} = model) do 20 | errors 21 | |> List.flatten() 22 | |> Enum.reduce(%{model | "$errors": []}, &render_one/2) 23 | end 24 | 25 | @spec render_one(any(), Model.t()) :: Model.t() 26 | defp render_one({:erl_opts, :platform_define, _, _}, model) do 27 | Mix.shell().error("Mix can't handle `platform_define`") 28 | model 29 | end 30 | defp render_one({:overrides, _}, model) do 31 | Mix.shell().error("Overrides are not supported right now") 32 | model 33 | end 34 | defp render_one({:edoc_opts, _}, model) do 35 | Mix.shell().info("Can't add edoc, you can use ExDoc instead") 36 | model 37 | #if Mix.shell().yes?("Add ex_doc?") do 38 | #model 39 | #|> Model.append(:deps, :ex_doc, "~> 0.18.0", :dev) 40 | #|> Model.put(:docs, []) 41 | #else 42 | #model 43 | #end 44 | end 45 | defp render_one({:vsn, vsn}, model) do 46 | Mix.shell().error("Mix can't specify versions like #{inspect vsn}") 47 | Mix.shell().info("Creating version 0.0.1") 48 | Model.put(model, :version, "0.0.1") 49 | end 50 | defp render_one(t, model) when is_tuple(t) and :erlang.element(1, t) in @ignore_keys, do: model 51 | defp render_one({:minimum_otp_version, _}, model) do 52 | Mix.shell().info("Mix doesn't support minimum otp version setting") 53 | model 54 | end 55 | defp render_one({:relx, _}, model) do 56 | Mix.shell().error("Relx releases are not supported right now") 57 | model 58 | end 59 | defp render_one({k, _} = error, model) do 60 | # Explicitly silences xref and cover params 61 | case Atom.to_string(k) do 62 | "cover" <> _ -> nil 63 | "xref" <> _ -> nil 64 | _ -> Mix.shell().info("Error: #{inspect error, pretty: true}") 65 | end 66 | model 67 | end 68 | 69 | end 70 | -------------------------------------------------------------------------------- /lib/shaker/parsers/app_src.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Parsers.AppSrc do 2 | 3 | @moduledoc """ 4 | Parses app.src file 5 | """ 6 | 7 | @behaviour Shaker.Parsers 8 | 9 | alias Shaker.Parsers.Common 10 | alias Shaker.Model.Mix, as: Model 11 | 12 | @app_src_file_wildcard "**/*.app.src" 13 | @autoloaded_erlang_applications ~w[kernel stdlib elixir]a 14 | 15 | def parse(model, root_path) do 16 | case Common.read_from(root_path, @app_src_file_wildcard) do 17 | {:ok, [{:application, name, kw}]} -> do_parse(model, name, kw) 18 | error -> Model.add_errors(model, [{:app_src, error}]) 19 | end 20 | end 21 | 22 | defp do_parse(model, app_name, app_keyword) do 23 | Enum.reduce( 24 | app_keyword, 25 | initial_structure(model, app_name), 26 | &proceed_app_src_entry/2 27 | ) 28 | end 29 | 30 | @spec initial_structure(Model.t(), app_name :: atom()) :: map() 31 | defp initial_structure(model, app_name) do 32 | model 33 | |> Model.put(:app, app_name) 34 | |> Model.put(:package, %{name: :erlang.atom_to_binary(app_name)}) 35 | end 36 | 37 | defp proceed_app_src_entry({:description, description}, model) do 38 | Model.put(model, :description, :erlang.list_to_binary(description)) 39 | end 40 | 41 | defp proceed_app_src_entry({:vsn, version} = pair, model) do 42 | if is_list(version) and List.ascii_printable?(version) do 43 | Model.put(model, :version, :erlang.list_to_binary(version)) 44 | else 45 | Model.add_errors(model, [pair]) 46 | end 47 | end 48 | 49 | defp proceed_app_src_entry({:mod, mod}, model) do 50 | # Mod goes as-is - basically it's a tuple 51 | Model.put(model, :mod, mod) 52 | end 53 | 54 | defp proceed_app_src_entry({:applications, apps}, model) do 55 | # applications in mix are defined as extra_applications 56 | Model.put(model, :extra_applications, apps -- @autoloaded_erlang_applications) 57 | end 58 | 59 | defp proceed_app_src_entry({:included_applications, apps}, model) do 60 | Model.put(model, :included_applications, apps) 61 | end 62 | 63 | defp proceed_app_src_entry({:env, env}, model) do 64 | # env goes inside application data 65 | Model.put(model, :env, env) 66 | end 67 | 68 | @package_keys ~w[licenses links maintainers]a 69 | defp proceed_app_src_entry({key, value}, model) when key in @package_keys do 70 | value = 71 | case value do 72 | %{} -> Map.new(value, fn {k, v} -> {"#{k}", "#{v}"} end) 73 | [{_, _} | _] -> Enum.map(value, fn {k, v} -> {"#{k}", "#{v}"} end) 74 | [_ | _] -> Enum.map(value, &to_string/1) 75 | end 76 | Model.update(model, :package, & Map.put(&1, key, value), %{key => value}) 77 | end 78 | 79 | # Registered goes here - it's skipped 80 | defp proceed_app_src_entry({:registered, _}, model), do: model 81 | # Modules goes here - it's skipped 82 | defp proceed_app_src_entry({:modules, _}, model), do: model 83 | 84 | # Default case - something is not known for the Shaker. Warn the user here 85 | defp proceed_app_src_entry(pair, model) do 86 | Model.add_errors(model, [{:app_src, pair}]) 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /lib/shaker/model/mix.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Model.Mix do 2 | @moduledoc """ 3 | Every field of model (except project) 4 | is a keyword of clauses or just function body 5 | 6 | %{ 7 | project: [ 8 | param1: ["$anyenv": value1], #enviroment independant 9 | param2: [test: value1, dev: value2] 10 | ], 11 | application: [ 12 | param1: ["$any": value1], 13 | ... 14 | ] 15 | } 16 | """ 17 | 18 | @application_keys ~w(extra_applications registered env 19 | applications mod start_phases included_application maxT)a 20 | 21 | defstruct [ 22 | project: [], 23 | application: [], 24 | "$errors": [] 25 | ] 26 | 27 | @type envpairs :: Keyword.t() 28 | @type public :: Keyword.t(envpairs()) 29 | @type t :: %__MODULE__{ 30 | project: public(), 31 | application: public() 32 | } 33 | 34 | @doc """ 35 | Like Map.update/4 but for model 36 | """ 37 | @spec update(t(), atom(), (any() -> any()), any(), atom()) :: t() 38 | def update(model, param, fun, default \\ [], env \\ :"$anyenv") 39 | def update( 40 | %__MODULE__{application: application} = model, 41 | param, fun, default, env 42 | ) when param in @application_keys do 43 | %{model | application: update_for_env(application, param, fun, default, env)} 44 | end 45 | def update(%__MODULE__{project: project} = model, param, fun, default, env) do 46 | %{model | project: update_for_env(project, param, fun, default, env)} 47 | end 48 | 49 | @doc """ 50 | Appends value or creates keyword for given param 51 | """ 52 | @spec append(t(), atom(), atom(), any(), atom()) :: t() 53 | def append(model, param, key, value, env \\ :"$anyenv") do 54 | update(model, param, & [{key, value} | &1], [{key, value}], env) 55 | end 56 | 57 | @doc """ 58 | Same as `put/4` but for multiple values at once 59 | """ 60 | @spec put_pairs(t(), Keyword.t() | %{atom() => any()}, any()) :: t() 61 | def put_pairs(model, pairs, env \\ :"$anyenv") do 62 | Enum.reduce(pairs, model, fn {k, v}, model -> put(model, k, v, env) end) 63 | end 64 | 65 | @doc """ 66 | Puts value into model for given param 67 | """ 68 | @spec put(t(), atom(), any(), any()) :: t() 69 | def put(model, param, value, env \\ :"$anyenv") 70 | def put(model, _, [], _), do: model 71 | def put(model, param, value, env) do 72 | update(model, param, fn _ -> value end, value, env) 73 | end 74 | 75 | @spec add_errors(t(), list()) :: t() 76 | def add_errors(%__MODULE__{"$errors": errors} = model, added_errors) do 77 | %{model | "$errors": added_errors ++ errors} 78 | end 79 | 80 | @spec merge_env(t(), t(), atom()) :: t() 81 | def merge_env(%__MODULE__{} = into, %__MODULE__{ 82 | project: project, 83 | application: application, 84 | "$errors": errors, 85 | }, env) do 86 | Enum.reduce(project ++ application, into, fn {key, value}, model -> 87 | put(model, key, Keyword.fetch!(value, :"$anyenv"), env) 88 | end) 89 | |> add_errors(errors) 90 | end 91 | 92 | # Helpers 93 | 94 | @spec update_for_env(public(), atom(), (any() -> any()), any(), atom()) :: public() 95 | defp update_for_env(public, param, func, default, env) do 96 | Keyword.update(public, param, [{env, default}], &Keyword.update(&1, env, default, func)) 97 | end 98 | end 99 | -------------------------------------------------------------------------------- /lib/shaker/generator/mix.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Generator.Mix do 2 | @moduledoc """ 3 | View for generating mix.exs file from prepared structure 4 | """ 5 | 6 | @behaviour Shaker.Generator 7 | 8 | # 80 (max size of line) 9 | # - 2 * 3 (tabs) 10 | # - 3 (semicolon, space, comma) 11 | @maxlen 80 - 2 * 3 - 3 12 | 13 | alias Shaker.Generator.Function 14 | alias Shaker.Model.Mix, as: Model 15 | 16 | @spec gen(atom(), Model.t()) :: Macro.t() 17 | def gen(name, %{application: app, project: proj}) do 18 | [ 19 | gen_funcs(:application, app), 20 | gen_funcs(:project, proj) 21 | ] 22 | |> List.flatten() 23 | |> sort_funcs() 24 | |> gen_module(name) 25 | end 26 | 27 | @spec gen_funcs(atom(), Keyword.t()) :: [Macro.t()] 28 | defp gen_funcs(name, keyword) do 29 | {values, funcs} = 30 | Enum.reduce(keyword, {[], []}, fn {key, value}, {values, funcs} -> 31 | case gen_func_or_value(key, value) do 32 | {:value, val} -> 33 | {[{key, val} | values], funcs} 34 | 35 | {:func, fun} -> 36 | {[{key, quote(do: unquote(key)())} | values], [fun | funcs]} 37 | 38 | {:env_funcs, env_funcs} -> 39 | { 40 | [{key, quote(do: unquote(key)(Mix.env()))} | values], 41 | env_funcs ++ funcs 42 | } 43 | end 44 | end) 45 | 46 | [Function.gen_one(name, values, no_escape: true) | funcs] 47 | end 48 | 49 | @spec gen_func_or_value(atom(), Keyword.t()) 50 | :: {:env_funcs, [{Macro.t(), any()}]} | {:value, any()} | {:func, Macro.t()} 51 | # defp gen_func_or_value(:deps, envlist) do 52 | # deps = 53 | # Enum.reduce(envlist, %{}, fn {envname, deps}, final -> 54 | # Enum.reduce(deps, final, fn {dep, opts}, acc -> 55 | # Map.update(acc, dep, {[envname], opts}, fn {envnames, was_opts} -> 56 | # {[envname | envnames], merge_vals(was_opts, opts)} 57 | # end) 58 | # end) 59 | # end) 60 | # |> Enum.map(fn {depname, {envnames, opts}} -> 61 | # opts = List.wrap(opts) 62 | # if :"$anyenv" in envnames do 63 | # {depname, opts} 64 | # else 65 | # {depname, opts ++ [only: envnames]} 66 | # end 67 | # end) 68 | # |> Enum.map(fn 69 | # {depname, [bin]} when is_binary(bin) -> 70 | # {depname, bin} 71 | # {depname, [bin | opts]} when is_binary(bin) -> 72 | # {depname, bin, opts} 73 | # {depname, opts} -> 74 | # {depname, opts} 75 | # end) 76 | 77 | # {:func, Function.gen_one(:deps, deps)} 78 | # end 79 | defp gen_func_or_value(key, "$anyenv": value) do 80 | if get_kv_len(key, value) > @maxlen do 81 | {:func, Function.gen_one(key, value, private: true)} 82 | else 83 | {:value, value} 84 | end 85 | end 86 | defp gen_func_or_value(key, env_pairs) do 87 | anyenv_pairs = env_pairs[:"$anyenv"] || [] 88 | clauses = 89 | env_pairs 90 | |> Keyword.delete(:"$anyenv") 91 | |> Enum.map(fn {env, pairs} -> 92 | {env, merge_vals(anyenv_pairs, pairs)} 93 | end) 94 | |> Kernel.++([{Macro.var(:_, nil), anyenv_pairs}]) 95 | 96 | {:env_funcs, Function.gen_clauses(key, clauses, private: true)} 97 | end 98 | 99 | @spec gen_module([Macro.t()], atom()) :: Macro.t() 100 | defp gen_module(functions, name) do 101 | quote do 102 | defmodule unquote(name).MixProject do 103 | @moduledoc "Mix project generated by Shaker" 104 | use Mix.Project 105 | unquote_splicing(functions) 106 | end 107 | end 108 | end 109 | 110 | @spec sort_funcs([Macro.t()]) :: Macro.t() 111 | defp sort_funcs(functions) do 112 | Enum.sort_by(functions, fn 113 | {{:def, _, _}, _, [{:project, _, _} | _]} -> 114 | 0 115 | 116 | {{:def, _, _}, _, [{:application, _, _} | _]} -> 117 | 1 118 | 119 | other -> 120 | other 121 | end) 122 | end 123 | 124 | @spec get_kv_len(atom(), any()) :: pos_integer() 125 | defp get_kv_len(key, value) do 126 | String.length(Atom.to_string(key)) + String.length(inspect(value)) 127 | end 128 | 129 | defp merge_vals(vals1, vals2) when is_list(vals1) and is_list(vals2) do 130 | {kw1, v1} = split(vals1) 131 | {kw2, v2} = split(vals2) 132 | 133 | Enum.uniq(v1 ++ v2) ++ Keyword.merge(kw1, kw2) 134 | end 135 | defp merge_vals(_, vals2), do: vals2 136 | 137 | defp split(vals) do 138 | Enum.split_with(vals, fn 139 | {k, _} when is_atom(k) -> true 140 | _ -> false 141 | end) 142 | end 143 | end 144 | -------------------------------------------------------------------------------- /lib/mix/tasks/rebar2mix.ex: -------------------------------------------------------------------------------- 1 | defmodule Mix.Tasks.Rebar2mix do 2 | use Mix.Task 3 | 4 | @shortdoc "Generates mix.exs from rebar project" 5 | @moduledoc """ 6 | Generates mix.exs from rebar project. Automatically detects 7 | umbrella, app.src, rebar.config 8 | 9 | Usage: 10 | ``` 11 | $ mix rebar2mix [--in-umbrella] 12 | ``` 13 | """ 14 | 15 | @option_parser_params [strict: [in_umbrella: :boolean]] 16 | @default_params %{in_umbrella: false} 17 | 18 | alias Shaker.Model.Mix, as: Model 19 | alias Shaker.Generator.Mix, as: Generator 20 | alias Shaker.Renderer 21 | 22 | def run(args) do 23 | {opts, root_path, filename} = 24 | case parse(args) do 25 | {:ok, opts, [root_path, filename]} -> {opts, root_path, filename} 26 | _ -> Mix.raise("Bad params. Refer to `mix help rebar2mix`") 27 | end 28 | call(root_path, filename, opts) 29 | end 30 | 31 | def call(root_path, filename, opts) do 32 | model = 33 | %Model{} 34 | |> Shaker.Parsers.AppSrc.parse(root_path) 35 | |> Shaker.Parsers.RebarConfig.parse(root_path) 36 | |> Model.put(:language, :erlang) 37 | |> ensure_dialyzer() 38 | |> ensure_umbrella(root_path) 39 | |> apply_opts(opts) 40 | |> Shaker.Errors.render() 41 | 42 | model 43 | |> mix_project_name(root_path) 44 | |> Generator.gen(model) 45 | |> Renderer.render(filename) 46 | 47 | Mix.Task.run("format", [filename, "**/mix.exs"]) 48 | 49 | Mix.shell().info("Done") 50 | end 51 | 52 | @spec ensure_umbrella(Model.t(), Path.t()) :: Model.t() 53 | defp ensure_umbrella(model, root_path) do 54 | if umbrella?(root_path) and Mix.shell().yes?(""" 55 | Umbrella support is experimental and may be unstable, proceed? 56 | """) do 57 | call_for_apps(root_path) 58 | Model.put(model, :apps_path, "apps") 59 | else 60 | model 61 | end 62 | end 63 | 64 | @spec apply_opts(Model.t(), map()) :: Model.t() 65 | defp apply_opts(model, opts) do 66 | Enum.reduce(opts, model, fn 67 | {:in_umbrella, true}, model -> 68 | add_in_umbrella(model) 69 | 70 | _, model -> 71 | model 72 | end) 73 | end 74 | 75 | @spec call_for_apps(Path.t()) :: :ok 76 | defp call_for_apps(root_path) do 77 | root_path 78 | |> Path.join("apps/*") 79 | |> Path.wildcard() 80 | |> Enum.each(fn path -> 81 | mixexs = Path.join(path, "mix.exs") 82 | Mix.shell().info("Calling rebar2mix for project at #{path}") 83 | call(path, mixexs, %{in_umbrella: true}) 84 | end) 85 | end 86 | 87 | @spec add_in_umbrella(Model.t()) :: Model.t() 88 | defp add_in_umbrella(model) do 89 | Model.put_pairs(model, [ 90 | build_path: "../../_build", 91 | config_path: "../../config/config.exs", 92 | deps_path: "../../deps", 93 | lockfile: "../../mix.lock", 94 | ]) 95 | end 96 | 97 | @spec mix_project_name(Model.t(), Path.t()) :: atom() 98 | defp mix_project_name(%{project: project}, root_path) do 99 | if not umbrella?(root_path) and Keyword.has_key?(project, :app) do 100 | project 101 | |> Keyword.fetch!(:app) 102 | |> Keyword.fetch!(:"$anyenv") 103 | |> Atom.to_string() 104 | |> Macro.camelize() 105 | |> String.to_atom() 106 | else 107 | :"#{Mix.shell().prompt("Enter mix project name> ")}" 108 | end 109 | end 110 | 111 | @spec ensure_dialyzer(Model.t()) :: Model.t() 112 | defp ensure_dialyzer(%{project: project} = model) do 113 | case Keyword.fetch(project, :dialyzer) do 114 | :error -> 115 | model 116 | 117 | {:ok, _} -> 118 | Model.append(model, :deps, :dialyxir, "~> 1.0.0") 119 | end 120 | end 121 | 122 | @spec umbrella?(project_root_path :: Path.t()) :: boolean() 123 | defp umbrella?(project_root_path) do 124 | project_root_path 125 | |> Path.join("apps") 126 | |> Path.expand() 127 | |> File.dir?() 128 | end 129 | 130 | @spec parse([String.t()]) :: {:ok, map(), [String.t()]} | {:error, :bad_params} 131 | defp parse(args) do 132 | with( 133 | {parsed_params, argv, []} <- OptionParser.parse(args, @option_parser_params), 134 | {:ok, argv} <- ensure_argv(argv) 135 | ) do 136 | {:ok, Map.merge(@default_params, Map.new(parsed_params)), argv} 137 | else 138 | _ -> {:error, :bad_params} 139 | end 140 | end 141 | 142 | defp ensure_argv([]), do: {:ok, [".", "mix.exs"]} 143 | defp ensure_argv([root]), do: {:ok, [root, "mix.exs"]} 144 | defp ensure_argv([_, _] = x), do: {:ok, x} 145 | defp ensure_argv(_), do: :error 146 | 147 | end 148 | -------------------------------------------------------------------------------- /lib/shaker/parsers/rebar_config.ex: -------------------------------------------------------------------------------- 1 | defmodule Shaker.Parsers.RebarConfig do 2 | 3 | @moduledoc """ 4 | Parses rebar.config file 5 | """ 6 | 7 | @behaviour Shaker.Parsers 8 | 9 | @rebar_config_file_wildcard "rebar.config" 10 | 11 | alias Shaker.Model.Mix, as: Model 12 | alias Shaker.Parsers.Common 13 | alias Shaker.Resolver.Deps, as: DepsResolver 14 | alias Shaker.Resolver.Dialyzer, as: DialyzerResolver 15 | 16 | def parse(model, root_path) do 17 | case Common.read_from(root_path, @rebar_config_file_wildcard) do 18 | {:ok, rebar_config_keyword} -> do_parse(model, rebar_config_keyword) 19 | error -> Model.add_errors(model, [{:rebar_config, error}]) 20 | end 21 | end 22 | 23 | defp do_parse(model, rebar_config_keyword) do 24 | Enum.reduce(rebar_config_keyword, model, &proceed_rebar_config_entry/2) 25 | end 26 | 27 | defp proceed_rebar_config_entry({:alias, alias_list}, model) do 28 | alias_list = 29 | Enum.map(alias_list, fn {alias_name, alias_resolution_list} -> 30 | { 31 | alias_name, 32 | Enum.map(alias_resolution_list, fn 33 | {provider, args} -> "#{provider} #{args}" 34 | provider when is_atom(provider) -> "#{provider}" 35 | end) 36 | } 37 | end) 38 | 39 | Model.put(model, :aliases, alias_list) 40 | end 41 | 42 | defp proceed_rebar_config_entry({:erl_opts, erl_opts_list}, model) do 43 | converted_opts = 44 | Enum.map(erl_opts_list, fn 45 | {:platform_define, platform, options} -> 46 | {:error, [{:erl_opts, :platform_define, platform, options}]} 47 | 48 | # Here both atom and {atom, atom} accepted 49 | config -> 50 | {:ok, config} 51 | end) 52 | 53 | model 54 | |> Model.put(:erlc_options, Keyword.get_values(converted_opts, :ok)) 55 | |> Model.add_errors(Keyword.get_values(converted_opts, :error)) 56 | end 57 | 58 | # ESCRIPT part 59 | defp proceed_rebar_config_entry({:escript_main_app, main}, model) do 60 | Model.append(model, :escript, :main_module, main) 61 | end 62 | 63 | defp proceed_rebar_config_entry({:escript_name, name}, model) do 64 | Model.append(model, :escript, :name, name) 65 | end 66 | 67 | defp proceed_rebar_config_entry({:escript_incl_apps, _apps_list}, model) do 68 | # Skiping for elixir projects 69 | model 70 | end 71 | 72 | defp proceed_rebar_config_entry({:escript_emu_args, args}, model) do 73 | Model.append(model, :escript, :emu_args, args) 74 | end 75 | 76 | defp proceed_rebar_config_entry({:escript_shebang, shebang}, model) do 77 | Model.append(model, :escript, :shebang, shebang) 78 | end 79 | 80 | defp proceed_rebar_config_entry({:escript_comment, comment}, model) do 81 | Model.append(model, :escript, :comment, comment) 82 | end 83 | 84 | # HEX part 85 | defp proceed_rebar_config_entry({:hex, hex_specification}, model) do 86 | # Hex is not covered by mix file, it must be specified separately 87 | # with mix tasks. 88 | # This should be noticed in migration guide 89 | Model.add_errors(model, [{:hex, hex_specification}]) 90 | end 91 | 92 | # Minimum OTP version 93 | defp proceed_rebar_config_entry({:minimum_otp_version, _} = pair, model) do 94 | Model.add_errors(model, [pair]) 95 | end 96 | 97 | # Deps 98 | defp proceed_rebar_config_entry({:deps, deps_list}, model) do 99 | resolve_with(model, :deps, deps_list, &DepsResolver.convert/1) 100 | end 101 | 102 | #Dialyzer 103 | defp proceed_rebar_config_entry({:dialyzer, dialyzer_list}, model) do 104 | resolve_with(model, :dialyzer, dialyzer_list, &DialyzerResolver.convert/1) 105 | end 106 | 107 | #Profiles 108 | defp proceed_rebar_config_entry({:profiles, profiles}, model) do 109 | Enum.reduce(profiles, model, fn {env, config}, model -> 110 | other = do_parse(%Model{}, config) 111 | Model.merge_env(model, other, env) 112 | end) 113 | end 114 | 115 | ### Tests 116 | 117 | # Eunit 118 | defp proceed_rebar_config_entry({:eunit_opts, opts}, model) do 119 | model 120 | |> Model.append(:deps, :mix_eunit, "~> 0.2", :test) 121 | |> Model.append(:preffered_cli_env, :eunit, :test) 122 | |> Model.put(:eunit, [verbose: Keyword.has_key?(opts, :verbose)]) 123 | end 124 | 125 | #Common test 126 | defp proceed_rebar_config_entry({k, _}, model 127 | ) when k in ~w[ct_first_files ct_otps ct_readable]a do 128 | model 129 | |> Model.append(:deps, :ctex, "~> 0.1", :test) 130 | |> Model.append(:preffered_cli_env, :ct, :test) 131 | end 132 | 133 | #Elvis 134 | defp proceed_rebar_config_entry({:elvis, conf}, model) do 135 | model 136 | |> Model.put(:elvis, conf) 137 | |> Model.append(:deps, :mix_elvis, "~> 0.1", :test) 138 | |> Model.append(:deps, :mix_elvis, "~> 0.1", :dev) 139 | end 140 | 141 | # GENERAL Case 142 | defp proceed_rebar_config_entry(unsupported, model) do 143 | Model.add_errors(model, [unsupported]) 144 | end 145 | 146 | # Helpers 147 | 148 | defp resolve_with(model, key, keyword, function) do 149 | resolved = Enum.map(keyword, function) 150 | model 151 | |> Model.put(key, Keyword.get_values(resolved, :ok)) 152 | |> Model.add_errors(Keyword.get_values(resolved, :error)) 153 | end 154 | end 155 | -------------------------------------------------------------------------------- /priv/app/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2020, Dmitry Rubinstein . 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /priv/escript/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2020, Dmitry Rubinstein . 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /priv/lib/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2020, Dmitry Rubinstein . 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /priv/plugin/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2020, Dmitry Rubinstein . 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | -------------------------------------------------------------------------------- /priv/release/LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | Copyright 2020, Dmitry Rubinstein . 179 | 180 | Licensed under the Apache License, Version 2.0 (the "License"); 181 | you may not use this file except in compliance with the License. 182 | You may obtain a copy of the License at 183 | 184 | http://www.apache.org/licenses/LICENSE-2.0 185 | 186 | Unless required by applicable law or agreed to in writing, software 187 | distributed under the License is distributed on an "AS IS" BASIS, 188 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 189 | See the License for the specific language governing permissions and 190 | limitations under the License. 191 | 192 | --------------------------------------------------------------------------------