Hi Boris, as Pedro mentioned, this has been discussed before. Having a "data" file as opposed to a "code" file for dependencies can already be done today: you can define a file that contains dependencies as a list, and then read that file in your mix.exs file. You can also build "mix deps.add" yourself on top of this. For these reasons, we're likely not going to add this to Elixir itself: we want to empower users and give them flexibility rather than providing many solutions that try to cater to many different needs.
Andrea Leopardi [email protected] On Fri, May 10, 2019 at 8:46 PM 'boris kotov' via elixir-lang-core < [email protected]> wrote: > Hi Pedro, > > > I don't think evaluation an exs to get a list will make a `mix.deps.add` > reliable once we could put any elixir code on that file as well. > > Well, as long as the file only consists only a list, there is no problem > with it. You can even have code inside the list, like > > [ > {:my_dep, System.get_env("DEP_VER")} > ] > > But it should't have anything other then a list, for example this should't > work: > > # deps.exs > f = fn -> System.get_env("DEP_VER") > [{:my_dep, f.() }] > > And you can check that really simple, and print something.. > > Am Freitag, 10. Mai 2019 16:02:51 UTC+2 schrieb Pedro Medeiros: >> >> Hi boris 👋🏼 >> >> there was an old discussion on the list about that >> >> >> https://groups.google.com/forum/#!searchin/elixir-lang-core/mix$20add|sort:date/elixir-lang-core/ULBzKNCjYvY/XgwwrdepBgAJ >> >> the main thing that came was "The dependency file for mix is an Elixir >> program rather than just a simple JSON file. There's no way reliably and >> safely programatically modify the mix.exs file as a result." >> >> I don't think evaluation an exs to get a list will make a `mix.deps.add` >> reliable once we could put any elixir code on that file as well. >> >> Le ven. 10 mai 2019, à 06 h 09, 'boris kotov' via elixir-lang-core < >> [email protected]> a écrit : >> >>> Right now, its a bit annoying to lookup the version on hex, and then >>> manually adding it to the deps function. >>> >>> There was a discussion back in 2017 on this. >>> https://elixirforum.com/t/mix-deps-add-functionality/4856/7 >>> The main problem people have thought about was manipulation of mix.exs, >>> and true, we don't want that. >>> >>> Instead we can use a simple exs file for this, which should be >>> evaluatable to a list. So its a no-brainer to add items to it. For example >>> `mix deps.add jason`. >>> >>> defp deps, do: Code.eval_file("deps.exs") >>> >>> I am posting it here, to get some feedback on that feature, but I think >>> the integration could go into hex only and if its adopted, adding the >>> `deps.exs` file to the `mix new`-templates so please, share you opinions on >>> it. >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "elixir-lang-core" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/elixir-lang-core/48f096ab-c6dd-494c-8907-ca16e1b785fe%40googlegroups.com >>> <https://groups.google.com/d/msgid/elixir-lang-core/48f096ab-c6dd-494c-8907-ca16e1b785fe%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> -- >> Pedro Henrique de Souza Medeiros >> ---------------------------------- >> Cel: +1 (514) 641-5031 >> Email: [email protected] >> > -- > You received this message because you are subscribed to the Google Groups > "elixir-lang-core" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/elixir-lang-core/faf1c54d-8974-4643-a5d2-301776a479ef%40googlegroups.com > <https://groups.google.com/d/msgid/elixir-lang-core/faf1c54d-8974-4643-a5d2-301776a479ef%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "elixir-lang-core" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/elixir-lang-core/CAM9Rf%2BLpMN9Z1ERu-DXjVnDMoPqsyNted7XD%2BO79q_kLm_qMdw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
