Skip to content

Commit 6100a82

Browse files
committed
Merge branch 'docfix/update-docs-and-ref-domo'
2 parents 3b63b1a + 143a37c commit 6100a82

File tree

8 files changed

+53
-420
lines changed

8 files changed

+53
-420
lines changed

.envrc

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1 @@
1-
####################################
2-
# Environment setup for Nix shells #
3-
####################################
4-
5-
# From https://github.com/direnv/direnv/wiki/Nix#persistent-cached-shell
6-
#
7-
# Usage: use_nix [...]
8-
#
9-
# Load environment variables from `nix-shell`.
10-
# If you have a `default.nix` or `shell.nix` one of these will be used and
11-
# the derived environment will be stored at ./.direnv/env-<hash>
12-
# and symlink to it will be created at ./.direnv/default.
13-
# Dependencies are added to the GC roots, such that the environment remains persistent.
14-
#
15-
# Packages can also be specified directly via e.g `use nix -p ocaml`,
16-
# however those will not be added to the GC roots.
17-
#
18-
# The resulting environment is cached for better performance.
19-
#
20-
# To trigger switch to a different environment:
21-
# `rm -f .direnv/default`
22-
#
23-
# To derive a new environment:
24-
# `rm -rf .direnv/env-$(md5sum {shell,default}.nix 2> /dev/null | cut -c -32)`
25-
#
26-
# To remove cache:
27-
# `rm -f .direnv/dump-*`
28-
#
29-
# To remove all environments:
30-
# `rm -rf .direnv/env-*`
31-
#
32-
# To remove only old environments:
33-
# `find .direnv -name 'env-*' -and -not -name `readlink .direnv/default` -exec rm -rf {} +`
34-
#
35-
use_nix() {
36-
set -e
37-
38-
local shell="shell.nix"
39-
if [[ ! -f "${shell}" ]]; then
40-
shell="default.nix"
41-
fi
42-
43-
if [[ ! -f "${shell}" ]]; then
44-
fail "use nix: shell.nix or default.nix not found in the folder"
45-
fi
46-
47-
local dir="${PWD}"/.direnv
48-
local default="${dir}/default"
49-
if [[ ! -L "${default}" ]] || [[ ! -d `readlink "${default}"` ]]; then
50-
local wd="${dir}/env-`md5sum "${shell}" | cut -c -32`" # TODO: Hash also the nixpkgs version?
51-
mkdir -p "${wd}"
52-
53-
local drv="${wd}/env.drv"
54-
if [[ ! -f "${drv}" ]]; then
55-
log_status "use nix: deriving new environment"
56-
IN_NIX_SHELL=1 nix-instantiate --add-root "${drv}" --indirect "${shell}" > /dev/null
57-
nix-store -r `nix-store --query --references "${drv}"` --add-root "${wd}/dep" --indirect > /dev/null
58-
fi
59-
60-
rm -f "${default}"
61-
ln -s `basename "${wd}"` "${default}"
62-
fi
63-
64-
local drv=`readlink -f "${default}/env.drv"`
65-
local dump="${dir}/dump-`md5sum ".envrc" | cut -c -32`-`md5sum ${drv} | cut -c -32`"
66-
67-
if [[ ! -f "${dump}" ]] || [[ "${XDG_CONFIG_DIR}/direnv/direnvrc" -nt "${dump}" ]]; then
68-
log_status "use nix: updating cache"
69-
70-
old=`find "${dir}" -name 'dump-*'`
71-
nix-shell "${drv}" --show-trace "$@" --run 'direnv dump' > "${dump}"
72-
rm -f ${old}
73-
fi
74-
75-
direnv_load cat "${dump}"
76-
77-
watch_file "${default}"
78-
watch_file shell.nix
79-
if [[ ${shell} == "default.nix" ]]; then
80-
watch_file default.nix
81-
fi
82-
}
83-
841
use nix

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
TypedStruct is written in [Elixir](https://elixir-lang.org).
44

55
For branching management, this project uses
6-
[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `master` branch
6+
[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `main` branch
77
is reserved for releases: the development process occurs on `develop` and
8-
feature branches. **Please never commit to master.**
8+
feature branches. **Please never commit to main.**
99

1010
You can easily set up a development environment featuring all the dependencies,
1111
including Elixir and `git-flow`, by using [Nix](https://nixos.org/nix/). This is

LICENSE renamed to LICENSE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
MIT License
1+
# MIT License
22

3-
Copyright (c) 2018-2020 Jean-Philippe Cugnet and Contributors
3+
Copyright © 2018-2021 Jean-Philippe Cugnet and Contributors
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
# TypedStruct
22

33
[![Build Status](https://travis-ci.com/ejpcmac/typed_struct.svg?branch=develop)](https://travis-ci.com/ejpcmac/typed_struct)
4-
[![hex.pm version](http://img.shields.io/hexpm/v/typed_struct.svg?style=flat)](https://hex.pm/packages/typed_struct)
4+
[![hex.pm version](https://img.shields.io/hexpm/v/typed_struct.svg?style=flat)](https://hex.pm/packages/typed_struct)
5+
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg?style=flat)](https://hexdocs.pm/typed_struct/)
6+
[![Total Download](https://img.shields.io/hexpm/dt/typed_struct.svg?style=flat)](https://hex.pm/packages/typed_struct)
7+
[![License](https://img.shields.io/hexpm/l/typed_struct.svg?style=flat)](https://github.com/ejpcmac/typed_struct/blob/master/LICENSE.md)
8+
9+
<!-- MDOC !-->
510

611
TypedStruct is a library for defining structs with a type without writing
712
boilerplate code.
@@ -191,7 +196,7 @@ typedstruct do
191196
end
192197
```
193198

194-
You can also document submodules this way:
199+
You can also document submodules this way:
195200

196201
```elixir
197202
typedstruct module: MyStruct do
@@ -370,11 +375,7 @@ defmodule MyModule do
370375
end
371376
end
372377
```
373-
374-
## [Contributing](CONTRIBUTING.md)
375-
376-
Before contributing to this project, please read the
377-
[CONTRIBUTING.md](CONTRIBUTING.md).
378+
<!-- MDOC !-->
378379

379380
## Initial roadmap
380381

@@ -391,8 +392,21 @@ Before contributing to this project, please read the
391392
* [x] Integration with [Lens](https://github.com/obrok/lens)
392393
* [ ] Integration with [Ecto](https://github.com/elixir-ecto/ecto)
393394

395+
## Related libraries
396+
397+
* [Domo](https://github.com/IvanRublev/Domo): a library to validate structs that
398+
define a `t()` type, like the one generated by `TypedStruct`.
399+
* [TypedEctoSchema](https://github.com/bamorim/typed_ecto_schema): a library
400+
that provides a DSL on top of `Ecto.Schema` to achieve the same result as
401+
`TypedStruct`, with `Ecto`.
402+
403+
## [Contributing](CONTRIBUTING.md)
404+
405+
Before contributing to this project, please read the
406+
[CONTRIBUTING.md](CONTRIBUTING.md).
407+
394408
## License
395409

396-
Copyright © 2018-2020 Jean-Philippe Cugnet and Contributors
410+
Copyright © 2018-2021 Jean-Philippe Cugnet and Contributors
397411

398-
This project is licensed under the [MIT license](LICENSE).
412+
This project is licensed under the [MIT license](./LICENSE.md).

0 commit comments

Comments
 (0)