Skip to content

Commit

Permalink
rename package file to nupm.nuon (#51)
Browse files Browse the repository at this point in the history
  • Loading branch information
amtoine authored Dec 15, 2023
1 parent f53aea7 commit 81b27e3
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/design/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/`
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions nupm/install.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
)
}

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion nupm/test.nu
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
)
}

Expand Down
8 changes: 4 additions & 4 deletions nupm/utils/dirs.nu
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ 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
}
}

# 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
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 81b27e3

Please sign in to comment.