Commit d8bd1ff
committed
Refactor
- Renamed `Mix.Gleam.require!/0` to `Mix.Gleam.requirements!/0` as it has a
different meaning in Elixir.
- Added/ `@spec` annotations to public functions.
- Avoided making functions raise and return results (`{:ok, value}` |
`{:error, message}`)
- Now every function that raises ends with a ! (with the exception of
`Mix.Gleam.load_config/1` due to consistency with the Rebar compiler)
- Avoided raising from Elixir functions, and raise with `Mix.raise/1` almost
exclusively, raising with a descriptive message as opposed to raising with a
generic message and a stacktrace. The exceptions are the use of
`JSON.decode!/1` since there's no way to translate the error atoms to string
messages, as well as `File.cd!/2`.
- Simplify the calls to `Mix.raise/1` with the introduction oof a helper.
Now only 3 times the helper is called to return the value in the
`{:ok, value}` tuple, or to `Mix.raise` with a message.
- `Mix.Gleam.parse_dep!/2` now users pattern matching to build its specs.
- Renamed `@required_gleam_version` to `@gleam_version_requirement` for clarity.
- `Mix.Gleam.requirements!/0` raises with a descriptive message saying the
minimum gleam version isn't met, as opposed to before where if this
requirement is not met it wouldn't even raiseMix.Gleam
1 parent 00f852d commit d8bd1ff
4 files changed
Lines changed: 97 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
375 | 375 | | |
376 | 376 | | |
377 | 377 | | |
378 | | - | |
| 378 | + | |
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
14 | 24 | | |
15 | 25 | | |
16 | 26 | | |
17 | | - | |
| 27 | + | |
| 28 | + | |
18 | 29 | | |
19 | 30 | | |
20 | | - | |
| 31 | + | |
21 | 32 | | |
22 | 33 | | |
23 | 34 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
36 | 55 | | |
37 | 56 | | |
38 | | - | |
39 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
40 | 62 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
| 63 | + | |
| 64 | + | |
45 | 65 | | |
46 | | - | |
47 | | - | |
| 66 | + | |
| 67 | + | |
48 | 68 | | |
49 | | - | |
50 | | - | |
| 69 | + | |
| 70 | + | |
51 | 71 | | |
52 | | - | |
53 | | - | |
54 | | - | |
| 72 | + | |
| 73 | + | |
55 | 74 | | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 75 | + | |
| 76 | + | |
61 | 77 | | |
62 | 78 | | |
63 | 79 | | |
| |||
86 | 102 | | |
87 | 103 | | |
88 | 104 | | |
89 | | - | |
90 | | - | |
91 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
92 | 121 | | |
93 | 122 | | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
98 | 136 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | 137 | | |
103 | 138 | | |
104 | | - | |
| 139 | + | |
105 | 140 | | |
106 | 141 | | |
107 | 142 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
112 | 146 | | |
113 | 147 | | |
114 | | - | |
| 148 | + | |
115 | 149 | | |
116 | 150 | | |
117 | | - | |
| 151 | + | |
118 | 152 | | |
119 | 153 | | |
120 | | - | |
| 154 | + | |
121 | 155 | | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
122 | 159 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
| 317 | + | |
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
0 commit comments