zf

zenflows testing
git clone https://s.sonu.ch/~srfsh/zf.git
Log | Files | Refs | Submodules | README | LICENSE

dependency-management.md (1656B)


      1 # Dependency Management
      2 
      3 The dependencies are put in version control in Zenflows.  But elixir/mix doesn't
      4 like this approach because it puts generated files (such as erlex, absinthe) in
      5 the dependencies' directory, which makes it hard to track/differentiate source
      6 files and generated files.
      7 
      8 For that reason, the actual dependencies (the real source code) are stored and
      9 tracked in the `.deps/` directory instead of the `deps/` directory.  Then, the
     10 `.deps/` directory is copied over to `deps/` directory when we want to use the
     11 dependencies in the project.  Similarly, `deps/` is copied over to `.deps/`
     12 whenever we update or add a dependency (of course, `deps/` is cleaned first, in
     13 order to avoid generated files).
     14 
     15 But this approach needs some care when you want to update or add a dependency:
     16 you must first clean the `deps/` directory with `mann dep.clean`, then copy
     17 `.deps/` over to `deps/` with `mann dep.setup`, then use whatever mix command
     18 you want to add or update a dependency (to update, use `mann mix deps.update
     19 mydep`), then copy `deps/` over back to `.deps/`.
     20 
     21 Let's give some examples.  Suppose you want to update `absinthe`.  You do:
     22 
     23 1. `mann dep.clean`
     24 2. `mann dep.setup`
     25 3. `mann mix deps.update absinthe`
     26 4. `mann dep.copy`
     27 5. `git add .deps/`
     28 6. `git commit -m 'dep: update absinthe to x.y.z'`
     29 
     30 Now let's suppose you want to add a new dependency, `absinthe`, to your project.
     31 You do:
     32 
     33 1. `mann dep.clean`
     34 2. `mann dep.setup`
     35 3. edit `mix.exs` to add the dependency
     36 4. `mann dep.copy`
     37 5. `git add .deps/`
     38 6. `git commit -m 'dep: add absinthe x.y.z'`
     39 
     40 Similar process happens with dependency removal, but I think it is clear now.