Browse Source

Format dotfiles versions before comparison (#207)

Allows both `.node-version` and `.nvmrc` files to contain the same version, if they're formatted into the same version. i.e. `11.10.0` should equal to `v11.10.0`

Closes #206
remotes/origin/add-simple-redirecting-site
Amit Dahan 5 years ago committed by GitHub
parent
commit
384f18836d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      .gitignore
  2. 1
      feature_tests/almost-matching-dotfiles/.node-version
  3. 1
      feature_tests/almost-matching-dotfiles/.nvmrc
  4. 13
      feature_tests/almost-matching-dotfiles/run.sh
  5. 2
      library/Dotfiles.re

4
.gitignore vendored

@ -10,4 +10,6 @@ fnm.install @@ -10,4 +10,6 @@ fnm.install
.DS_Store
*.install
.tmp
docs/screen_recording
docs/screen_recording
.idea
.fnmTmp

1
feature_tests/almost-matching-dotfiles/.node-version

@ -0,0 +1 @@ @@ -0,0 +1 @@
11.10.0

1
feature_tests/almost-matching-dotfiles/.nvmrc

@ -0,0 +1 @@ @@ -0,0 +1 @@
v11.10.0

13
feature_tests/almost-matching-dotfiles/run.sh

@ -0,0 +1,13 @@ @@ -0,0 +1,13 @@
#!/bin/bash
#set -e
eval $(fnm env)
fnm install
fnm use
echo node --version
if [ "$(node --version)" != "v11.10.0" ]; then
echo "Expected Node version is not v11.10.0!"
exit 1
fi

2
library/Dotfiles.re

@ -20,7 +20,7 @@ let getVersion = () => { @@ -20,7 +20,7 @@ let getVersion = () => {
switch (nodeVersion, nvmrc) {
| (None, None) => Lwt.fail(Version_Not_Provided)
| (Some(v1), Some(v2)) when v1 != v2 =>
| (Some(v1), Some(v2)) when Versions.format(v1) != Versions.format(v2) =>
Lwt.fail(Conflicting_Dotfiles_Found(v1, v2))
| (Some(version), Some(_))
| (Some(version), None)

Loading…
Cancel
Save