mix: "Local" dependency

2,885 views
Skip to first unread message

Michael Weibel

unread,
Feb 19, 2014, 1:52:29 PM2/19/14
to elixir-l...@googlegroups.com
Hi,

I use in a project a library I'm developing side-by-side with it and currently I just added it as a normal dependency to the github project.
This is obviously slow because whenever I change something in the library, I need to commit & push it, then unlock the dependency in the project & run 'mix deps.get'.

Is there any way how I could directly use the repository which is in another folder? I tried symlinking the library into the "deps" folder and changed in mix.lock the sha-hash to "master" (to reference the master branch). This is not working, error as follows:

Unchecked dependencies for environment dev:
* facebook (git://github.com/mweibel/facebook.ex.git)
  lock mismatch: the dependency is out of date
** (Mix) Can't continue due to errors on dependencies

In node e.g. you can either change the contents of the dependent folder directly or use 'npm link'[1] - I think a similar approach might be very helpful.

Did I miss something or is there another way?

Thanks,
Michael


[1]: https://www.npmjs.org/doc/cli/npm-link.html

Michael Weibel

unread,
Feb 19, 2014, 1:58:51 PM2/19/14
to elixir-l...@googlegroups.com
ah, right after posting this mail, I went to the source of mix and have seen these options:

https://github.com/elixir-lang/elixir/blob/stable/lib/mix/lib/mix/deps.ex#L63

I guess that's what I wanted and it seems to work so far ;)

Anyway, maybe this thread helps someone else to figure out how to do it :)

José Valim

unread,
Feb 19, 2014, 1:59:24 PM2/19/14
to elixir-l...@googlegroups.com
You can use the :path option:

  { :my_dep, path: "../my_dep" }

Search for :path in this page:


Keep in mind though that if you change the a path dependency, you need still need to do "mix deps.get my_dep", so we copy its build artifacts. You just don't need to push (and there is no lock to maintain).

Maybe umbrella projects is a better option for your workflow (search for umbrella in the page above).

 



José Valim
Skype: jv.ptec
Founder and Lead Developer


--
You received this message because you are subscribed to the Google Groups "elixir-lang-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elixir-lang-ta...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Michael Weibel

unread,
Feb 20, 2014, 2:42:26 AM2/20/14
to elixir-l...@googlegroups.com
Thanks José. 

For now I use the path option but I'll have the umbrella project structure in my mind :)

You received this message because you are subscribed to a topic in the Google Groups "elixir-lang-talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/elixir-lang-talk/mg5R0hApP-U/unsubscribe.
To unsubscribe from this group and all its topics, send an email to elixir-lang-ta...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages