From 56697581e8a375ce90e36ea20c0dfdd3757163de Mon Sep 17 00:00:00 2001 From: Thibaut Mattio Date: Sun, 29 Dec 2019 21:06:59 -0500 Subject: [PATCH] Convert to new project structure --- bin/cmd/cmd.re | 1 + .../cmd/Cmd__gen.re => bin/cmd/cmd_gen.re | 2 +- .../cmd/cmd_ls.re | 4 +- .../cmd/Cmd__new.re => bin/cmd/cmd_new.re | 0 bin/dune | 4 + executable/Man.re => bin/man.re | 0 executable/Package.re => bin/package.re | 0 executable/SpinApp.re => bin/spin_app.re | 0 dune | 7 - esy.json | 123 +++++++++++++ esy.lock/.gitattributes | 2 +- esy.lock/index.json | 170 +++++++++--------- esy.lock/opam/{lwt.4.4.0 => lwt.5.1.0}/opam | 10 +- .../{lwt_ppx.1.2.4 => lwt_ppx.2.0.0}/opam | 8 +- .../files/findlib-1.8.1.patch | 2 +- executable/cmd/Cmd.re | 1 - executable/dune | 14 -- library/Config.re => lib/config.re | 0 .../config_file/config_file.re | 12 +- .../config_file/config_file_common.re | 0 .../config_file/config_file_cst_utils.re | 2 +- .../config_file/config_file_doc.re | 10 +- .../config_file/config_file_generators.re | 22 +-- .../config_file/config_file_project.re | 4 +- .../config_file/config_file_template.re | 20 +-- lib/dune | 5 + library/Errors.re => lib/errors.re | 4 +- library/Errors.rei => lib/errors.rei | 2 +- library/Generators.re => lib/generators.re | 12 +- library/Jg_wrapper.re => lib/jg_wrapper.re | 0 library/Prompt.re => lib/prompt.re | 0 library/Prompt.rei => lib/prompt.rei | 0 library/Source.re => lib/source.re | 6 +- library/Template.re => lib/template.re | 6 +- .../template_official.re | 4 +- library/Utils.re => lib/utils.re | 0 library/Vcs.re => lib/vcs.re | 0 library/dune | 14 -- package.json | 105 ----------- scripts/{prepare-release.sh => release.sh} | 1 - spin.opam | 15 ++ test/TestRunner.re | 7 - test/dune | 16 +- ...__TemplateFilter.re => jg_wrapper_test.re} | 2 +- .../{Test__Template.re => template_test.re} | 8 +- test/spin/{Test__Utils.re => utils_test.re} | 2 +- test/spin/{Test__Vcs.re => vcs_test.re} | 2 +- test/spin_exe/{SmokeTest.re => smoke_test.re} | 2 +- .../{TestFramework.re => test_framework.re} | 12 +- test/support/{TestUtils.re => test_utils.re} | 0 test_runner/dune | 2 + test_runner/test_runner.re | 9 + 52 files changed, 327 insertions(+), 327 deletions(-) create mode 100644 bin/cmd/cmd.re rename executable/cmd/Cmd__gen.re => bin/cmd/cmd_gen.re (96%) rename executable/cmd/Cmd__list_templates.re => bin/cmd/cmd_ls.re (89%) rename executable/cmd/Cmd__new.re => bin/cmd/cmd_new.re (100%) create mode 100644 bin/dune rename executable/Man.re => bin/man.re (100%) rename executable/Package.re => bin/package.re (100%) rename executable/SpinApp.re => bin/spin_app.re (100%) delete mode 100644 dune create mode 100644 esy.json rename esy.lock/opam/{lwt.4.4.0 => lwt.5.1.0}/opam (85%) rename esy.lock/opam/{lwt_ppx.1.2.4 => lwt_ppx.2.0.0}/opam (79%) delete mode 100644 executable/cmd/Cmd.re delete mode 100644 executable/dune rename library/Config.re => lib/config.re (100%) rename library/config_file/ConfigFile.re => lib/config_file/config_file.re (75%) rename library/config_file/ConfigFile__Common.re => lib/config_file/config_file_common.re (100%) rename library/config_file/ConfigFile__CstUtils.re => lib/config_file/config_file_cst_utils.re (91%) rename library/config_file/ConfigFile__Doc.re => lib/config_file/config_file_doc.re (86%) rename library/config_file/ConfigFile__Generators.re => lib/config_file/config_file_generators.re (70%) rename library/config_file/ConfigFile__Project.re => lib/config_file/config_file_project.re (96%) rename library/config_file/ConfigFile__Template.re => lib/config_file/config_file_template.re (71%) create mode 100644 lib/dune rename library/Errors.re => lib/errors.re (97%) rename library/Errors.rei => lib/errors.rei (90%) rename library/Generators.re => lib/generators.re (89%) rename library/Jg_wrapper.re => lib/jg_wrapper.re (100%) rename library/Prompt.re => lib/prompt.re (100%) rename library/Prompt.rei => lib/prompt.rei (100%) rename library/Source.re => lib/source.re (81%) rename library/Template.re => lib/template.re (95%) rename library/TemplateOfficial.re => lib/template_official.re (90%) rename library/Utils.re => lib/utils.re (100%) rename library/Vcs.re => lib/vcs.re (100%) delete mode 100644 library/dune rename scripts/{prepare-release.sh => release.sh} (97%) delete mode 100644 test/TestRunner.re rename test/spin/{Test__TemplateFilter.re => jg_wrapper_test.re} (97%) rename test/spin/{Test__Template.re => template_test.re} (92%) rename test/spin/{Test__Utils.re => utils_test.re} (96%) rename test/spin/{Test__Vcs.re => vcs_test.re} (96%) rename test/spin_exe/{SmokeTest.re => smoke_test.re} (90%) rename test/support/{TestFramework.re => test_framework.re} (67%) rename test/support/{TestUtils.re => test_utils.re} (100%) create mode 100644 test_runner/dune create mode 100644 test_runner/test_runner.re diff --git a/bin/cmd/cmd.re b/bin/cmd/cmd.re new file mode 100644 index 0000000..016d097 --- /dev/null +++ b/bin/cmd/cmd.re @@ -0,0 +1 @@ +let all = [Cmd_new.cmd, Cmd_ls.cmd, Cmd_gen.cmd]; diff --git a/executable/cmd/Cmd__gen.re b/bin/cmd/cmd_gen.re similarity index 96% rename from executable/cmd/Cmd__gen.re rename to bin/cmd/cmd_gen.re index 6e64c62..a65b52a 100644 --- a/executable/cmd/Cmd__gen.re +++ b/bin/cmd/cmd_gen.re @@ -8,7 +8,7 @@ let run = (~generator, ()) => { let source = Source.ofString(config.source); let generators = Generators.listGenerators(source) - |> List.map(~f=ConfigFile.Generators.parse_doc); + |> List.map(~f=Config_file.Generators.parse_doc); Console.log( "The generators available for this project are:\n" , diff --git a/executable/cmd/Cmd__list_templates.re b/bin/cmd/cmd_ls.re similarity index 89% rename from executable/cmd/Cmd__list_templates.re rename to bin/cmd/cmd_ls.re index 5861224..a554f85 100644 --- a/executable/cmd/Cmd__list_templates.re +++ b/bin/cmd/cmd_ls.re @@ -2,8 +2,8 @@ open Cmdliner; open Spin; let run = () => { - TemplateOfficial.ensureDownloaded(); - let templates = TemplateOfficial.all(); + Template_official.ensureDownloaded(); + let templates = Template_official.all(); Console.log( "The official templates are:\n" ); diff --git a/executable/cmd/Cmd__new.re b/bin/cmd/cmd_new.re similarity index 100% rename from executable/cmd/Cmd__new.re rename to bin/cmd/cmd_new.re diff --git a/bin/dune b/bin/dune new file mode 100644 index 0000000..f90f133 --- /dev/null +++ b/bin/dune @@ -0,0 +1,4 @@ +(executable (name spin_app) (modules (:standard)) (public_name spin.exe) + (libraries base cmdliner lwt.unix console.lib pastel.lib spin.lib) + (flags -open Base) (preprocess (pps lwt_ppx ppx_let))) +(include_subdirs unqualified) diff --git a/executable/Man.re b/bin/man.re similarity index 100% rename from executable/Man.re rename to bin/man.re diff --git a/executable/Package.re b/bin/package.re similarity index 100% rename from executable/Package.re rename to bin/package.re diff --git a/executable/SpinApp.re b/bin/spin_app.re similarity index 100% rename from executable/SpinApp.re rename to bin/spin_app.re diff --git a/dune b/dune deleted file mode 100644 index 1feddb0..0000000 --- a/dune +++ /dev/null @@ -1,7 +0,0 @@ -(dirs - (:standard \ node_modules \ _esy)) - -(env - (dev - (flags - (:standard -warn-error -A)))) diff --git a/esy.json b/esy.json new file mode 100644 index 0000000..a4e31e0 --- /dev/null +++ b/esy.json @@ -0,0 +1,123 @@ +{ + "name": "spin", + "esy": { + "build": "dune build -p #{self.name}", + "buildDev": "refmterr dune build -p #{self.name}", + "buildsInSource": "_build", + "release": { + "bin": { + "spin": "spin.exe" + } + } + }, + "buildDirs": { + "test": { + "require": [ + "spin.lib", + "rely.lib" + ], + "flags": [ + "-open", + "Base", + "-linkall", + "-g", + "-w", + "-9" + ], + "includeSubdirs": "unqualified", + "namespace": "spin_test" + }, + "test_runner": { + "require": [ + "spin/test" + ], + "bin": { + "test-runner.exe": "test_runner.re" + } + }, + "lib": { + "preprocess": [ + "pps", + "lwt_ppx", + "ppx_let", + "ppx_sexp_conv" + ], + "require": [ + "base", + "console.lib", + "pastel.lib", + "lwt.unix", + "str", + "stdio", + "sexplib", + "jingoo", + "fileutils" + ], + "flags": [ + "-open", + "Base" + ], + "includeSubdirs": "unqualified", + "namespace": "Spin" + }, + "bin": { + "preprocess": [ + "pps", + "lwt_ppx", + "ppx_let" + ], + "require": [ + "base", + "cmdliner", + "lwt.unix", + "console.lib", + "pastel.lib", + "spin.lib" + ], + "flags": [ + "-open", + "Base" + ], + "bin": { + "spin.exe": "spin_app.re" + }, + "includeSubdirs": "unqualified" + } + }, + "dependencies": { + "@esy-ocaml/reason": "*", + "@opam/base": "v0.13.0", + "@opam/cmdliner": "1.0.4", + "@opam/dune": ">=1.6.0", + "@opam/fileutils": "*", + "@opam/jingoo": "*", + "@opam/lwt": "^4.4.0", + "@opam/lwt_ppx": "^1.2.4", + "@opam/ppx_let": "v0.13.0", + "@opam/ppx_sexp_conv": "v0.13.0", + "@opam/sexplib": "v0.13.0", + "@reason-native/console": "^0.1.0", + "@reason-native/pastel": "^0.2.2", + "@reason-native/rely": "^3.1.0", + "ocaml": "~4.8.1000" + }, + "devDependencies": { + "@opam/merlin": "*", + "@opam/odoc": "*", + "@opam/utop": "*", + "@pesy/esy-pesy": "esy/pesy#5c6e1c3", + "refmterr": "*" + }, + "resolutions": { + "@opam/jingoo": "tmattio/jingoo:jingoo.opam#e012716" + }, + "scripts": { + "start": "esy x spin.exe", + "test": "esy x test-runner.exe", + "doc": "esy dune build @doc", + "format": "esy dune build @fmt --auto-promote", + "watch": "esy dune build -p #{self.name} --watch", + "doc-path": "esy echo #{self.target_dir}/default/_doc/_html/index.html", + "utop": "esy dune utop lib -- -implicit-bindings" + } +} diff --git a/esy.lock/.gitattributes b/esy.lock/.gitattributes index 25366ae..e0b4e26 100644 --- a/esy.lock/.gitattributes +++ b/esy.lock/.gitattributes @@ -1,3 +1,3 @@ # Set eol to LF so files aren't converted to CRLF-eol on Windows. -* text eol=lf +* text eol=lf linguist-generated diff --git a/esy.lock/index.json b/esy.lock/index.json index befd7f7..6a35457 100644 --- a/esy.lock/index.json +++ b/esy.lock/index.json @@ -1,20 +1,48 @@ { - "checksum": "54fe1f5ce3aba7af0791b874f8fc4cbe", - "root": "@tmattio/spin@link-dev:./package.json", + "checksum": "d79c911b11ce4dbd6a8e84d4964fa286", + "root": "spin@link-dev:./esy.json", "node": { - "refmterr@3.2.2@d41d8cd9": { - "id": "refmterr@3.2.2@d41d8cd9", + "spin@link-dev:./esy.json": { + "id": "spin@link-dev:./esy.json", + "name": "spin", + "version": "link-dev:./esy.json", + "source": { "type": "link-dev", "path": ".", "manifest": "esy.json" }, + "overrides": [], + "dependencies": [ + "ocaml@4.8.1000@d41d8cd9", "@reason-native/rely@3.1.0@d41d8cd9", + "@reason-native/pastel@0.2.3@d41d8cd9", + "@reason-native/console@0.1.0@d41d8cd9", + "@opam/sexplib@opam:v0.13.0@79086695", + "@opam/ppx_sexp_conv@opam:v0.13.0@53058ed2", + "@opam/ppx_let@opam:v0.13.0@5703d2be", + "@opam/lwt_ppx@opam:2.0.0@9a61dd37", "@opam/lwt@opam:5.1.0@e9f9e9f8", + "@opam/jingoo@github:tmattio/jingoo:jingoo.opam#e012716@d41d8cd9", + "@opam/fileutils@opam:0.6.1@62fff95c", + "@opam/dune@opam:1.11.4@a7ccb7ae", + "@opam/cmdliner@opam:1.0.4@93208aac", + "@opam/base@opam:v0.13.0@93f21415", + "@esy-ocaml/reason@3.5.2@d41d8cd9" + ], + "devDependencies": [ + "refmterr@3.3.0@d41d8cd9", + "@pesy/esy-pesy@github:esy/pesy#5c6e1c3@d41d8cd9", + "@opam/utop@opam:2.4.2@4656e89b", "@opam/odoc@opam:1.4.2@11b715bb", + "@opam/merlin@opam:3.3.3@d653b06a" + ] + }, + "refmterr@3.3.0@d41d8cd9": { + "id": "refmterr@3.3.0@d41d8cd9", "name": "refmterr", - "version": "3.2.2", + "version": "3.3.0", "source": { "type": "install", "source": [ - "archive:https://registry.npmjs.org/refmterr/-/refmterr-3.2.2.tgz#sha1:b7d6c5df6a37633ec82d339dc609b1867e54e55e" + "archive:https://registry.npmjs.org/refmterr/-/refmterr-3.3.0.tgz#sha1:45adde80205093c201b491b3c37dd7740c9b036b" ] }, "overrides": [], "dependencies": [ - "ocaml@4.8.1000@d41d8cd9", "@reason-native/pastel@0.2.2@d41d8cd9", + "ocaml@4.8.1000@d41d8cd9", "@reason-native/pastel@0.2.3@d41d8cd9", "@reason-native/console@0.1.0@d41d8cd9", "@opam/re@opam:1.9.0@d4d5e13d", "@opam/dune@opam:1.11.4@a7ccb7ae", "@opam/atdgen@opam:2.0.0@46af0360", @@ -22,20 +50,6 @@ ], "devDependencies": [] }, - "pesy@0.4.4@d41d8cd9": { - "id": "pesy@0.4.4@d41d8cd9", - "name": "pesy", - "version": "0.4.4", - "source": { - "type": "install", - "source": [ - "archive:https://registry.npmjs.org/pesy/-/pesy-0.4.4.tgz#sha1:af7a3f6fc8c33c0c6eb57265be0c14d5715d6b69" - ] - }, - "overrides": [], - "dependencies": [], - "devDependencies": [] - }, "ocaml@4.8.1000@d41d8cd9": { "id": "ocaml@4.8.1000@d41d8cd9", "name": "ocaml", @@ -50,37 +64,6 @@ "dependencies": [], "devDependencies": [] }, - "@tmattio/spin@link-dev:./package.json": { - "id": "@tmattio/spin@link-dev:./package.json", - "name": "@tmattio/spin", - "version": "link-dev:./package.json", - "source": { - "type": "link-dev", - "path": ".", - "manifest": "package.json" - }, - "overrides": [], - "dependencies": [ - "ocaml@4.8.1000@d41d8cd9", "@reason-native/rely@3.1.0@d41d8cd9", - "@reason-native/pastel@0.2.2@d41d8cd9", - "@reason-native/console@0.1.0@d41d8cd9", - "@opam/sexplib@opam:v0.13.0@79086695", - "@opam/ppx_sexp_conv@opam:v0.13.0@53058ed2", - "@opam/ppx_let@opam:v0.13.0@5703d2be", - "@opam/lwt_ppx@opam:1.2.4@369f3faf", "@opam/lwt@opam:4.4.0@0357bb8b", - "@opam/jingoo@github:tmattio/jingoo:jingoo.opam#e012716@d41d8cd9", - "@opam/fileutils@opam:0.6.1@62fff95c", - "@opam/dune@opam:1.11.4@a7ccb7ae", - "@opam/cmdliner@opam:1.0.4@93208aac", - "@opam/base@opam:v0.13.0@93f21415", - "@esy-ocaml/reason@3.5.2@d41d8cd9" - ], - "devDependencies": [ - "refmterr@3.2.2@d41d8cd9", "pesy@0.4.4@d41d8cd9", - "@opam/utop@opam:2.4.2@4656e89b", "@opam/odoc@opam:1.4.2@11b715bb", - "@opam/merlin@opam:3.3.3@d653b06a" - ] - }, "@reason-native/rely@3.1.0@d41d8cd9": { "id": "@reason-native/rely@3.1.0@d41d8cd9", "name": "@reason-native/rely", @@ -93,22 +76,22 @@ }, "overrides": [], "dependencies": [ - "refmterr@3.2.2@d41d8cd9", "ocaml@4.8.1000@d41d8cd9", - "@reason-native/pastel@0.2.2@d41d8cd9", + "refmterr@3.3.0@d41d8cd9", "ocaml@4.8.1000@d41d8cd9", + "@reason-native/pastel@0.2.3@d41d8cd9", "@reason-native/file-context-printer@0.0.3@d41d8cd9", "@opam/re@opam:1.9.0@d4d5e13d", "@opam/junit@opam:2.0.1@1b4d302c", "@opam/dune@opam:1.11.4@a7ccb7ae", "@esy-ocaml/reason@3.5.2@d41d8cd9" ], "devDependencies": [] }, - "@reason-native/pastel@0.2.2@d41d8cd9": { - "id": "@reason-native/pastel@0.2.2@d41d8cd9", + "@reason-native/pastel@0.2.3@d41d8cd9": { + "id": "@reason-native/pastel@0.2.3@d41d8cd9", "name": "@reason-native/pastel", - "version": "0.2.2", + "version": "0.2.3", "source": { "type": "install", "source": [ - "archive:https://registry.npmjs.org/@reason-native/pastel/-/pastel-0.2.2.tgz#sha1:a1f7fe266223aaf7915a71f5c8b9ee58e065c62a" + "archive:https://registry.npmjs.org/@reason-native/pastel/-/pastel-0.2.3.tgz#sha1:5c5d420c09874584ce15a38695c5dfd0f0ff5dfa" ] }, "overrides": [], @@ -130,7 +113,7 @@ }, "overrides": [], "dependencies": [ - "ocaml@4.8.1000@d41d8cd9", "@reason-native/pastel@0.2.2@d41d8cd9", + "ocaml@4.8.1000@d41d8cd9", "@reason-native/pastel@0.2.3@d41d8cd9", "@opam/re@opam:1.9.0@d4d5e13d", "@opam/dune@opam:1.11.4@a7ccb7ae", "@esy-ocaml/reason@3.5.2@d41d8cd9" ], @@ -153,6 +136,27 @@ ], "devDependencies": [] }, + "@pesy/esy-pesy@github:esy/pesy#5c6e1c3@d41d8cd9": { + "id": "@pesy/esy-pesy@github:esy/pesy#5c6e1c3@d41d8cd9", + "name": "@pesy/esy-pesy", + "version": "github:esy/pesy#5c6e1c3", + "source": { + "type": "install", + "source": [ "github:esy/pesy#5c6e1c3" ] + }, + "overrides": [], + "dependencies": [ + "ocaml@4.8.1000@d41d8cd9", "@reason-native/rely@3.1.0@d41d8cd9", + "@reason-native/pastel@0.2.3@d41d8cd9", + "@opam/yojson@opam:1.7.0@7056d985", + "@opam/sexplib@opam:v0.13.0@79086695", + "@opam/ocamlfind@opam:1.8.1@ff07b0f9", + "@opam/dune@opam:1.11.4@a7ccb7ae", + "@opam/cmdliner@opam:1.0.4@93208aac", + "@esy-ocaml/reason@3.5.2@d41d8cd9" + ], + "devDependencies": [ "ocaml@4.8.1000@d41d8cd9" ] + }, "@opam/zed@opam:2.0.3@62853a38": { "id": "@opam/zed@opam:2.0.3@62853a38", "name": "@opam/zed", @@ -293,7 +297,7 @@ "ocaml@4.8.1000@d41d8cd9", "@opam/react@opam:1.2.1@0e11855f", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/lwt_react@opam:1.1.3@72987fcf", - "@opam/lwt@opam:4.4.0@0357bb8b", + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/lambda-term@opam:2.0.2@119fb081", "@opam/dune@opam:1.11.4@a7ccb7ae", "@opam/cppo@opam:1.6.6@f4f83858", "@opam/camomile@opam:1.0.2@51b42ad8", @@ -305,7 +309,7 @@ "ocaml@4.8.1000@d41d8cd9", "@opam/react@opam:1.2.1@0e11855f", "@opam/ocamlfind@opam:1.8.1@ff07b0f9", "@opam/lwt_react@opam:1.1.3@72987fcf", - "@opam/lwt@opam:4.4.0@0357bb8b", + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/lambda-term@opam:2.0.2@119fb081", "@opam/dune@opam:1.11.4@a7ccb7ae", "@opam/camomile@opam:1.0.2@51b42ad8", @@ -1198,28 +1202,28 @@ "overrides": [], "dependencies": [ "ocaml@4.8.1000@d41d8cd9", "@opam/react@opam:1.2.1@0e11855f", - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae", + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ "ocaml@4.8.1000@d41d8cd9", "@opam/react@opam:1.2.1@0e11855f", - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae" + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae" ] }, - "@opam/lwt_ppx@opam:1.2.4@369f3faf": { - "id": "@opam/lwt_ppx@opam:1.2.4@369f3faf", + "@opam/lwt_ppx@opam:2.0.0@9a61dd37": { + "id": "@opam/lwt_ppx@opam:2.0.0@9a61dd37", "name": "@opam/lwt_ppx", - "version": "opam:1.2.4", + "version": "opam:2.0.0", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/md5/8b/8bfc70c2944020fa08dd04877747f5f9#md5:8bfc70c2944020fa08dd04877747f5f9", - "archive:https://github.com/ocsigen/lwt/archive/4.4.0.tar.gz#md5:8bfc70c2944020fa08dd04877747f5f9" + "archive:https://opam.ocaml.org/cache/md5/a4/a4ffc0e3aa692d2e7d800f4cf2dd3db0#md5:a4ffc0e3aa692d2e7d800f4cf2dd3db0", + "archive:https://github.com/ocsigen/lwt/archive/5.0.0.tar.gz#md5:a4ffc0e3aa692d2e7d800f4cf2dd3db0" ], "opam": { "name": "lwt_ppx", - "version": "1.2.4", - "path": "esy.lock/opam/lwt_ppx.1.2.4" + "version": "2.0.0", + "path": "esy.lock/opam/lwt_ppx.2.0.0" } }, "overrides": [], @@ -1227,14 +1231,14 @@ "ocaml@4.8.1000@d41d8cd9", "@opam/ppx_tools_versioned@opam:5.2.3@4994ec80", "@opam/ocaml-migrate-parsetree@opam:1.5.0@3e319dbc", - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae", + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ "ocaml@4.8.1000@d41d8cd9", "@opam/ppx_tools_versioned@opam:5.2.3@4994ec80", "@opam/ocaml-migrate-parsetree@opam:1.5.0@3e319dbc", - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae" + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae" ] }, "@opam/lwt_log@opam:1.1.1@2d7a797f": { @@ -1255,27 +1259,27 @@ }, "overrides": [], "dependencies": [ - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae", + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae", "@esy-ocaml/substs@0.0.1@d41d8cd9" ], "devDependencies": [ - "@opam/lwt@opam:4.4.0@0357bb8b", "@opam/dune@opam:1.11.4@a7ccb7ae" + "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae" ] }, - "@opam/lwt@opam:4.4.0@0357bb8b": { - "id": "@opam/lwt@opam:4.4.0@0357bb8b", + "@opam/lwt@opam:5.1.0@e9f9e9f8": { + "id": "@opam/lwt@opam:5.1.0@e9f9e9f8", "name": "@opam/lwt", - "version": "opam:4.4.0", + "version": "opam:5.1.0", "source": { "type": "install", "source": [ - "archive:https://opam.ocaml.org/cache/md5/8b/8bfc70c2944020fa08dd04877747f5f9#md5:8bfc70c2944020fa08dd04877747f5f9", - "archive:https://github.com/ocsigen/lwt/archive/4.4.0.tar.gz#md5:8bfc70c2944020fa08dd04877747f5f9" + "archive:https://opam.ocaml.org/cache/md5/04/04e5ce110c3786199171770c47d968da#md5:04e5ce110c3786199171770c47d968da", + "archive:https://github.com/ocsigen/lwt/archive/5.1.0.tar.gz#md5:04e5ce110c3786199171770c47d968da" ], "opam": { "name": "lwt", - "version": "4.4.0", - "path": "esy.lock/opam/lwt.4.4.0" + "version": "5.1.0", + "path": "esy.lock/opam/lwt.5.1.0" } }, "overrides": [], @@ -1320,7 +1324,7 @@ "ocaml@4.8.1000@d41d8cd9", "@opam/zed@opam:2.0.3@62853a38", "@opam/react@opam:1.2.1@0e11855f", "@opam/lwt_react@opam:1.1.3@72987fcf", - "@opam/lwt_log@opam:1.1.1@2d7a797f", "@opam/lwt@opam:4.4.0@0357bb8b", + "@opam/lwt_log@opam:1.1.1@2d7a797f", "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae", "@opam/camomile@opam:1.0.2@51b42ad8", "@esy-ocaml/substs@0.0.1@d41d8cd9" @@ -1329,7 +1333,7 @@ "ocaml@4.8.1000@d41d8cd9", "@opam/zed@opam:2.0.3@62853a38", "@opam/react@opam:1.2.1@0e11855f", "@opam/lwt_react@opam:1.1.3@72987fcf", - "@opam/lwt_log@opam:1.1.1@2d7a797f", "@opam/lwt@opam:4.4.0@0357bb8b", + "@opam/lwt_log@opam:1.1.1@2d7a797f", "@opam/lwt@opam:5.1.0@e9f9e9f8", "@opam/dune@opam:1.11.4@a7ccb7ae", "@opam/camomile@opam:1.0.2@51b42ad8" ] diff --git a/esy.lock/opam/lwt.4.4.0/opam b/esy.lock/opam/lwt.5.1.0/opam similarity index 85% rename from esy.lock/opam/lwt.4.4.0/opam rename to esy.lock/opam/lwt.5.1.0/opam index 21d7aa8..2a637d6 100644 --- a/esy.lock/opam/lwt.4.4.0/opam +++ b/esy.lock/opam/lwt.5.1.0/opam @@ -2,10 +2,10 @@ opam-version: "2.0" synopsis: "Promises and event-driven I/O" -version: "4.4.0" +version: "5.1.0" license: "MIT" homepage: "https://github.com/ocsigen/lwt" -doc: "https://ocsigen.org/lwt/manual/" +doc: "https://ocsigen.org/lwt" bug-reports: "https://github.com/ocsigen/lwt/issues" authors: [ @@ -42,7 +42,7 @@ conflicts: [ ] post-messages: [ - "Lwt 5.0.0 will make some breaking changes in November 2019. See + "Lwt 5.0.0 has made some minor breaking changes. See https://github.com/ocsigen/lwt/issues/584" ] @@ -60,6 +60,6 @@ a single thread by default. This reduces the need for locks or other synchronization primitives. Code can be run in parallel on an opt-in basis." url { - src: "https://github.com/ocsigen/lwt/archive/4.4.0.tar.gz" - checksum: "md5=8bfc70c2944020fa08dd04877747f5f9" + src: "https://github.com/ocsigen/lwt/archive/5.1.0.tar.gz" + checksum: "md5=04e5ce110c3786199171770c47d968da" } diff --git a/esy.lock/opam/lwt_ppx.1.2.4/opam b/esy.lock/opam/lwt_ppx.2.0.0/opam similarity index 79% rename from esy.lock/opam/lwt_ppx.1.2.4/opam rename to esy.lock/opam/lwt_ppx.2.0.0/opam index 60faf8d..77071eb 100644 --- a/esy.lock/opam/lwt_ppx.1.2.4/opam +++ b/esy.lock/opam/lwt_ppx.2.0.0/opam @@ -2,7 +2,7 @@ opam-version: "2.0" synopsis: "PPX syntax for Lwt, providing something similar to async/await from JavaScript" -version: "1.2.4" +version: "2.0.0" license: "MIT" homepage: "https://github.com/ocsigen/lwt" doc: "https://ocsigen.org/lwt/api/Ppx_lwt" @@ -17,7 +17,7 @@ maintainer: [ dev-repo: "git+https://github.com/ocsigen/lwt.git" depends: [ - "dune" + "dune" {>= "1.1"} "lwt" "ocaml" {>= "4.02.0"} "ocaml-migrate-parsetree" {>= "1.4.0"} @@ -29,6 +29,6 @@ build: [ ] url { - src: "https://github.com/ocsigen/lwt/archive/4.4.0.tar.gz" - checksum: "md5=8bfc70c2944020fa08dd04877747f5f9" + src: "https://github.com/ocsigen/lwt/archive/5.0.0.tar.gz" + checksum: "md5=a4ffc0e3aa692d2e7d800f4cf2dd3db0" } diff --git a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch b/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch index 3e3ee5a..2bd95c5 100644 --- a/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch +++ b/esy.lock/overrides/opam__s__ocamlfind_opam__c__1.8.1_opam_override/files/findlib-1.8.1.patch @@ -463,7 +463,7 @@ +++ ./src/findlib/Makefile @@ -90,6 +90,7 @@ cat findlib_config.mlp | \ - $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ + $(SH) $(TOP)/tools/patch '@Config_file@' '$(OCAMLFIND_CONF)' | \ $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ + $(SH) $(TOP)/tools/patch '@EXEC_SUFFIX@' '$(EXEC_SUFFIX)' | \ sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \ diff --git a/executable/cmd/Cmd.re b/executable/cmd/Cmd.re deleted file mode 100644 index af5a2c7..0000000 --- a/executable/cmd/Cmd.re +++ /dev/null @@ -1 +0,0 @@ -let all = [Cmd__new.cmd, Cmd__list_templates.cmd, Cmd__gen.cmd]; diff --git a/executable/dune b/executable/dune deleted file mode 100644 index 6f4f018..0000000 --- a/executable/dune +++ /dev/null @@ -1,14 +0,0 @@ - -; !!!! This dune file is generated from the package.json file by pesy. If you modify it by hand -; !!!! your changes will be undone! Instead, edit the package.json and then rerun 'esy pesy' at the project root. -; !!!! If you want to stop using pesy and manage this file by hand, change package.json's 'esy.build' command to: refmterr dune build -p @tmattio/spin -(executable - ; The entrypoint module - (name SpinApp) ; From package.json main field - ; The name of the executable (runnable via esy x spin.exe) - (public_name spin.exe) ; From package.json name field - (libraries base cmdliner lwt.unix console.lib pastel.lib spin.lib ) ; From package.json require field (array of strings) - (flags ( -open Base )) ; From package.json flags field - (preprocess ( pps lwt_ppx ppx_let )) ; From package.json preprocess field -) -(include_subdirs unqualified) ; From package.json includeSubdirs field \ No newline at end of file diff --git a/library/Config.re b/lib/config.re similarity index 100% rename from library/Config.re rename to lib/config.re diff --git a/library/config_file/ConfigFile.re b/lib/config_file/config_file.re similarity index 75% rename from library/config_file/ConfigFile.re rename to lib/config_file/config_file.re index 9971659..6c4dede 100644 --- a/library/config_file/ConfigFile.re +++ b/lib/config_file/config_file.re @@ -1,4 +1,4 @@ -module type ConfigFile = { +module type Config_file = { type t; type doc; type cst; @@ -16,7 +16,7 @@ module type ConfigFile = { let doc_of_cst: list(cst) => doc; }; -module Make = (C: ConfigFile) => { +module Make = (C: Config_file) => { open Sexplib; type t = C.t; @@ -39,7 +39,7 @@ module Make = (C: ConfigFile) => { }; }; -module Doc = Make(ConfigFile__Doc); -module Generators = Make(ConfigFile__Generators); -module Template = Make(ConfigFile__Template); -module Project = Make(ConfigFile__Project); +module Doc = Make(Config_file_doc); +module Generators = Make(Config_file_generators); +module Template = Make(Config_file_template); +module Project = Make(Config_file_project); diff --git a/library/config_file/ConfigFile__Common.re b/lib/config_file/config_file_common.re similarity index 100% rename from library/config_file/ConfigFile__Common.re rename to lib/config_file/config_file_common.re diff --git a/library/config_file/ConfigFile__CstUtils.re b/lib/config_file/config_file_cst_utils.re similarity index 91% rename from library/config_file/ConfigFile__CstUtils.re rename to lib/config_file/config_file_cst_utils.re index c3da14e..6fdf000 100644 --- a/library/config_file/ConfigFile__CstUtils.re +++ b/lib/config_file/config_file_cst_utils.re @@ -23,6 +23,6 @@ let rec getUnique = (~f: 'a => option('b)) => let getUniqueExn = (~f, cst: list('a)) => { switch (getUnique(cst, ~f)) { | Some(v) => v - | None => raise(Errors.ConfigFileSyntaxError) + | None => raise(Errors.Config_fileSyntaxError) }; }; diff --git a/library/config_file/ConfigFile__Doc.re b/lib/config_file/config_file_doc.re similarity index 86% rename from library/config_file/ConfigFile__Doc.re rename to lib/config_file/config_file_doc.re index 2420073..a68d156 100644 --- a/library/config_file/ConfigFile__Doc.re +++ b/lib/config_file/config_file_doc.re @@ -32,7 +32,7 @@ let path = "spin"; let doc_of_cst = (cst: list(cst)): doc => { name: - ConfigFile__CstUtils.getUniqueExn( + Config_file_cst_utils.getUniqueExn( cst, ~f= fun @@ -40,7 +40,7 @@ let doc_of_cst = (cst: list(cst)): doc => { | _ => None, ), description: - ConfigFile__CstUtils.getUniqueExn( + Config_file_cst_utils.getUniqueExn( cst, ~f= fun @@ -48,7 +48,7 @@ let doc_of_cst = (cst: list(cst)): doc => { | _ => None, ), commands: - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun @@ -56,7 +56,7 @@ let doc_of_cst = (cst: list(cst)): doc => { | _ => None, ), startingCommand: - ConfigFile__CstUtils.getUnique( + Config_file_cst_utils.getUnique( cst, ~f= fun @@ -64,7 +64,7 @@ let doc_of_cst = (cst: list(cst)): doc => { | _ => None, ), tutorial: - ConfigFile__CstUtils.getUnique( + Config_file_cst_utils.getUnique( cst, ~f= fun diff --git a/library/config_file/ConfigFile__Generators.re b/lib/config_file/config_file_generators.re similarity index 70% rename from library/config_file/ConfigFile__Generators.re rename to lib/config_file/config_file_generators.re index 9693999..c3ff80b 100644 --- a/library/config_file/ConfigFile__Generators.re +++ b/lib/config_file/config_file_generators.re @@ -10,9 +10,9 @@ type file = { type cst = | Name(string) | Description(string) - | Cfg_string(ConfigFile__Common.stringCfg) - | Cfg_list(ConfigFile__Common.listCfg) - | Cfg_confirm(ConfigFile__Common.confirmCfg) + | Cfg_string(Config_file_common.stringCfg) + | Cfg_list(Config_file_common.listCfg) + | Cfg_confirm(Config_file_common.confirmCfg) | File(file); type t = { @@ -32,7 +32,7 @@ let path = "spin"; let doc_of_cst = (cst: list(cst)): doc => { { name: - ConfigFile__CstUtils.getUniqueExn( + Config_file_cst_utils.getUniqueExn( cst, ~f= fun @@ -40,7 +40,7 @@ let doc_of_cst = (cst: list(cst)): doc => { | _ => None, ), description: - ConfigFile__CstUtils.getUniqueExn( + Config_file_cst_utils.getUniqueExn( cst, ~f= fun @@ -52,16 +52,16 @@ let doc_of_cst = (cst: list(cst)): doc => { let t_of_cst = (~useDefaults, ~models, cst: list(cst)): t => { let newModels = - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun - | Cfg_string(v) => Some(ConfigFile__Common.String(v)) - | Cfg_list(v) => Some(ConfigFile__Common.List(v)) - | Cfg_confirm(v) => Some(ConfigFile__Common.Confirm(v)) + | Cfg_string(v) => Some(Config_file_common.String(v)) + | Cfg_list(v) => Some(Config_file_common.List(v)) + | Cfg_confirm(v) => Some(Config_file_common.Confirm(v)) | _ => None, ) - |> ConfigFile__Common.promptConfigs(~useDefaults); + |> Config_file_common.promptConfigs(~useDefaults); let models = List.concat([models, newModels]); @@ -71,7 +71,7 @@ let t_of_cst = (~useDefaults, ~models, cst: list(cst)): t => { name: doc.name, description: doc.description, files: - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun diff --git a/library/config_file/ConfigFile__Project.re b/lib/config_file/config_file_project.re similarity index 96% rename from library/config_file/ConfigFile__Project.re rename to lib/config_file/config_file_project.re index d3572ce..2fb7c71 100644 --- a/library/config_file/ConfigFile__Project.re +++ b/lib/config_file/config_file_project.re @@ -21,7 +21,7 @@ let path = ".spin"; let doc_of_cst = (cst: list(cst)): doc => { { source: - ConfigFile__CstUtils.getUniqueExn( + Config_file_cst_utils.getUniqueExn( cst, ~f= fun @@ -33,7 +33,7 @@ let doc_of_cst = (cst: list(cst)): doc => { let t_of_cst = (~useDefaults, ~models, cst: list(cst)): t => { let newModels = - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun diff --git a/library/config_file/ConfigFile__Template.re b/lib/config_file/config_file_template.re similarity index 71% rename from library/config_file/ConfigFile__Template.re rename to lib/config_file/config_file_template.re index c537dc9..e2f80c5 100644 --- a/library/config_file/ConfigFile__Template.re +++ b/lib/config_file/config_file_template.re @@ -18,9 +18,9 @@ type ignore = { type cst = | Post_install(postInstall) | Ignore(ignore) - | Cfg_string(ConfigFile__Common.stringCfg) - | Cfg_list(ConfigFile__Common.listCfg) - | Cfg_confirm(ConfigFile__Common.confirmCfg); + | Cfg_string(Config_file_common.stringCfg) + | Cfg_list(Config_file_common.listCfg) + | Cfg_confirm(Config_file_common.confirmCfg); type t = { models: list((string, Jg_types.tvalue)), @@ -36,23 +36,23 @@ let doc_of_cst = (cst: list(cst)): doc => (); let t_of_cst = (~useDefaults, ~models, cst: list(cst)) => { let newModels = - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun - | Cfg_string(v) => Some(ConfigFile__Common.String(v)) - | Cfg_list(v) => Some(ConfigFile__Common.List(v)) - | Cfg_confirm(v) => Some(ConfigFile__Common.Confirm(v)) + | Cfg_string(v) => Some(Config_file_common.String(v)) + | Cfg_list(v) => Some(Config_file_common.List(v)) + | Cfg_confirm(v) => Some(Config_file_common.Confirm(v)) | _ => None, ) - |> ConfigFile__Common.promptConfigs(~useDefaults); + |> Config_file_common.promptConfigs(~useDefaults); let models = List.concat([models, newModels]); { models, postInstalls: - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun @@ -60,7 +60,7 @@ let t_of_cst = (~useDefaults, ~models, cst: list(cst)) => { | _ => None, ), ignoreFiles: - ConfigFile__CstUtils.get( + Config_file_cst_utils.get( cst, ~f= fun diff --git a/lib/dune b/lib/dune new file mode 100644 index 0000000..cb1fa63 --- /dev/null +++ b/lib/dune @@ -0,0 +1,5 @@ +(library (name Spin) (public_name spin.lib) (modules (:standard)) + (libraries base console.lib pastel.lib lwt.unix str stdio sexplib jingoo + fileutils) + (flags -open Base) (preprocess (pps lwt_ppx ppx_let ppx_sexp_conv))) +(include_subdirs unqualified) diff --git a/library/Errors.re b/lib/errors.re similarity index 97% rename from library/Errors.re rename to lib/errors.re index aeeae60..7595ef1 100644 --- a/library/Errors.re +++ b/lib/errors.re @@ -1,7 +1,7 @@ exception MissingEnvVar(string); exception IncorrectDestinationPath(string); exception IncorrectTemplateName(string); -exception ConfigFileSyntaxError; +exception Config_fileSyntaxError; exception CurrentDirectoryNotASpinProject; exception GeneratorDoesNotExist(string); @@ -34,7 +34,7 @@ let handleErrors = fn => , ); Caml.exit(203); - | ConfigFileSyntaxError => + | Config_fileSyntaxError => Console.error( "😱 There is a syntax error in one of the configuration file. I can't generate your project." diff --git a/library/Errors.rei b/lib/errors.rei similarity index 90% rename from library/Errors.rei rename to lib/errors.rei index aaeb941..06922ca 100644 --- a/library/Errors.rei +++ b/lib/errors.rei @@ -1,7 +1,7 @@ exception MissingEnvVar(string); exception IncorrectDestinationPath(string); exception IncorrectTemplateName(string); -exception ConfigFileSyntaxError; +exception Config_fileSyntaxError; exception CurrentDirectoryNotASpinProject; exception GeneratorDoesNotExist(string); diff --git a/library/Generators.re b/lib/generators.re similarity index 89% rename from library/Generators.re rename to lib/generators.re index a4b5bb6..fbf32eb 100644 --- a/library/Generators.re +++ b/lib/generators.re @@ -1,6 +1,6 @@ let getProjectRoot = () => { let root = - ConfigFile.Project.path + Config_file.Project.path |> Utils.Sys.get_parent_file |> Option.map(~f=Caml.Filename.dirname); @@ -11,11 +11,11 @@ let getProjectRoot = () => { }; let getProjectConfig = () => { - getProjectRoot() |> ConfigFile.Project.parse; + getProjectRoot() |> Config_file.Project.parse; }; let getProjectDoc = () => { - getProjectRoot() |> ConfigFile.Project.parse_doc; + getProjectRoot() |> Config_file.Project.parse_doc; }; let listGenerators = (source: Source.t) => { @@ -37,7 +37,7 @@ let getGenerator = (name, ~source: Source.t) => { List.find( generators, ~f=el => { - let doc = ConfigFile.Generators.parse_doc(el); + let doc = Config_file.Generators.parse_doc(el); String.equal(doc.name, name); }, ) @@ -64,7 +64,7 @@ let generate = (~useDefaults=false, ~source: Source.t, name) => { let projectRoot = getProjectRoot(); let projectConfig = getProjectConfig(); let generator = - ConfigFile.Generators.parse( + Config_file.Generators.parse( generatorPath, ~useDefaults, ~models=projectConfig.models, @@ -73,7 +73,7 @@ let generate = (~useDefaults=false, ~source: Source.t, name) => { let rec loop = fun | [] => () - | [(f: ConfigFile__Generators.file), ...fs] => { + | [(f: Config_file_generators.file), ...fs] => { generateFile( Utils.Filename.concat(generatorPath, f.source), ~destination=Utils.Filename.concat(projectRoot, f.destination), diff --git a/library/Jg_wrapper.re b/lib/jg_wrapper.re similarity index 100% rename from library/Jg_wrapper.re rename to lib/jg_wrapper.re diff --git a/library/Prompt.re b/lib/prompt.re similarity index 100% rename from library/Prompt.re rename to lib/prompt.re diff --git a/library/Prompt.rei b/lib/prompt.rei similarity index 100% rename from library/Prompt.rei rename to lib/prompt.rei diff --git a/library/Source.re b/lib/source.re similarity index 81% rename from library/Source.re rename to lib/source.re index 5067bbe..a5e9732 100644 --- a/library/Source.re +++ b/lib/source.re @@ -7,7 +7,7 @@ type local = string; let toLocalPath: t => local = fun - | Official(s) => Utils.Filename.concat(TemplateOfficial.path, s) + | Official(s) => Utils.Filename.concat(Template_official.path, s) | LocalDir(s) => s | Git(s) => { let tempdir = Utils.Sys.get_tempdir("spin"); @@ -21,8 +21,8 @@ let ofString = (s: string) => } else if (Vcs.isGitUrl(s)) { Git(s); } else { - TemplateOfficial.ensureDownloaded(); - let templates = TemplateOfficial.all(); + Template_official.ensureDownloaded(); + let templates = Template_official.all(); if (List.exists(templates, ~f=el => String.equal(s, el.name))) { Official(s); } else { diff --git a/library/Template.re b/lib/template.re similarity index 95% rename from library/Template.re rename to lib/template.re index 86fb193..f34d85c 100644 --- a/library/Template.re +++ b/lib/template.re @@ -40,9 +40,9 @@ let generate = (~useDefaults=false, source: Source.t, destination: string) => { let origin = Source.toLocalPath(source); let templatePath = Utils.Filename.concat(origin, "template"); - let templateConfig = ConfigFile.Template.parse(origin, ~useDefaults); + let templateConfig = Config_file.Template.parse(origin, ~useDefaults); let models = templateConfig.models; - let docConfig = ConfigFile.Doc.parse(origin, ~models, ~useDefaults); + let docConfig = Config_file.Doc.parse(origin, ~models, ~useDefaults); let rec loop = fun @@ -141,7 +141,7 @@ let generate = (~useDefaults=false, source: Source.t, destination: string) => { /* Remove spin configuration file from the generated project */ Utils.Filename.rm([Utils.Filename.concat(destination, "spin")]); - ConfigFile__Project.save( + Config_file_project.save( {models, source: Source.toString(source)}, ~destination, ); diff --git a/library/TemplateOfficial.re b/lib/template_official.re similarity index 90% rename from library/TemplateOfficial.re rename to lib/template_official.re index 283a28c..20bf1e5 100644 --- a/library/TemplateOfficial.re +++ b/lib/template_official.re @@ -20,7 +20,7 @@ let ensureDownloaded = () => ); }; -let all = (): list(ConfigFile.Doc.doc) => { +let all = (): list(Config_file.Doc.doc) => { Caml.Sys.readdir(path) |> Array.to_list |> List.filter(~f=el => @@ -34,6 +34,6 @@ let all = (): list(ConfigFile.Doc.doc) => { } ) |> List.map(~f=el => - ConfigFile.Doc.parse_doc(Utils.Filename.concat(path, el)) + Config_file.Doc.parse_doc(Utils.Filename.concat(path, el)) ); }; diff --git a/library/Utils.re b/lib/utils.re similarity index 100% rename from library/Utils.re rename to lib/utils.re diff --git a/library/Vcs.re b/lib/vcs.re similarity index 100% rename from library/Vcs.re rename to lib/vcs.re diff --git a/library/dune b/library/dune deleted file mode 100644 index 59d522b..0000000 --- a/library/dune +++ /dev/null @@ -1,14 +0,0 @@ - -; !!!! This dune file is generated from the package.json file by pesy. If you modify it by hand -; !!!! your changes will be undone! Instead, edit the package.json and then rerun 'esy pesy' at the project root. -; !!!! If you want to stop using pesy and manage this file by hand, change package.json's 'esy.build' command to: refmterr dune build -p @tmattio/spin -(library - ; The namespace that other packages/libraries will access this library through - (name Spin) - ; Other libraries list this name in their package.json 'require' field to use this library. - (public_name spin.lib) - (libraries base console.lib pastel.lib lwt.unix str stdio sexplib jingoo fileutils ) - (flags ( -open Base )) ; From package.json flags field - (preprocess ( pps lwt_ppx ppx_let ppx_sexp_conv )) ; From package.json preprocess field -) -(include_subdirs unqualified) ; From package.json includeSubdirs field \ No newline at end of file diff --git a/package.json b/package.json index 1a19413..3aa3c38 100644 --- a/package.json +++ b/package.json @@ -7,112 +7,7 @@ "publishConfig": { "access": "public" }, - "esy": { - "build": "dune build --root . --only-packages spin", - "buildDev": "pesy", - "buildsInSource": "_build", - "release": { - "bin": { - "spin": "spin.exe" - } - } - }, - "buildDirs": { - "test": { - "require": [ - "spin.lib", - "rely.lib" - ], - "flags": [ - "-open Base", - "-linkall", - "-g" - ], - "includeSubdirs": "unqualified", - "main": "TestRunner", - "name": "test-runner.exe" - }, - "library": { - "preprocess": [ - "pps", - "lwt_ppx", - "ppx_let", - "ppx_sexp_conv" - ], - "require": [ - "base", - "console.lib", - "pastel.lib", - "lwt.unix", - "str", - "stdio", - "sexplib", - "jingoo", - "fileutils" - ], - "flags": [ - "-open Base" - ], - "includeSubdirs": "unqualified", - "name": "spin.lib", - "namespace": "Spin" - }, - "executable": { - "preprocess": [ - "pps", - "lwt_ppx", - "ppx_let" - ], - "require": [ - "base", - "cmdliner", - "lwt.unix", - "console.lib", - "pastel.lib", - "spin.lib" - ], - "flags": [ - "-open Base" - ], - "includeSubdirs": "unqualified", - "main": "SpinApp", - "name": "spin.exe" - } - }, - "dependencies": { - "@esy-ocaml/reason": "*", - "@opam/base": "v0.13.0", - "@opam/cmdliner": "1.0.4", - "@opam/dune": ">=1.6.0", - "@opam/fileutils": "*", - "@opam/jingoo": "*", - "@opam/lwt": "^4.4.0", - "@opam/lwt_ppx": "^1.2.4", - "@opam/ppx_let": "v0.13.0", - "@opam/ppx_sexp_conv": "v0.13.0", - "@opam/sexplib": "v0.13.0", - "@reason-native/console": "^0.1.0", - "@reason-native/pastel": "^0.2.2", - "@reason-native/rely": "^3.1.0", - "ocaml": "~4.8.1000" - }, - "devDependencies": { - "@opam/merlin": "*", - "@opam/odoc": "*", - "@opam/utop": "*", - "refmterr": "*", - "pesy": "*" - }, - "resolutions": { - "@opam/jingoo": "tmattio/jingoo:jingoo.opam#e012716" - }, "scripts": { - "pesy": "bash -c 'env PESY_MODE=update pesy'", - "fmt": "esy dune build @fmt --auto-promote", - "test": "esy x test-runner.exe", - "watch": "esy dune build --root . --only-packages spin --watch", - "doc": "esy dune build @doc", - "utop": "esy dune utop library -- -implicit-bindings", "postinstall": "node scripts/release-postinstall.js" } } diff --git a/scripts/prepare-release.sh b/scripts/release.sh similarity index 97% rename from scripts/prepare-release.sh rename to scripts/release.sh index 82849ec..29c158d 100755 --- a/scripts/prepare-release.sh +++ b/scripts/release.sh @@ -30,7 +30,6 @@ if [ -d ".git" ]; then git commit -m "Bump to ${version}" git tag -a "${output}" -m "${version}" git push origin --tags - npm publish ./ else echo "Please commit staged files prior to bumping" fi diff --git a/spin.opam b/spin.opam index e69de29..00db2f5 100644 --- a/spin.opam +++ b/spin.opam @@ -0,0 +1,15 @@ +opam-version: "2.0" +name: "spin" +description: "" +synopsis: "" +version: "0.1.0" +maintainer: "Thibaut Mattio " +authors: [ + "Thibaut Mattio " +] +homepage: "https://github.com/tmattio/spin" +bug-reports: "https://github.com/tmattio/spin/issues" +license: "MIT" +dev-repo: "git+https://github.com/tmattio/spin.git" +build: [] +depends: [] diff --git a/test/TestRunner.re b/test/TestRunner.re deleted file mode 100644 index cfcb777..0000000 --- a/test/TestRunner.re +++ /dev/null @@ -1,7 +0,0 @@ -include SmokeTest; -include Test__Template; -include Test__TemplateFilter; -include Test__Utils; -include Test__Vcs; - -TestFramework.cli(); diff --git a/test/dune b/test/dune index ad5f90c..a855b0b 100644 --- a/test/dune +++ b/test/dune @@ -1,13 +1,3 @@ - -; !!!! This dune file is generated from the package.json file by pesy. If you modify it by hand -; !!!! your changes will be undone! Instead, edit the package.json and then rerun 'esy pesy' at the project root. -; !!!! If you want to stop using pesy and manage this file by hand, change package.json's 'esy.build' command to: refmterr dune build -p @tmattio/spin -(executable - ; The entrypoint module - (name TestRunner) ; From package.json main field - ; The name of the executable (runnable via esy x test-runner.exe) - (public_name test-runner.exe) ; From package.json name field - (libraries spin.lib rely.lib ) ; From package.json require field (array of strings) - (flags ( -open Base -linkall -g )) ; From package.json flags field -) -(include_subdirs unqualified) ; From package.json includeSubdirs field \ No newline at end of file +(library (name spin_test) (public_name spin.test) (modules (:standard)) + (libraries spin.lib rely.lib) (flags -open Base -linkall -g -w -9)) +(include_subdirs unqualified) diff --git a/test/spin/Test__TemplateFilter.re b/test/spin/jg_wrapper_test.re similarity index 97% rename from test/spin/Test__TemplateFilter.re rename to test/spin/jg_wrapper_test.re index 2fae260..f29d52b 100644 --- a/test/spin/Test__TemplateFilter.re +++ b/test/spin/jg_wrapper_test.re @@ -1,4 +1,4 @@ -open TestFramework; +open Test_framework; open Spin; describe("Test Jg_wrapper", ({test, describe, _}) => { diff --git a/test/spin/Test__Template.re b/test/spin/template_test.re similarity index 92% rename from test/spin/Test__Template.re rename to test/spin/template_test.re index 3d0159d..c968099 100644 --- a/test/spin/Test__Template.re +++ b/test/spin/template_test.re @@ -1,9 +1,9 @@ -open TestFramework; +open Test_framework; open Spin; describe("Test Template", ({test, describe, _}) => { test("generate", ({expect, _}) => { - let dest = TestUtils.get_tempdir("generate"); + let dest = Test_utils.get_tempdir("generate"); let source = Source.LocalDir( Utils.Filename.join(["test", "resources", "sample_template"]), @@ -22,7 +22,7 @@ describe("Test Template", ({test, describe, _}) => { }); test("generate configuration", ({expect, _}) => { - let dest = TestUtils.get_tempdir("generate_config"); + let dest = Test_utils.get_tempdir("generate_config"); let source = Source.LocalDir( Utils.Filename.join(["test", "resources", "sample_template"]), @@ -60,7 +60,7 @@ describe("Test Template", ({test, describe, _}) => { }); test("ignore files", ({expect, _}) => { - let dest = TestUtils.get_tempdir("ignore_files"); + let dest = Test_utils.get_tempdir("ignore_files"); let source = Source.LocalDir( Utils.Filename.join(["test", "resources", "template_with_ignores"]), diff --git a/test/spin/Test__Utils.re b/test/spin/utils_test.re similarity index 96% rename from test/spin/Test__Utils.re rename to test/spin/utils_test.re index f903504..d5ede82 100644 --- a/test/spin/Test__Utils.re +++ b/test/spin/utils_test.re @@ -1,4 +1,4 @@ -open TestFramework; +open Test_framework; open Spin; describe("Test Utils", ({test, describe, _}) => { diff --git a/test/spin/Test__Vcs.re b/test/spin/vcs_test.re similarity index 96% rename from test/spin/Test__Vcs.re rename to test/spin/vcs_test.re index 62aeecc..cdf98af 100644 --- a/test/spin/Test__Vcs.re +++ b/test/spin/vcs_test.re @@ -1,4 +1,4 @@ -open TestFramework; +open Test_framework; open Spin; describe("Test Vcs", ({test, describe, _}) => { diff --git a/test/spin_exe/SmokeTest.re b/test/spin_exe/smoke_test.re similarity index 90% rename from test/spin_exe/SmokeTest.re rename to test/spin_exe/smoke_test.re index 74eb350..bd07279 100644 --- a/test/spin_exe/SmokeTest.re +++ b/test/spin_exe/smoke_test.re @@ -1,4 +1,4 @@ -open TestFramework; +open Test_framework; describe("SmokeTest Version", ({test, _}) => { test("Get version", ({expect}) => { diff --git a/test/support/TestFramework.re b/test/support/test_framework.re similarity index 67% rename from test/support/TestFramework.re rename to test/support/test_framework.re index 517acc6..941afe1 100644 --- a/test/support/TestFramework.re +++ b/test/support/test_framework.re @@ -6,18 +6,14 @@ let tmpDir = Utils.Filename.concat(projectDir, ".tmp"); include Rely.Make({ let config = Rely.TestFrameworkConfig.initialize({ - snapshotDir: - Utils.Filename.concat( - projectDir, - Utils.Filename.concat("test", "__snapshots__"), - ), - projectDir, + snapshotDir: Caml.Filename.concat(Caml.Sys.getcwd(), "_snapshots"), + projectDir: Caml.Sys.getcwd(), }); }); let run = args => { let arguments = - args |> Array.append([|"./_build/default/executable/SpinApp.exe"|]); + args |> Array.append([|"./_build/default/bin/spin_app.exe"|]); let env = Unix.environment() |> Array.append([| @@ -26,4 +22,4 @@ let run = args => { let result = Lwt_process.pread_chars(~env, ("", arguments)) |> Lwt_stream.to_string; Lwt_main.run(result); -}; +}; \ No newline at end of file diff --git a/test/support/TestUtils.re b/test/support/test_utils.re similarity index 100% rename from test/support/TestUtils.re rename to test/support/test_utils.re diff --git a/test_runner/dune b/test_runner/dune new file mode 100644 index 0000000..f005f3b --- /dev/null +++ b/test_runner/dune @@ -0,0 +1,2 @@ +(executable (name test_runner) (modules (:standard)) + (public_name test-runner.exe) (libraries spin.test)) diff --git a/test_runner/test_runner.re b/test_runner/test_runner.re new file mode 100644 index 0000000..3753747 --- /dev/null +++ b/test_runner/test_runner.re @@ -0,0 +1,9 @@ +/** Main entry point for our test runner. + + This simply calls the test framework CLI defined by Rely in the test + library. + + We separate the test runner binary and the test library so that we can link + all the modules in the library when compiling. This allows us to discover + all the test automatically, instead of having to manually include them. */ +Spin_test.Test_framework.cli();