It’d be hard to reliably parse & edit mix.exs files in general, but since I
can promise myself that I’ll adhere to certain formatting rules in my own
projects, I wrote https://github.com/bryanstearns/mix_deps_add … and if you
don’t like my rules (see the README), please file an issue or send a PR.
(As it happens, I didn’t support comments within the deps/0 function in the
versions I’ve released, but I’ll eventually finish the branch that supports
them.)

I definitely don’t think something this arbitrary belongs in Mix itself!

On Tue, Jul 18, 2017 at 4:30 PM, Vitaly Shvedchenko <
[email protected]> wrote:

> Ok, so it would be just an option to leave a version string empty to let
> mix just get the latest version of a package. This is how a ruby gem
> dependencies with Gemfile works.
>
> On Wednesday, July 19, 2017 at 12:37:57 AM UTC+3, Louis Pilfold wrote:
>>
>> Hey Vitaly
>>
>> 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.
>>
>> Cheers,
>> Louis
>>
>> On Tue, 18 Jul 2017 at 22:17 Vitaly Shvedchenko <[email protected]>
>> wrote:
>>
>>> Hi guys,
>>>
>>> I'd like to suggest a feature and may be implement it. I've found
>>> somebody proposed this feature earlier, but it was a long time ago and
>>> there was not a single reply to it. So I'd try one more time for that poor
>>> guy and for me.
>>>
>>> When you develop elixir project and adding new dependencies to the
>>> project, you always have to find needed package onlline, find out it's
>>> latest version number and put it in your mix.exs dependencies for yourself.
>>> What could be helpful is some equivalent of a
>>> npm install --save
>>> command from nodejs world. It would be like
>>> mix deps.install package_name
>>> What this command has to do is just
>>> 1. check if hex is installed, propose to install it if it is not,
>>> 2. get the hex package info, parse its version,
>>> 3. put it in mix.exs file (with some conventional semantic versioning
>>> pattern like "~> x.y")
>>> 4. and call mix deps.get—thats it!
>>> It probably would not put the dependency in OTP applications to start
>>> list, but still it is much easier way of installing dependencies.
>>>
>>> I guess there is some conventional reasons to not implement such way of
>>> installing new dependencies, but it's not obvious for me and many other
>>> people why there is no such option.
>>>
>>> Thanks! Will be glad to have some feedback.
>>>
>>> --
>>> 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/ms
>>> gid/elixir-lang-core/9daf03ef-a9a6-44d2-b7d5-68c345b42d76%
>>> 40googlegroups.com
>>> <https://groups.google.com/d/msgid/elixir-lang-core/9daf03ef-a9a6-44d2-b7d5-68c345b42d76%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/2c6070cd-f108-4ddc-90f3-
> 77f77d1b6298%40googlegroups.com
> <https://groups.google.com/d/msgid/elixir-lang-core/2c6070cd-f108-4ddc-90f3-77f77d1b6298%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/CAGt18Nhg_8nUg-MdXAOU%2BCH_svif%2BXue5tE-V7Ko7j2vYStc7g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to