diff --git a/.check.exs b/.check.exs index 2028bba..e22697b 100644 --- a/.check.exs +++ b/.check.exs @@ -3,7 +3,7 @@ last_supported_version? = System.version() |> Version.parse!() - |> Version.match?("~> 1.10.0") + |> Version.match?("~> 1.13.0") [ skipped: false, diff --git a/.credo.exs b/.credo.exs index c5c9968..f68203a 100644 --- a/.credo.exs +++ b/.credo.exs @@ -64,135 +64,151 @@ # # {Credo.Check.Design.DuplicatedCode, false} # - checks: [ - # - ## Consistency Checks - # - {Credo.Check.Consistency.ExceptionNames, []}, - {Credo.Check.Consistency.LineEndings, []}, - {Credo.Check.Consistency.ParameterPatternMatching, []}, - {Credo.Check.Consistency.SpaceAroundOperators, []}, - {Credo.Check.Consistency.SpaceInParentheses, []}, - {Credo.Check.Consistency.TabsOrSpaces, []}, + checks: %{ + enabled: [ + # + ## Consistency Checks + # + {Credo.Check.Consistency.ExceptionNames, []}, + {Credo.Check.Consistency.LineEndings, []}, + {Credo.Check.Consistency.ParameterPatternMatching, []}, + {Credo.Check.Consistency.SpaceAroundOperators, []}, + {Credo.Check.Consistency.SpaceInParentheses, []}, + {Credo.Check.Consistency.TabsOrSpaces, []}, - # - ## Design Checks - # - # You can customize the priority of any check - # Priority values are: `low, normal, high, higher` - # - {Credo.Check.Design.AliasUsage, - [ - priority: :low, - if_nested_deeper_than: 2, - if_called_more_often_than: 0 - ]}, - # You can also customize the exit_status of each check. - # If you don't want TODO comments to cause `mix credo` to fail, just - # set this value to 0 (zero). - # - {Credo.Check.Design.TagTODO, [exit_status: 0]}, - {Credo.Check.Design.TagFIXME, []}, + # + ## Design Checks + # + # You can customize the priority of any check + # Priority values are: `low, normal, high, higher` + # + {Credo.Check.Design.AliasUsage, + [ + priority: :low, + if_nested_deeper_than: 2, + if_called_more_often_than: 0 + ]}, + # You can also customize the exit_status of each check. + # If you don't want TODO comments to cause `mix credo` to fail, just + # set this value to 0 (zero). + # + {Credo.Check.Design.TagTODO, [exit_status: 0]}, + {Credo.Check.Design.TagFIXME, []}, - # - ## Readability Checks - # - {Credo.Check.Readability.AliasOrder, []}, - {Credo.Check.Readability.FunctionNames, []}, - {Credo.Check.Readability.LargeNumbers, []}, - {Credo.Check.Readability.MaxLineLength, - [priority: :low, max_length: 80]}, - {Credo.Check.Readability.ModuleAttributeNames, []}, - {Credo.Check.Readability.ModuleDoc, []}, - {Credo.Check.Readability.ModuleNames, []}, - {Credo.Check.Readability.ParenthesesInCondition, []}, - {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, - {Credo.Check.Readability.PredicateFunctionNames, []}, - {Credo.Check.Readability.PreferImplicitTry, []}, - {Credo.Check.Readability.RedundantBlankLines, []}, - {Credo.Check.Readability.Semicolons, []}, - {Credo.Check.Readability.SpaceAfterCommas, []}, - {Credo.Check.Readability.StringSigils, []}, - {Credo.Check.Readability.TrailingBlankLine, []}, - {Credo.Check.Readability.TrailingWhiteSpace, []}, - {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, - {Credo.Check.Readability.VariableNames, []}, + # + ## Readability Checks + # + {Credo.Check.Readability.AliasOrder, []}, + {Credo.Check.Readability.FunctionNames, []}, + {Credo.Check.Readability.LargeNumbers, []}, + {Credo.Check.Readability.MaxLineLength, + [priority: :low, max_length: 80]}, + {Credo.Check.Readability.ModuleAttributeNames, []}, + {Credo.Check.Readability.ModuleDoc, []}, + {Credo.Check.Readability.ModuleNames, []}, + {Credo.Check.Readability.ParenthesesInCondition, []}, + {Credo.Check.Readability.ParenthesesOnZeroArityDefs, []}, + {Credo.Check.Readability.PipeIntoAnonymousFunctions, []}, + {Credo.Check.Readability.PredicateFunctionNames, []}, + {Credo.Check.Readability.PreferImplicitTry, []}, + {Credo.Check.Readability.RedundantBlankLines, []}, + {Credo.Check.Readability.Semicolons, []}, + {Credo.Check.Readability.SpaceAfterCommas, []}, + {Credo.Check.Readability.StringSigils, []}, + {Credo.Check.Readability.TrailingBlankLine, []}, + {Credo.Check.Readability.TrailingWhiteSpace, []}, + {Credo.Check.Readability.UnnecessaryAliasExpansion, []}, + {Credo.Check.Readability.VariableNames, []}, + {Credo.Check.Readability.WithSingleClause, []}, - # - ## Refactoring Opportunities - # - {Credo.Check.Refactor.CondStatements, []}, - {Credo.Check.Refactor.CyclomaticComplexity, []}, - {Credo.Check.Refactor.FunctionArity, []}, - {Credo.Check.Refactor.LongQuoteBlocks, []}, - {Credo.Check.Refactor.MapInto, false}, - {Credo.Check.Refactor.MatchInCondition, []}, - {Credo.Check.Refactor.NegatedConditionsInUnless, []}, - {Credo.Check.Refactor.NegatedConditionsWithElse, []}, - {Credo.Check.Refactor.Nesting, []}, - {Credo.Check.Refactor.UnlessWithElse, []}, - {Credo.Check.Refactor.WithClauses, []}, + # + ## Refactoring Opportunities + # + {Credo.Check.Refactor.Apply, []}, + {Credo.Check.Refactor.CondStatements, []}, + {Credo.Check.Refactor.CyclomaticComplexity, []}, + {Credo.Check.Refactor.FunctionArity, []}, + {Credo.Check.Refactor.LongQuoteBlocks, []}, + {Credo.Check.Refactor.MatchInCondition, []}, + {Credo.Check.Refactor.MapJoin, []}, + {Credo.Check.Refactor.NegatedConditionsInUnless, []}, + {Credo.Check.Refactor.NegatedConditionsWithElse, []}, + {Credo.Check.Refactor.Nesting, []}, + {Credo.Check.Refactor.UnlessWithElse, []}, + {Credo.Check.Refactor.WithClauses, []}, + {Credo.Check.Refactor.FilterFilter, []}, + {Credo.Check.Refactor.RejectReject, []}, + {Credo.Check.Refactor.RedundantWithClauseResult, []}, - # - ## Warnings - # - {Credo.Check.Warning.BoolOperationOnSameValues, []}, - {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, - {Credo.Check.Warning.IExPry, []}, - {Credo.Check.Warning.IoInspect, []}, - {Credo.Check.Warning.LazyLogging, false}, - {Credo.Check.Warning.MixEnv, false}, - {Credo.Check.Warning.OperationOnSameValues, []}, - {Credo.Check.Warning.OperationWithConstantResult, []}, - {Credo.Check.Warning.RaiseInsideRescue, []}, - {Credo.Check.Warning.UnusedEnumOperation, []}, - {Credo.Check.Warning.UnusedFileOperation, []}, - {Credo.Check.Warning.UnusedKeywordOperation, []}, - {Credo.Check.Warning.UnusedListOperation, []}, - {Credo.Check.Warning.UnusedPathOperation, []}, - {Credo.Check.Warning.UnusedRegexOperation, []}, - {Credo.Check.Warning.UnusedStringOperation, []}, - {Credo.Check.Warning.UnusedTupleOperation, []}, - {Credo.Check.Warning.UnsafeExec, []}, + # + ## Warnings + # + {Credo.Check.Warning.ApplicationConfigInModuleAttribute, []}, + {Credo.Check.Warning.BoolOperationOnSameValues, []}, + {Credo.Check.Warning.ExpensiveEmptyEnumCheck, []}, + {Credo.Check.Warning.IExPry, []}, + {Credo.Check.Warning.IoInspect, []}, + {Credo.Check.Warning.OperationOnSameValues, []}, + {Credo.Check.Warning.OperationWithConstantResult, []}, + {Credo.Check.Warning.RaiseInsideRescue, []}, + {Credo.Check.Warning.SpecWithStruct, []}, + {Credo.Check.Warning.WrongTestFileExtension, []}, + {Credo.Check.Warning.UnusedEnumOperation, []}, + {Credo.Check.Warning.UnusedFileOperation, []}, + {Credo.Check.Warning.UnusedKeywordOperation, []}, + {Credo.Check.Warning.UnusedListOperation, []}, + {Credo.Check.Warning.UnusedPathOperation, []}, + {Credo.Check.Warning.UnusedRegexOperation, []}, + {Credo.Check.Warning.UnusedStringOperation, []}, + {Credo.Check.Warning.UnusedTupleOperation, []}, + {Credo.Check.Warning.UnsafeExec, []} + ], + disabled: [ + # + # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) - # - # Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`) + # + # Controversial and experimental checks (opt-in, just move the check to `:enabled` + # and be sure to use `mix credo --strict` to see low priority checks) + # + {Credo.Check.Consistency.MultiAliasImportRequireUse, []}, + {Credo.Check.Consistency.UnusedVariableNames, []}, + {Credo.Check.Design.DuplicatedCode, []}, + {Credo.Check.Design.SkipTestWithoutComment, []}, + {Credo.Check.Readability.AliasAs, []}, + {Credo.Check.Readability.BlockPipe, []}, + {Credo.Check.Readability.ImplTrue, []}, + {Credo.Check.Readability.MultiAlias, []}, + {Credo.Check.Readability.SeparateAliasRequire, []}, + {Credo.Check.Readability.SingleFunctionToBlockPipe, []}, + {Credo.Check.Readability.SinglePipe, []}, + {Credo.Check.Readability.Specs, []}, + {Credo.Check.Readability.StrictModuleLayout, []}, + {Credo.Check.Readability.WithCustomTaggedTuple, []}, + {Credo.Check.Refactor.ABCSize, []}, + {Credo.Check.Refactor.AppendSingleItem, []}, + {Credo.Check.Refactor.DoubleBooleanNegation, []}, + {Credo.Check.Refactor.FilterReject, []}, + {Credo.Check.Refactor.IoPuts, []}, + {Credo.Check.Refactor.MapMap, []}, + {Credo.Check.Refactor.ModuleDependencies, []}, + {Credo.Check.Refactor.NegatedIsNil, []}, + {Credo.Check.Refactor.PipeChainStart, []}, + {Credo.Check.Refactor.RejectFilter, []}, + {Credo.Check.Refactor.VariableRebinding, []}, + {Credo.Check.Warning.LazyLogging, []}, + {Credo.Check.Warning.LeakyEnvironment, []}, + {Credo.Check.Warning.MapGetUnsafePass, []}, + {Credo.Check.Warning.MixEnv, []}, + {Credo.Check.Warning.UnsafeToAtom, []} - # - # Controversial and experimental checks (opt-in, just replace `false` with `[]`) - # - {Credo.Check.Readability.StrictModuleLayout, false}, - {Credo.Check.Consistency.MultiAliasImportRequireUse, false}, - {Credo.Check.Consistency.UnusedVariableNames, false}, - # If you don't want the `setup` and `test` macro calls in ExUnit tests - # or the `schema` macro in Ecto schemas to trigger DuplicatedCode, just - # set the `excluded_macros` parameter to `[:schema, :setup, :test]`. - # - {Credo.Check.Design.DuplicatedCode, [excluded_macros: []]}, - {Credo.Check.Readability.AliasAs, false}, - {Credo.Check.Readability.MultiAlias, false}, - {Credo.Check.Readability.Specs, false}, - {Credo.Check.Readability.SinglePipe, false}, - {Credo.Check.Readability.WithCustomTaggedTuple, false}, - {Credo.Check.Refactor.ABCSize, false}, - {Credo.Check.Refactor.AppendSingleItem, false}, - {Credo.Check.Refactor.DoubleBooleanNegation, false}, - {Credo.Check.Refactor.ModuleDependencies, false}, - {Credo.Check.Refactor.NegatedIsNil, false}, - {Credo.Check.Refactor.PipeChainStart, - [ - excluded_argument_types: [:atom, :binary, :fn, :keyword], - excluded_functions: [] - ]}, - {Credo.Check.Refactor.VariableRebinding, false}, - {Credo.Check.Warning.LeakyEnvironment, false}, - {Credo.Check.Warning.MapGetUnsafePass, false}, - {Credo.Check.Warning.UnsafeToAtom, false} + # {Credo.Check.Refactor.MapInto, []}, - # - # Custom checks can be created using `mix credo.gen.check`. - # - ] + # + # Custom checks can be created using `mix credo.gen.check`. + # + ] + } } ] } diff --git a/.dialyzer_ignore b/.dialyzer_ignore index 8b13789..e69de29 100644 --- a/.dialyzer_ignore +++ b/.dialyzer_ignore @@ -1 +0,0 @@ - diff --git a/.envrc b/.envrc index 6d28500..1d953f4 100644 --- a/.envrc +++ b/.envrc @@ -1,84 +1 @@ -#################################### -# Environment setup for Nix shells # -#################################### - -# From https://github.com/direnv/direnv/wiki/Nix#persistent-cached-shell -# -# Usage: use_nix [...] -# -# Load environment variables from `nix-shell`. -# If you have a `default.nix` or `shell.nix` one of these will be used and -# the derived environment will be stored at ./.direnv/env- -# and symlink to it will be created at ./.direnv/default. -# Dependencies are added to the GC roots, such that the environment remains persistent. -# -# Packages can also be specified directly via e.g `use nix -p ocaml`, -# however those will not be added to the GC roots. -# -# The resulting environment is cached for better performance. -# -# To trigger switch to a different environment: -# `rm -f .direnv/default` -# -# To derive a new environment: -# `rm -rf .direnv/env-$(md5sum {shell,default}.nix 2> /dev/null | cut -c -32)` -# -# To remove cache: -# `rm -f .direnv/dump-*` -# -# To remove all environments: -# `rm -rf .direnv/env-*` -# -# To remove only old environments: -# `find .direnv -name 'env-*' -and -not -name `readlink .direnv/default` -exec rm -rf {} +` -# -use_nix() { - set -e - - local shell="shell.nix" - if [[ ! -f "${shell}" ]]; then - shell="default.nix" - fi - - if [[ ! -f "${shell}" ]]; then - fail "use nix: shell.nix or default.nix not found in the folder" - fi - - local dir="${PWD}"/.direnv - local default="${dir}/default" - if [[ ! -L "${default}" ]] || [[ ! -d `readlink "${default}"` ]]; then - local wd="${dir}/env-`md5sum "${shell}" | cut -c -32`" # TODO: Hash also the nixpkgs version? - mkdir -p "${wd}" - - local drv="${wd}/env.drv" - if [[ ! -f "${drv}" ]]; then - log_status "use nix: deriving new environment" - IN_NIX_SHELL=1 nix-instantiate --add-root "${drv}" --indirect "${shell}" > /dev/null - nix-store -r `nix-store --query --references "${drv}"` --add-root "${wd}/dep" --indirect > /dev/null - fi - - rm -f "${default}" - ln -s `basename "${wd}"` "${default}" - fi - - local drv=`readlink -f "${default}/env.drv"` - local dump="${dir}/dump-`md5sum ".envrc" | cut -c -32`-`md5sum ${drv} | cut -c -32`" - - if [[ ! -f "${dump}" ]] || [[ "${XDG_CONFIG_DIR}/direnv/direnvrc" -nt "${dump}" ]]; then - log_status "use nix: updating cache" - - old=`find "${dir}" -name 'dump-*'` - nix-shell "${drv}" --show-trace "$@" --run 'direnv dump' > "${dump}" - rm -f ${old} - fi - - direnv_load cat "${dump}" - - watch_file "${default}" - watch_file shell.nix - if [[ ${shell} == "default.nix" ]]; then - watch_file default.nix - fi -} - use nix diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..58356ea --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: "CI checks" + +on: + push: + branches: + - main + - develop + - release/* + - feature/* + pull_request: + branches: + - develop + +jobs: + check: + name: "CI checks for typed_struct_lens [OTP ${{matrix.otp}} / Elixir ${{matrix.elixir}}]" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: + - elixir: "1.9" + otp: "22.3" + - elixir: "1.10" + otp: "22.3" + - elixir: "1.10" + otp: "23.3" + - elixir: "1.11" + otp: "23.3" + - elixir: "1.12" + otp: "23.3" + - elixir: "1.12" + otp: "24.0" + - elixir: "1.13" + otp: "23.3" + - elixir: "1.13" + otp: "24.0" + steps: + - name: Checkout the repository + uses: actions/checkout@v2.4.0 + - name: Install Elixir/OTP + uses: erlef/setup-beam@v1.10.0 + with: + otp-version: ${{matrix.otp}} + elixir-version: ${{matrix.elixir}} + - name: Fetch the dependencies + run: mix deps.get + - name: Check (mix check) + run: mix check diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2e5da8a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,27 +0,0 @@ -language: elixir -matrix: - include: - - elixir: 1.6 - otp_release: 20.3 - - elixir: 1.7 - otp_release: 22.3 - - elixir: 1.8 - otp_release: 22.3 - - elixir: 1.9 - otp_release: 22.3 - - elixir: 1.10 - otp_release: 22.3 - - elixir: 1.10 - otp_release: 23.0 -env: - - PLT_DIR=$HOME/.plt -before_script: - - mkdir -p $PLT_DIR - - mix deps.compile - - MIX_ENV=test mix deps.compile - - travis_wait mix dialyzer --plt -script: - - mix check -cache: - directories: - - $PLT_DIR diff --git a/CHANGELOG.md b/CHANGELOG.md index 707c6ef..406c4ff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.1.1] - 2022-03-19 + +### Changed + +* Update `typed_struct` to 0.3.0. +* Update `lens` to 1.0.0. + ## [0.1.0] - 2020-05-31 ### Added @@ -14,4 +21,5 @@ Versioning](https://semver.org/spec/v2.0.0.html). * Optionally generate private lens functions * Optionally prefix or postfix the generated function names +[0.1.1]: https://github.com/ejpcmac/typed_struct_lens/compare/v0.1.0...v0.1.1 [0.1.0]: https://github.com/ejpcmac/typed_struct_lens/releases/tag/v0.1.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b98d358..769e642 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,9 +3,9 @@ TypedStructLens is written in [Elixir](https://elixir-lang.org). For branching management, this project uses -[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `master` branch -is reserved for releases: the development process occurs on `develop` and -feature branches. **Please never commit to master.** +[git-flow](https://github.com/petervanderdoes/gitflow-avh). The `main` branch is +reserved for releases: the development process occurs on `develop` and feature +branches. **Please never commit to `main`.** You can easily set up a development environment featuring all the dependencies, including Elixir and `git-flow`, by using [Nix](https://nixos.org/nix/). This is @@ -15,7 +15,7 @@ detailed below. ### Local repository -1. Fork the repository +1. Fork the repository. 2. Clone your fork to a local repository: @@ -26,7 +26,7 @@ detailed below. $ git remote add upstream https://github.com/ejpcmac/typed_struct_lens.git -4. Checkout to `develop`: +4. Checkout `develop`: $ git checkout develop @@ -77,14 +77,14 @@ run: ### Building the project -1. Fetch the project dependencies and build the project: +1. Fetch the project dependencies: $ cd typed_struct_lens - $ mix do deps.get, compile + $ mix deps.get -2. Launch the tests: +2. Run the static analyzers: - $ mix test + $ mix check All the tests should pass. @@ -92,7 +92,7 @@ All the tests should pass. To make a change, please use this workflow: -1. Checkout to `develop` and apply the last upstream changes (use rebase, not +1. Checkout `develop` and apply the last upstream changes (use rebase, not merge!): $ git checkout develop @@ -116,9 +116,9 @@ To make a change, please use this workflow: `cover/excoveralls.html`): # Some work - $ git commit -am "My first change" + $ git commit -am "feat: my first change" # Some work - $ git commit -am "My second change" + $ git commit -am "refactor: my second change" ... 4. When your feature is ready, feel free to use @@ -144,9 +144,7 @@ To make a change, please use this workflow: 6. Run the tests and static analyzers to ensure there is no regression and all works as expected: - $ mix test - $ mix dialyzer - $ mix credo + $ mix check 7. If it’s all good, open a pull request to merge your branch into the `develop` branch on the main repository. @@ -158,3 +156,6 @@ Please format your code with `mix format` or your editor and follow All contributed code must be documented and functions must have typespecs. In general, take your inspiration from the existing code. + +Please name your commits using [Conventional +Commits](https://www.conventionalcommits.org/en/v1.0.0/). diff --git a/LICENSE b/LICENSE index 3d17475..06ea222 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2020 Jean-Philippe Cugnet +Copyright (c) 2020, 2022 Jean-Philippe Cugnet Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 673bdc1..2e94400 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ [![Build Status](https://travis-ci.com/ejpcmac/typed_struct_lens.svg?branch=develop)](https://travis-ci.com/ejpcmac/typed_struct_lens) [![hex.pm version](http://img.shields.io/hexpm/v/typed_struct_lens.svg?style=flat)](https://hex.pm/packages/typed_struct_lens) + + TypedStructLens is a [TypedStruct](https://github.com/ejpcmac/typed_struct) plugin for defining a [Lens](https://github.com/obrok/lens) on each field without writing boilerplate code. @@ -58,7 +60,7 @@ end To use this plugin in your project, add this to your Mix dependencies: ```elixir -{:typed_struct_lens, "~> 0.1.0"} +{:typed_struct_lens, "~> 0.1.1"} ``` If you do not plan to compile modules using this TypedStruct plugin at @@ -152,6 +154,8 @@ defmodule MyStruct do end ``` + + ## [Contributing](CONTRIBUTING.md) Before contributing to this project, please read the @@ -159,6 +163,6 @@ Before contributing to this project, please read the ## License -Copyright © 2020 Jean-Philippe Cugnet +Copyright © 2020, 2022 Jean-Philippe Cugnet This project is licensed under the [MIT license](LICENSE). diff --git a/config/config.exs b/config/config.exs index f468b2a..507651e 100644 --- a/config/config.exs +++ b/config/config.exs @@ -1,4 +1,4 @@ -use Mix.Config +import Config # This configuration is loaded before any dependency and is restricted to this # project. If another project depends on this project, this file won’t be loaded diff --git a/lib/typed_struct_lens.ex b/lib/typed_struct_lens.ex index 890ab8c..0c02773 100644 --- a/lib/typed_struct_lens.ex +++ b/lib/typed_struct_lens.ex @@ -1,146 +1,15 @@ defmodule TypedStructLens do - @moduledoc """ - TypedStructLens is a [TypedStruct](https://github.com/ejpcmac/typed_struct) - plugin for defining a [Lens](https://github.com/obrok/lens) on each field - without writing boilerplate code. - - ## Rationale - - If you define your structs with TypedStruct and use Lens alongside, you may - end up defining lenses for your fields: - - defmodule Person do - use TypedStruct - - import Lens.Macros - - typedstruct do - field :name, String.t(), enforce: true - field :age, non_neg_integer() - field :happy?, boolean(), default: true - field :phone, String.t() - end - - deflens name, do: Lens.key(:name) - deflens age, do: Lens.key(:age) - deflens happy?, do: Lens.key(:happy?) - deflens phone, do: Lens.key(:phone) - end - - But if you are using TypedStruct, it is also highly probable that you do not - like to write boilerplate code. TypedStructLens is here to write the `deflens` - for you: - - defmodule Person do - use TypedStruct - - typedstruct do - plugin TypedStructLens - - field :name, String.t(), enforce: true - field :age, non_neg_integer() - field :happy?, boolean(), default: true - field :phone, String.t() - end - end - - ## Usage - - ### Setup - - To use this plugin in your project, add this to your Mix dependencies: - - {:typed_struct_lens, "~> #{Mix.Project.config()[:version]}"} - - If you do not plan to compile modules using this TypedStruct plugin at - runtime, you can add `runtime: false` to the dependency tuple as it is only - used during compilation. - - ### General usage - - To use this plugin in a typed struct, simply register it in the `typedstruct` - block: - - defmodule MyStruct do - use TypedStruct - - typedstruct do - # Just add this line to your struct. - plugin TypedStructLens - - field :a_field, String.t() - field :other_field, atom() - end - - @spec change(t()) :: t() - def change(data) do - # a_field/0 is generated by TypedStructLens. - lens = a_field() - put_in(data, [lens], "Changed") - end - end - - ### Options - - You can generate private lenses: - - defmodule MyStruct do - use TypedStruct - - typedstruct do - # Define private lenses instead. - plugin TypedStructLens, lens: :private - - field :a_field, String.t() - # You can still make it public for a given field. - field :other_field, atom(), lens: :public - end - end - - Conversely, you can make only a given lens private: - - defmodule MyStruct do - use TypedStruct - - typedstruct do - # By default lenses are public. - plugin TypedStructLens - - field :a_field, String.t() - # You can still make it private for a given field. - field :other_field, atom(), lens: :private - end - end - - To avoid naming clashes, you can also prefix or postfix the generated function - names: - - defmodule MyStruct do - use TypedStruct - - typedstruct do - # Configure a prefix and postfix. - plugin TypedStructLens, prefix: :demo_, postfix: :_lens - - field :a_field, String.t() - field :other_field, atom() - end - - @spec change(t()) :: t() - def change(data) do - # demo_a_field_lens/0 is generated by TypedStructLens instead of - # a_field/0. - lens = demo_a_field_lens() - put_in(data, [lens], "Changed") - end - end - """ + @external_resource "README.md" + @moduledoc "README.md" + |> File.read!() + |> String.split("") + |> Enum.fetch!(1) use TypedStruct.Plugin @impl true - @spec field(atom(), any(), keyword()) :: Macro.t() - def field(name, _type, opts) do + @spec field(atom(), any(), keyword(), Macro.Env.t()) :: Macro.t() + def field(name, _type, opts, _env) do prefix = opts[:prefix] postfix = opts[:postfix] function_name = :"#{prefix}#{name}#{postfix}" diff --git a/mix.exs b/mix.exs index 6624d88..64f9522 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule TypedStructLens.MixProject do use Mix.Project - @version "0.1.0" + @version "0.1.1" @repo_url "https://github.com/ejpcmac/typed_struct_lens" def project do @@ -19,10 +19,17 @@ defmodule TypedStructLens.MixProject do preferred_cli_env: cli_env(), # Docs + name: "TypedStructLens", docs: [ - main: "TypedStructLens", + main: "readme", source_url: @repo_url, - source_ref: "v#{@version}" + source_ref: "v#{@version}", + extras: [ + "README.md": [title: "Overview"], + "CHANGELOG.md": [title: "Changelog"], + "CONTRIBUTING.md": [title: "Contributing"], + LICENSE: [title: "License"] + ] ], # Package @@ -44,20 +51,20 @@ defmodule TypedStructLens.MixProject do defp deps do [ # Development dependencies - {:ex_check, "~> 0.11.0", only: :dev, runtime: false}, + {:ex_check, "~> 0.14.0", only: :dev, runtime: false}, {:credo, "~> 1.0", only: :dev, runtime: false}, - {:dialyxir, "~> 1.0-rc", only: :dev, runtime: false}, + {:dialyxir, "~> 1.0", only: :dev, runtime: false}, {:excoveralls, ">= 0.0.0", only: :test, runtime: false}, {:mix_test_watch, ">= 0.0.0", only: :test, runtime: false}, {:ex_unit_notifier, ">= 0.0.0", only: :test, runtime: false}, - {:stream_data, "~> 0.4.0", only: :test}, + {:stream_data, "~> 0.5.0", only: :test}, # Project dependencies - {:typed_struct, "~> 0.2.0"}, - {:lens, "~> 0.9.0"}, + {:typed_struct, "~> 0.3.0"}, + {:lens, "~> 1.0"}, # Documentation dependencies - {:ex_doc, "~> 0.19", only: :docs, runtime: false} + {:ex_doc, ">= 0.0.0", only: :docs, runtime: false} ] end @@ -102,7 +109,10 @@ defmodule TypedStructLens.MixProject do defp package do [ licenses: ["MIT"], - links: %{"GitHub" => @repo_url} + links: %{ + "Changelog" => "https://hexdocs.pm/typed_struct_lens/changelog.html", + "GitHub" => @repo_url + } ] end @@ -112,8 +122,10 @@ defmodule TypedStructLens.MixProject do with {rev, 0} <- System.cmd("git", ["rev-parse", "--short", "HEAD"], stderr_to_stdout: true - ) do - "-dev+" <> String.trim(rev) + ), + {status, 0} <- System.cmd("git", ["status", "--porcelain"]) do + status = if status == "", do: "", else: "-dirty" + "-dev+" <> String.trim(rev) <> status else _ -> "-dev" end diff --git a/mix.lock b/mix.lock index fe242d6..ba8857a 100644 --- a/mix.lock +++ b/mix.lock @@ -1,28 +1,29 @@ %{ "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, - "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, - "credo": {:hex, :credo, "1.4.0", "92339d4cbadd1e88b5ee43d427b639b68a11071b6f73854e33638e30a0ea11f5", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "1fd3b70dce216574ce3c18bdf510b57e7c4c85c2ec9cad4bff854abaf7e58658"}, - "dialyxir": {:hex, :dialyxir, "1.0.0", "6a1fa629f7881a9f5aaf3a78f094b2a51a0357c843871b8bc98824e7342d00a5", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "aeb06588145fac14ca08d8061a142d52753dbc2cf7f0d00fc1013f53f8654654"}, - "earmark": {:hex, :earmark, "1.4.4", "4821b8d05cda507189d51f2caeef370cf1e18ca5d7dfb7d31e9cafe6688106a4", [:mix], [], "hexpm", "1f93aba7340574847c0f609da787f0d79efcab51b044bb6e242cae5aca9d264d"}, + "certifi": {:hex, :certifi, "2.9.0", "6f2a475689dd47f19fb74334859d460a2dc4e3252a3324bd2111b8f0429e7e21", [:rebar3], [], "hexpm", "266da46bdb06d6c6d35fde799bcb28d36d985d424ad7c08b5bb48f5b5cdd4641"}, + "credo": {:hex, :credo, "1.6.4", "ddd474afb6e8c240313f3a7b0d025cc3213f0d171879429bf8535d7021d9ad78", [:mix], [{:bunt, "~> 0.2.0", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "c28f910b61e1ff829bffa056ef7293a8db50e87f2c57a9b5c3f57eee124536b7"}, + "dialyxir": {:hex, :dialyxir, "1.1.0", "c5aab0d6e71e5522e77beff7ba9e08f8e02bad90dfbeffae60eaf0cb47e29488", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "07ea8e49c45f15264ebe6d5b93799d4dd56a44036cf42d0ad9c960bc266c0b9a"}, + "earmark_parser": {:hex, :earmark_parser, "1.4.23", "1d5f22a2802160fd454404fbf5e8f5d14cd8eb727c63701397b72d8c35267e69", [:mix], [], "hexpm", "2ec13bf14b2f4bbb4a15480970e295eede8bb01087fad6ceca27b724ab8e9d18"}, "erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"}, - "ex_check": {:hex, :ex_check, "0.11.0", "6d878d9ae30d19168157bcbf346b527825284e14e77a07ec0492b19cf0036479", [:mix], [], "hexpm", "d41894aa6193f089a05e3abb43ca457e289619fcfbbdd7b60d070b7a62b26832"}, - "ex_doc": {:hex, :ex_doc, "0.22.1", "9bb6d51508778193a4ea90fa16eac47f8b67934f33f8271d5e1edec2dc0eee4c", [:mix], [{:earmark, "~> 1.4.0", [hex: :earmark, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}], "hexpm", "d957de1b75cb9f78d3ee17820733dc4460114d8b1e11f7ee4fd6546e69b1db60"}, - "ex_unit_notifier": {:hex, :ex_unit_notifier, "0.1.4", "36a2dcab829f506e01bf17816590680dd1474407926d43e64c1263e627c364b8", [:mix], [], "hexpm", "fddf5054dd5fd2f809e837b749570baa5c9798e11d0163921baec49b7d5762f2"}, - "excoveralls": {:hex, :excoveralls, "0.13.0", "4e1b7cc4e0351d8d16e9be21b0345a7e165798ee5319c7800b9138ce17e0b38e", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "fe2a56c8909564e2e6764765878d7d5e141f2af3bc8ff3b018a68ee2a218fced"}, - "file_system": {:hex, :file_system, "0.2.8", "f632bd287927a1eed2b718f22af727c5aeaccc9a98d8c2bd7bff709e851dc986", [:mix], [], "hexpm", "97a3b6f8d63ef53bd0113070102db2ce05352ecf0d25390eb8d747c2bde98bca"}, - "hackney": {:hex, :hackney, "1.16.0", "5096ac8e823e3a441477b2d187e30dd3fff1a82991a806b2003845ce72ce2d84", [:rebar3], [{:certifi, "2.5.2", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "6.0.1", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "1.0.1", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.0", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "1.1.6", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}], "hexpm", "3bf0bebbd5d3092a3543b783bf065165fa5d3ad4b899b836810e513064134e18"}, - "idna": {:hex, :idna, "6.0.1", "1d038fb2e7668ce41fbf681d2c45902e52b3cb9e9c77b55334353b222c2ee50c", [:rebar3], [{:unicode_util_compat, "0.5.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a02c8a1c4fd601215bb0b0324c8a6986749f807ce35f25449ec9e69758708122"}, - "jason": {:hex, :jason, "1.2.1", "12b22825e22f468c02eb3e4b9985f3d0cb8dc40b9bd704730efa11abd2708c44", [:mix], [{:decimal, "~> 1.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "b659b8571deedf60f79c5a608e15414085fa141344e2716fbd6988a084b5f993"}, - "lens": {:hex, :lens, "0.9.0", "b166d4b00eb0c55a78ef76e65a4dc7ad558bdb290d774ca77059070098bfaefd", [:mix], [], "hexpm", "2f51a38444cf0a218687083ecc4735a4f54af83ccb6e65bd2c5d7f8cfdbb3b9c"}, - "makeup": {:hex, :makeup, "1.0.2", "0b9f7bfb7a88bed961341b359bc2cc1b233517af891ba4890ec5a580ffe738b4", [:mix], [{:nimble_parsec, "~> 0.5", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "43833299231c6a6983afc75a34e43eeba638521d5527ff89809fa6372424fd7e"}, - "makeup_elixir": {:hex, :makeup_elixir, "0.14.1", "4f0e96847c63c17841d42c08107405a005a2680eb9c7ccadfd757bd31dabccfb", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "f2438b1a80eaec9ede832b5c41cd4f373b38fd7aa33e3b22d9db79e640cbde11"}, + "ex_check": {:hex, :ex_check, "0.14.0", "d6fbe0bcc51cf38fea276f5bc2af0c9ae0a2bb059f602f8de88709421dae4f0e", [:mix], [], "hexpm", "8a602e98c66e6a4be3a639321f1f545292042f290f91fa942a285888c6868af0"}, + "ex_doc": {:hex, :ex_doc, "0.28.2", "e031c7d1a9fc40959da7bf89e2dc269ddc5de631f9bd0e326cbddf7d8085a9da", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "51ee866993ffbd0e41c084a7677c570d0fc50cb85c6b5e76f8d936d9587fa719"}, + "ex_unit_notifier": {:hex, :ex_unit_notifier, "1.2.0", "73ced2ecee0f2da0705e372c21ce61e4e5d927ddb797f73928e52818b9cc1754", [:mix], [], "hexpm", "f38044c9d50de68ad7f0aec4d781a10d9f1c92c62b36bf0227ec0aaa96aee332"}, + "excoveralls": {:hex, :excoveralls, "0.14.4", "295498f1ae47bdc6dce59af9a585c381e1aefc63298d48172efaaa90c3d251db", [:mix], [{:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "e3ab02f2df4c1c7a519728a6f0a747e71d7d6e846020aae338173619217931c1"}, + "file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"}, + "hackney": {:hex, :hackney, "1.18.1", "f48bf88f521f2a229fc7bae88cf4f85adc9cd9bcf23b5dc8eb6a1788c662c4f6", [:rebar3], [{:certifi, "~>2.9.0", [hex: :certifi, repo: "hexpm", optional: false]}, {:idna, "~>6.1.0", [hex: :idna, repo: "hexpm", optional: false]}, {:metrics, "~>1.0.0", [hex: :metrics, repo: "hexpm", optional: false]}, {:mimerl, "~>1.1", [hex: :mimerl, repo: "hexpm", optional: false]}, {:parse_trans, "3.3.1", [hex: :parse_trans, repo: "hexpm", optional: false]}, {:ssl_verify_fun, "~>1.1.0", [hex: :ssl_verify_fun, repo: "hexpm", optional: false]}, {:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "a4ecdaff44297e9b5894ae499e9a070ea1888c84afdd1fd9b7b2bc384950128e"}, + "idna": {:hex, :idna, "6.1.1", "8a63070e9f7d0c62eb9d9fcb360a7de382448200fbbd1b106cc96d3d8099df8d", [:rebar3], [{:unicode_util_compat, "~>0.7.0", [hex: :unicode_util_compat, repo: "hexpm", optional: false]}], "hexpm", "92376eb7894412ed19ac475e4a86f7b413c1b9fbb5bd16dccd57934157944cea"}, + "jason": {:hex, :jason, "1.3.0", "fa6b82a934feb176263ad2df0dbd91bf633d4a46ebfdffea0c8ae82953714946", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "53fc1f51255390e0ec7e50f9cb41e751c260d065dcba2bf0d08dc51a4002c2ac"}, + "lens": {:hex, :lens, "1.0.0", "bad01a2ff90ce0e13ce486ed1750c92c06d96d271368e56771fe68d0415d4877", [:mix], [], "hexpm", "581349c3e42181696f71ead8b016cc548715eb125c41d003297dd1a670e46f21"}, + "makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"}, + "makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"}, + "makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"}, "metrics": {:hex, :metrics, "1.0.1", "25f094dea2cda98213cecc3aeff09e940299d950904393b2a29d191c346a8486", [:rebar3], [], "hexpm", "69b09adddc4f74a40716ae54d140f93beb0fb8978d8636eaded0c31b6f099f16"}, "mimerl": {:hex, :mimerl, "1.2.0", "67e2d3f571088d5cfd3e550c383094b47159f3eee8ffa08e64106cdf5e981be3", [:rebar3], [], "hexpm", "f278585650aa581986264638ebf698f8bb19df297f66ad91b18910dfc6e19323"}, - "mix_test_watch": {:hex, :mix_test_watch, "1.0.2", "34900184cbbbc6b6ed616ed3a8ea9b791f9fd2088419352a6d3200525637f785", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "47ac558d8b06f684773972c6d04fcc15590abdb97aeb7666da19fcbfdc441a07"}, - "nimble_parsec": {:hex, :nimble_parsec, "0.6.0", "32111b3bf39137144abd7ba1cce0914533b2d16ef35e8abc5ec8be6122944263", [:mix], [], "hexpm", "27eac315a94909d4dc68bc07a4a83e06c8379237c5ea528a9acff4ca1c873c52"}, - "parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"}, + "mix_test_watch": {:hex, :mix_test_watch, "1.1.0", "330bb91c8ed271fe408c42d07e0773340a7938d8a0d281d57a14243eae9dc8c3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "52b6b1c476cbb70fd899ca5394506482f12e5f6b0d6acff9df95c7f1e0812ec3"}, + "nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"}, + "parse_trans": {:hex, :parse_trans, "3.3.1", "16328ab840cc09919bd10dab29e431da3af9e9e7e7e6f0089dd5a2d2820011d8", [:rebar3], [], "hexpm", "07cd9577885f56362d414e8c4c4e6bdf10d43a8767abb92d24cbe8b24c54888b"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, - "stream_data": {:hex, :stream_data, "0.4.3", "62aafd870caff0849a5057a7ec270fad0eb86889f4d433b937d996de99e3db25", [:mix], [], "hexpm", "7dafd5a801f0bc897f74fcd414651632b77ca367a7ae4568778191fc3bf3a19a"}, - "typed_struct": {:hex, :typed_struct, "0.2.0", "503c75208919891137f38a9f043715947fa11659b7f0c5f773bc185ebdd3f957", [:mix], [], "hexpm", "2332942218afc06a1eefed58107d9ecdd8a157d783e04ec10cf5c71d1004be19"}, - "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, + "stream_data": {:hex, :stream_data, "0.5.0", "b27641e58941685c75b353577dc602c9d2c12292dd84babf506c2033cd97893e", [:mix], [], "hexpm", "012bd2eec069ada4db3411f9115ccafa38540a3c78c4c0349f151fc761b9e271"}, + "typed_struct": {:hex, :typed_struct, "0.3.0", "939789e3c1dca39d7170c87f729127469d1315dcf99fee8e152bb774b17e7ff7", [:mix], [], "hexpm", "c50bd5c3a61fe4e198a8504f939be3d3c85903b382bde4865579bc23111d1b6d"}, + "unicode_util_compat": {:hex, :unicode_util_compat, "0.7.0", "bc84380c9ab48177092f43ac89e4dfa2c6d62b40b8bd132b1059ecc7232f9a78", [:rebar3], [], "hexpm", "25eee6d67df61960cf6a794239566599b09e17e668d3700247bc498638152521"}, } diff --git a/shell.nix b/shell.nix index bf3aa83..06b7684 100644 --- a/shell.nix +++ b/shell.nix @@ -4,13 +4,10 @@ with pkgs; let inherit (lib) optional optionals; - - elixir = beam.packages.erlangR22.elixir_1_10; - gitflow = gitAndTools.gitflow; in mkShell { - buildInputs = [ elixir git gitflow ] + buildInputs = [ elixir git gitAndTools.gitflow ] ++ optional stdenv.isLinux libnotify # For ExUnit Notifier on Linux. ++ optional stdenv.isLinux inotify-tools # For file_system on Linux. ++ optional stdenv.isDarwin terminal-notifier # For ExUnit Notifier on macOS.