From 81b27e3d8dc81d2d98dec882e242932bd22ccf53 Mon Sep 17 00:00:00 2001 From: Antoine Stevan <44101798+amtoine@users.noreply.github.com> Date: Fri, 15 Dec 2023 15:00:07 +0100 Subject: [PATCH] rename package file to `nupm.nuon` (#51) --- README.md | 2 +- docs/design/README.md | 2 +- package.nuon => nupm.nuon | 0 nupm/install.nu | 12 ++++++------ nupm/test.nu | 2 +- nupm/utils/dirs.nu | 8 ++++---- .../packages/spam_custom/{package.nuon => nupm.nuon} | 0 .../packages/spam_module/{package.nuon => nupm.nuon} | 0 .../packages/spam_script/{package.nuon => nupm.nuon} | 0 9 files changed, 13 insertions(+), 13 deletions(-) rename package.nuon => nupm.nuon (100%) rename tests/packages/spam_custom/{package.nuon => nupm.nuon} (100%) rename tests/packages/spam_module/{package.nuon => nupm.nuon} (100%) rename tests/packages/spam_script/{package.nuon => nupm.nuon} (100%) diff --git a/README.md b/README.md index 053c5b2..e33d931 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ $env.PATH = ( ## :test_tube: running a test suite [[toc](#table-of-content)] as it is done in Nupm, one can define tests in a project and run them with the `nupm test` command: -- create a Nushell package with a `package.nuon` file, let's call this example package `package` +- create a Nushell package with a `nupm.nuon` file, let's call this example package `package` - create a `tests/` directory next to the `package/` directory - `tests/` is a regular Nushell directory module, put a `mod.nu` there and any structure you want - import definitions from the package with something like diff --git a/docs/design/README.md b/docs/design/README.md index d476a57..224d3c4 100644 --- a/docs/design/README.md +++ b/docs/design/README.md @@ -5,7 +5,7 @@ This file collects design ideas and directions. The intention is iterate on this > **Note** > in the following, until we settle down on precise names, we use the following placeholders: > - `METADATA_FILE`: the file containing the metadata of a package, -> e.g. `project.nuon`, `metadata.json` or `package.nuon` +> e.g. `project.nuon`, `metadata.json` or `nupm.nuon` > (name inspired by Julia's `Project.toml` or Rust's `Cargo.toml`) > - `NUPM_HOME`: the location of all the `nupm` files, overlays, scripts, libraries, ..., > e.g. `~/.nupm/`, `$env.XDG_DATA_HOME/nupm/` or `~/.local/share/nupm/` diff --git a/package.nuon b/nupm.nuon similarity index 100% rename from package.nuon rename to nupm.nuon diff --git a/nupm/install.nu b/nupm/install.nu index 952490c..a2541e7 100644 --- a/nupm/install.nu +++ b/nupm/install.nu @@ -4,11 +4,11 @@ use utils/dirs.nu [ nupm-home-prompt script-dir module-dir tmp-dir ] use utils/log.nu throw-error def open-package-file [dir: path] { - let package_file = $dir | path join "package.nuon" + let package_file = $dir | path join "nupm.nuon" if not ($package_file | path exists) { throw-error "package_file_not_found" ( - $'Could not find "package.nuon" in ($dir) or any parent directory.' + $'Could not find "nupm.nuon" in ($dir) or any parent directory.' ) } @@ -30,7 +30,7 @@ def open-package-file [dir: path] { # Install list of scripts into a directory # -# Input: Scripts taken from 'package.nuon' +# Input: Scripts taken from 'nupm.nuon' def install-scripts [ pkg_dir: path # Package directory scripts_dir: path # Target directory where to install @@ -63,7 +63,7 @@ def install-scripts [ # Install package from a directory containing 'project.nuon' def install-path [ - pkg_dir: path # Directory (hopefully) containing 'package.nuon' + pkg_dir: path # Directory (hopefully) containing 'nupm.nuon' --force(-f): bool # Overwrite already installed package ] { let pkg_dir = $pkg_dir | path expand @@ -128,7 +128,7 @@ def install-path [ do { cd $tmp_dir - ^$nu.current-exe $build_file ($pkg_dir | path join 'package.nuon') + ^$nu.current-exe $build_file ($pkg_dir | path join 'nupm.nuon') } rm -rf $tmp_dir @@ -147,7 +147,7 @@ def install-path [ # Install a nupm package export def main [ package # Name, path, or link to the package - --path # Install package from a directory with package.nuon given by 'name' + --path # Install package from a directory with nupm.nuon given by 'name' --force(-f) # Overwrite already installed package --no-confirm # Allows to bypass the interactive confirmation, useful for scripting ]: nothing -> nothing { diff --git a/nupm/test.nu b/nupm/test.nu index 8b6a852..c1492f3 100644 --- a/nupm/test.nu +++ b/nupm/test.nu @@ -12,7 +12,7 @@ export def main [ if $pkg_root == null { throw-error "package_file_not_found" ( - $'Could not find "package.nuon" in ($dir) or any parent directory.' + $'Could not find "nupm.nuon" in ($dir) or any parent directory.' ) } diff --git a/nupm/utils/dirs.nu b/nupm/utils/dirs.nu index 61fd0fb..096321f 100644 --- a/nupm/utils/dirs.nu +++ b/nupm/utils/dirs.nu @@ -82,12 +82,12 @@ export def tmp-dir [subdir: string, --ensure]: nothing -> path { $d } -# Try to find the package root directory by looking for package.nuon in parent +# Try to find the package root directory by looking for nupm.nuon in parent # directories. export def find-root [dir: path]: [ nothing -> path, nothing -> nothing] { let root_candidate = 1..($dir | path split | length) | reduce -f $dir {|_, acc| - if ($acc | path join package.nuon | path exists) { + if ($acc | path join nupm.nuon | path exists) { $acc } else { $acc | path dirname @@ -95,8 +95,8 @@ export def find-root [dir: path]: [ nothing -> path, nothing -> nothing] { } # We need to do the last check in case the reduce loop ran to the end - # without finding package.nuon - if ($root_candidate | path join package.nuon | path type) == 'file' { + # without finding nupm.nuon + if ($root_candidate | path join nupm.nuon | path type) == 'file' { $root_candidate } else { null diff --git a/tests/packages/spam_custom/package.nuon b/tests/packages/spam_custom/nupm.nuon similarity index 100% rename from tests/packages/spam_custom/package.nuon rename to tests/packages/spam_custom/nupm.nuon diff --git a/tests/packages/spam_module/package.nuon b/tests/packages/spam_module/nupm.nuon similarity index 100% rename from tests/packages/spam_module/package.nuon rename to tests/packages/spam_module/nupm.nuon diff --git a/tests/packages/spam_script/package.nuon b/tests/packages/spam_script/nupm.nuon similarity index 100% rename from tests/packages/spam_script/package.nuon rename to tests/packages/spam_script/nupm.nuon