Any way to have rebar get-deps check a local cache before cloning a repository?
Asked Answered
N

2

8

I have a project with several dependencies on remote repositories (all on github.com at the moment if that helps). The dependencies don't change often. It would be nice if there was a way to keep the existing rebar.conf files the same so that they pointed to the upstream repositories, but to be able to cache the repos (or a snapshot) locally so that clean builds don't need go to the internet.

Is there anyway of doing this? I.e. rebar command line options, environment settings, git options, etc.?

Niue answered 7/10, 2013 at 19:25 Comment(0)
C
2

I suppose you could do couple of things:

  1. Make your own local clone of all repositories and change rebar.config to take this repos from it. On the first look it seems horrible solution, but it has a lot of advantages. Github is often not available, clone speed will increase, and the last most valuable is: projects are evolving and one day you will find that everything is broken because one of the deps has changed their APi in master branch.
  2. You could do local deps folder with all you need repos and share it via symlink with every repo you need.
Chaldean answered 8/10, 2013 at 13:59 Comment(3)
Yep. The local clone may be the only way to go with rebar. I was originally hoping for an automatic and transparent way of taking a snapshot of all dependent repos. I agree with the advantages you list.Niue
It's an imperfect solution, though, because dependencies of dependencies will not be aware of your local cache.Tetraspore
deps of deps should be there as well.Chaldean
N
0

Rebar has a feature that lets you add a custom script file, rebar.config.script, to modify rebar's configuration dynamically. This lets you implement something similar to @danechkin's answer #2 except using an environment variable to switch between the local shared deps folder and the default one for the project. No changes to rebar.config needed. The example at https://github.com/basho/rebar/wiki/Dynamic-configuration shows how to do this.

Niue answered 13/10, 2013 at 18:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.